1

Let's get creation of a smart contract address out of the way:

The address for an Ethereum contract is deterministically computed from the address of its creator (sender) and how many transactions the creator has sent (nonce). The sender and nonce are RLP encoded and then hashed with Keccak-256.

Now my question is, if there is only one contract, deployed on 2 nodes, that one contract should have the same address right?

2
  • if I try to deploy the same smart contract on many networks (like MainNet, Ropsten, Kovan, Renkby), what I should to do to keep the same address in all the networks ???
    – arafat877
    May 17, 2021 at 23:55
  • You ask your question here ethereum.stackexchange.com/questions/ask @arafat877 May 18, 2021 at 16:59

1 Answer 1

4

Once a contract is deployed (the deployment transaction is mined), that contract exists on all nodes in the network. Since the deployed contract is included in the state of the blockchain, it is replicated and redundant across all nodes. And yes, this contract will have the same address on all of the nodes.

If you deployed a contract from one node and then deployed the same contract from another node using the same externally owned account, the two contracts would have different addresses because the transaction count (nonce) of the externally owned account would be different. Both of these contracts--that have the same code, but different addresses--would then exist on every node in the network.

4
  • You answer could be 100% correct, but those 2 paragraphs seem a bit contradictory. Specially the same EOC part. Can a smart contract be deployed without EOC? How many ways are there to deploy a smart contract? Aug 7, 2019 at 22:55
  • It is possible to deploy a contract from another contract. You can read more about that here: ethereum.stackexchange.com/questions/13415/… Typically if you are deploying contracts from a node it is from and EOA. An EOA is controlled by a private key, EOAs are not connected to specific nodes.
    – Josh
    Aug 8, 2019 at 13:36
  • But if we can get both the deployer and nonce to match by deploying on 2 different blockchains, we can collide the addresses. Aug 31, 2021 at 7:50
  • But it's not a collision if they are on two different blockchains.
    – Josh
    Sep 1, 2021 at 13:42

Your Answer

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

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