2

Is it possible to deploy a contract on the blockchain at a self-chosen address?

When deploying a contract by sending contract code to the address null, the contract is created at a "random" address by hashing the transaction's contents (correct me if I'm wrong).

But suppose, I want to deploy my contract at address 0xFFFFFF. How will I accomplish this? This should be important for upgrading smart contract.

4

This is not possible and transaction addresses are computed deterministically as well explained in this answer.

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.

And that should never be made possible, because anyone could easily replace someone else's contract and collect the ETH sent to the respective address.

However there can be upgradeable-smart-contracts, as explained in Upgradeable smart contracts

  • How does ethereum-bridge deploy the Oraclize contract then, so that it is not necessary to change their API? The addresses are hard coded in the Oraclize include files. – Shuzheng Oct 13 '17 at 6:10
  • I'm not aware about oracalize-contract you are refferring, but there can be upgradeable-smart-contracts. refer here as well – Achala Dissanayake Oct 13 '17 at 6:18
  • 1
    Oraclize presumably distribute the private key that will be used to deploy the contract. Since the deploying address is known, and it hasn't transacted on your network before, you can predict the address it will deploy to. If someone malicious had access to your network before you deployed the bridge contract then they could use the same private key to deploy a different contract to that address first, but this shouldn't be a problem in your development environment. – Edmund Edgar Feb 26 '18 at 3:53

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