Cryptographic javascript-functions for ethereum and tutorials to use them with web3js and solidity
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
eth-crypto/dist/es/calculate-contract-address.js

7 lines
380 B

import { generateAddress, toChecksumAddress, toBuffer } from 'ethereumjs-util';
import { addLeading0x } from './util';
export function calculateContractAddress(creatorAddress, nonce) {
var addressBuffer = generateAddress(toBuffer(addLeading0x(creatorAddress)), toBuffer(nonce));
var address = addressBuffer.toString('hex');
return toChecksumAddress(addLeading0x(address));
}