Deterministic Deployment
Last updated
Last updated
This documentation portal is currently undergoing updates to align with the IoTeX 2.0 Whitepaper release. Information provided here may be incomplete, or out-of-date. Please use this portal for preliminary reference only, and check out the official IoTeX 2.0 Whitepaper for updated information.
.2024 | IoTeX
Deterministic Deployment Proxy Contracts on IoTeX:
IoTeX Mainnet
0x4e59b44847b379578588920ca78fbf26c0b4956c
IoTeX Testnet
0x4e59b44847b379578588920ca78fbf26c0b4956c
"Deterministic deployment" refers to a technique used in various blockchain projects where the same bytecode can be deployed on different blockchains to produce the same contract address. This is achieved through the following two steps:
Deploy the "Proxy Contract"
Replay a special transaction on the target blockchain to deploy a "proxy contract."
The sender of this transaction must be a new address on the target blockchain, i.e., with a nonce of 0.
This will result in the creation of a specific address for the proxy contract.
Deploy the Desired Contract
Use the proxy contract to deploy the desired bytecode.
Inside the proxy contract, the CREATE2 opcode is used to create contracts, so the final contract address depends only on the hash of the bytecode, being independent of the nonce.
This ensures deterministic contract addresses on any blockchain.
This is a popular repository for a deterministic deployer used by many projects:
The test.sh
script performs 2 main steps:
Deploy the proxy
It deploys the proxy ("deployer") contract first, which will get the contract address 0x4e59b44847b379578588920ca78fbf26c0b4956c
.
Deterministically Deploy a Contract
It calls the proxy contract to deploy a demo contract, which will always get the same address regardless of when and where it's deployed (as long as it's created by calling the given proxy and with the same bytecode).
On IoTeX, the project above has been used to deploy a publicly accessible proxy contract for deterministic deployment, whose address is 0x4e59b44847b379578588920ca78fbf26c0b4956c
, same for both testnet and mainnet.
Any IoTeX Project can call the proxy contract on IoTeX like similarly to the project's test script above to obtain deterministic deployment on IoTeX.
This address is a popular proxy contract for deterministic deployment available on many blockchains: by checking this address on etherscan.io for instance, thousands of transactions will be listed that use that contract to obtain deterministic deployment. This demonstrates the widespread adoption and reliability of this method.