Skip to content

Instantly share code, notes, and snippets.

Last active March 20, 2023 21:10
Show Gist options
  • Save Agusx1211/de05dabf918d448d315aa018e2572031 to your computer and use it in GitHub Desktop.
Save Agusx1211/de05dabf918d448d315aa018e2572031 to your computer and use it in GitHub Desktop.
Universal deployer for EVM

Universal deployer for EVM contracts

To deploy a contract send the init_code of the contract to the Universal deployer. The deployed contract will have the same counter-factual address on all networks.

Universal deployer address: 0x1b926fbb24a9f78dcdd3272f2d86f5d0660e59c0

Deployment details

Signed transaction: 0xf9010880852416b84e01830222e08080b8b66080604052348015600f57600080fd5b50609980601d6000396000f3fe60a06020601f369081018290049091028201604052608081815260009260609284918190838280828437600092018290525084519495509392505060208401905034f5604080516001600160a01b0383168152905191935081900360200190a0505000fea26469706673582212205a310755225e3c740b2f013fb6343f4c205e7141fcdf15947f5f0e0e818727fb64736f6c634300060a00331ca01820182018201820182018201820182018201820182018201820182018201820a01820182018201820182018201820182018201820182018201820182018201820

Deployer address: 0x9c5a87452d4FAC0cbd53BDCA580b20A45526B3AB

Required funds: 0.02170000000014 ETH

Deployment method

This contract is going to be deployed using the keyless deployment method—also known as Nick’s method—which relies on a single-use address. (See Nick’s article for more details). This method works as follows:

Generate a transaction which deploys the contract from a new random account. This transaction MUST NOT use EIP155 in order to work on any chain. This transaction MUST have a relatively high gas price to be deployed on any chain. In this case, it is going to be 100 Gwei. Set the v, r, s of the transaction signature to the following values:

v: 27,
r: 0x1820182018201820182018201820182018201820182018201820182018201820'
s: 0x1820182018201820182018201820182018201820182018201820182018201820'

Those r and s values—made of a repeating pattern of 1820’s—are predictable “random numbers” generated deterministically by a human.

We recover the sender of this transaction, i.e., the single-use deployment account.

Thus we obtain an account that can broadcast that transaction, but we also have the warranty that nobody knows the private key of that account.

Send exactly 0.02170000000014 ether to this single-use deployment account.

Broadcast the deployment transaction. This operation can be done on any chain, guaranteeing that the contract address is always the same and nobody can use that address with a different contract.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment