johguse / profanity

Vanity address generator for Ethereum
834 stars 324 forks source link

[Feature] Support for CREATE2 address mining #26

Open Arachnid opened 4 years ago

Arachnid commented 4 years ago

It'd be nice if it were possible to mine addresses for CREATE2. CREATE2 computes addresses based on keccak256(0xff + creator_address + salt + keccak256(initcode)), which means it doesn't require any ECDSA ops, which should make mining much faster. salt is always 32 bytes.

The command line could take the creator address and init code hash, and try salts.

I don't know openCL, but I'd happily pay a modest bounty for this feature.

gitcoinbot commented 4 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


This issue now has a funding of 1.0 ETH (150.86 USD @ $150.86/ETH) attached to it.

janus commented 4 years ago

@Arachnid Which function or what should one do for you here?

janus commented 4 years ago

@Arachnid Which function or what should one do for you here?

johguse commented 4 years ago

@Arachnid I'll have a look at this. Would you prefer a CUDA application if it's faster? Are you running on nVidia hardware?

gitcoinbot commented 4 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work has been started.

These users each claimed they can complete the work by 5 days, 6 hours from now. Please review their action plans below:

1) johguse has been approved to start work.

I'm new to GitCoin so not entirely sure what I need to do here. I would read up on the platform but I'm more interested in getting to work on the code. I'll break out the code I need from the profanity project and make a stand-alone application for CREATE2 addresses that takes the address and initcode as command line parameters.

Learn more on the Gitcoin Issue Details page.

johguse commented 4 years ago

@Arachnid I've finished a working program. I've tested several modes and verified the results in a small Python script and everything seems to be working. You can find it here: https://github.com/johguse/ERADICATE2

gitcoinbot commented 4 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work for 1.0 ETH (145.74 USD @ $145.74/ETH) has been submitted by:

  1. @johguse

@Arachnid please take a look at the submitted work:


Arachnid commented 4 years ago

Amazing job! It's over 4 times the speed compared to generating ECDSA keypairs. If you have any ideas for further performance optimizations, let me know!

johguse commented 4 years ago

I think it's possible to iimprove performance by a few percent. I'll give it a go tomorrow!

Arachnid commented 4 years ago

One slight problem: "Init code must be shorter than 199 characters". A nonstarter for proper contracts! Maybe you could make it take the hash instead?

johguse commented 4 years ago

Yes. Taking the hash via command line is definitely the easiest but I'll look into if I can accept the init code from a file and fix the limit. The 199 limit is because I stripped the Keccak implementation I'm using down to its bare bones removing all the code for accepting arbitrary-length input data so I just need to reintroduce that logic and it should be fine.

Arachnid commented 4 years ago

Alternately, you could hash it in C, before passing it to the GPU code?

Arachnid commented 4 years ago

I only just saw your earlier question about CUDA. I am running on NVIDIA hardware. It's a bit late now, but would it be significantly faster in CUDA?

gitcoinbot commented 4 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


The funding of 1.0 ETH (146.91 USD @ $146.91/ETH) attached to this issue has been approved & issued to @johguse.

k06a commented 4 years ago

@johguse any chance to see this functionality inside profanity?

johguse commented 4 years ago

@Arachnid I did a quick and dirty test on CUDA and it seemed to be about maybe 1.5% faster but it was a very crude test but I'll explore it more tonight and get back to you!

johguse commented 4 years ago

@Arachnid I've upgraded the above OpenCL version to support init codes of arbitrary lengths as well as reading them from files. I hash the init code in C before passing it to the GPU like you suggested. I most probably won't be able to finish CUDA version tonight but hopefully tomorrow. I would expect less than a 10% performance increase but it still seems worthwhile.

Release: https://github.com/johguse/ERADICATE2/releases/tag/v0.2

@k06a While I do reuse large portions of the profanity code it has more to do with OpenCL and Keccak than generating and evaluating public/private key-pairs so it's easier to just keep the applications separate.

johguse commented 4 years ago

@Arachnid My experiments with CUDA didn't yield any extra gains beyond what I'd already achieved in OpenCL but I did manage to improve on the Keccak code a bit. Almost 15% performance increase.

You can find the latest release here: https://github.com/johguse/ERADICATE2/releases/tag/v0.3

I don't think I'll be able to squeeze out that much more so I'll close this ticket in a day or two. I appreciate the bounty and I hope you're satisfied with the result!

BlinkyStitt commented 4 years ago

Any progress on bringing this into profity? Or is having this in eradicate2 enough?

I would really like to have contract addresses with lots of 0s that are managed from my existing hardware wallet.

k06a commented 4 years ago

@johguse do you have single init and precompute keccak256 until salt or repeat these steps for every combination?

auryn-macmillan commented 3 years ago

Did this feature ever get merged? It's still open and I don't see a create2 option in the README, but it looks to have been paid out on Gitcoin


EDIT: Oh wait, I see the link to ERADICATE2. Thanks!