[Ethereum] One smart contract deployed on 2 nodes will have same address

addressesnodes

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?

Best Answer

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.

Related Topic