How an EOA, contract address can be achieved?

What is an mechanism for generating these?


3 Answers 3


The sender and nonce are RLP encoded and then hashed with Keccak-256. You can use ethereumjs-utils to generate EOA addresses.

contractAddress = ethUtil.bufferToHex(ethUtil.generateAddress(address, nonce));

address = Senders Address

nonce = Senders Transaction count


If you deploy a contract from an EOA and don't specify otherwise, the respective EOA will be the owner.

You can use nodejs & web3 to deploy the contract: Deploy contract from NodeJS using web3


In Javascript,

EOA(wallet address): '0x' + keccak256(publicKey).slice(-40)

Like above, wallet address can be achieved by public key. 1) hash it with keccak256. 2) slice rightmost 20 bytes(40 words). 3) Add a '0x' prefix

Contract address: '0x' + keccak256(rlp.encode([sender, nonce])).toString('hex').slice(-40)

Like above, contract address can be achieved by sender's nonce and sender's address. 1) encode sender's address and sender's nonce with rlp. 2) hash it with keccak256. 3) slice right most 20 bytes(40 words). 4) Add a '0x prefix.

You can check generating contract address by yourself, googling blockchains.tools which may help your understanding.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.