Vanity contract address using CREATE2?

I would like to get a vanity contract address.

Just like 1INCH: https://etherscan.io/token/0x111111111117dc0aa78b770fa6a738034120c302

Just like TORN: https://etherscan.io/address/0x77777feddddffc19ff86db637967013e6c6a116c

I would like to deploy to multiple chains: ETH mainnent, xDAI, BSC (Binance Smart Chain).

(I’m not religious about particular chain, some of them have fees that make use prohibitively expensive)

I think that in order to accomplish the same address on multiple chains, I will have to use CREATE2: https://blog.openzeppelin.com/getting-the-most-out-of-create2/

  1. Same contract address on multiple chains (EVM comparible) possible?
  2. Maybe you have a piece of code handy to generate a salt and find such cool addresses?

Thank you for suggestions

2 Likes
  1. Maybe you have a piece of code handy to generate a salt and find such cool addresses?

Does that helps ?

2 Likes

Hi @marsxr,

The problem appears to be in two parts. How to create a vanity address (trial and error) and how to create the same address on multiple chains.

OpenZeppelin Contracts includes a utility for Create2: https://docs.openzeppelin.com/contracts/3.x/api/utils#Create2

You could look at how EIP1820 registry uses the same address on every network (it also has a vanity address):

There are two parts to this question.

Here is another example: https://github.com/gnosis/safe-contract-deployment-replay

Replaying the deployment, same account, same nonce, same gas price, everything the same.


The reason why I prefer CREATE2 and salt is less private key to manage, I could reuse one of the private keys that I already have in place.

I guess I'll need to figure it out, my use case is not typical :sunglasses:

2 Likes

Hello @marsxr,

I run into that issue a few months ago, and came up with this factory:

It is available on most networks, and there is a package to help you deploy on additional networks, or even on local test chains. It uses create2, so you just have to give it the bytecode and a salt.

I do not have a vanity address generator that, given a bytecode and a regexp would “mine” a salt for you, but it might not be very hard to write one.

2 Likes

Realizing some troubles related to oracle (Chainlink).

BSC and XDAI do not have native oracle system yet.

Some of the DeFi functionality is ETH only.


I may still want to deploy a token on multiple chains, using the same address, using CREATE2

Then the contracts using that token can be a little bit different.

Related:

At this point I’m reaching a conclusion that I’m overthinking, paralysis analysis, done is better than perfect.

1 Like