bokub / vanity-eth

💎 Browser-based ETH vanity address generator
https://vanity-eth.tk
MIT License
751 stars 266 forks source link

Vanity Contract Address #30

Closed 0xjluis closed 2 years ago

0xjluis commented 2 years ago

It would be great if you can add this feature.

Thanks.

9-9-9-9 commented 2 years ago

This project is kinda brute-force so it is unable to do it with contract since you must deploy millions/billions contracts to fit your need. Nowadays, deploy a contract into ETH main net costs around $800 each

0xjluis commented 2 years ago

Wut? @9-9-9-9 The addresses in this project are also calculated via brute force. The only two factors to consider in calculating the contract address are the deployer wallet address and the wallet nonce. And you don't have to deploy to calculate the address, you can do it locally.

More info here: https://ethereum.stackexchange.com/questions/760/how-is-the-address-of-an-ethereum-contract-computed

9-9-9-9 commented 2 years ago

@Siul293 idk about this, thanks man

bokub commented 2 years ago

I currently don't have enough knowledge about contracts and contracts addresses, but I might work on it someday if I find enough free time.

9-9-9-9 commented 2 years ago

@Siul293 I see, so the target is to generate an address with ability to deploy a vanity contract at nonce 2

Or better if can generate a vanity address with ability to deploy a vanity contract at nonce 2

Is that right?

0xjluis commented 2 years ago

@9-9-9-9 the target is generating an address with the ability to deploy a vanity contract in a given nonce.

9-9-9-9 commented 2 years ago

hey man @bokub , it's good to go now

const rlp = require('rlp');
const util = require('ethereumjs-util');

const addr = '0x6ac7ea33f8831ea9dcc53393aaa88b25a785dbf0'
const addressAsBytes = util.toBuffer(addr);

for (let nonce = 0; nonce <= 3; nonce++) {
    let calculatedAddressAsBytes = util.keccak256(util.arrToBufArr(rlp.encode([addressAsBytes, nonce]))).slice(12);
    console.log(`nonce${nonce}= "0x${calculatedAddressAsBytes.toString('hex')}"`);
}

/* Output:
nonce0= "0xcd234a471b72ba2f1ccf0a70fcaba648a5eecd8d"
nonce1= "0x343c43a37d37dff08ae8c4a11544c718abb4fcf8"
nonce2= "0xf778b86fa74e846c4f0a1fbd1335fe81c00a0c91"
nonce3= "0xfffd933a0bc612844eaf0c6fe3e5b8e9b6c1d19c"
*/

Test case from here referenced by @Siul293

9-9-9-9 commented 2 years ago

@Siul293 hey, it's here https://github.com/9-9-9-9/Vanity-ERC20-Contract-Address-Generator

bokub commented 2 years ago

If you don't mind using a command-line tool, MyEtherWallet's VanityEth also supports contract addresses.

0xjluis commented 2 years ago

Great !!! Thanks