johguse / profanity

Vanity address generator for Ethereum
834 stars 324 forks source link

Allow up to N nonces for contract creation #43

Open arian487 opened 3 years ago

arian487 commented 3 years ago

The current contract flag only uses the 0th nonce to check if a match is found but it would speed up a lot if you were to allow up to N nonces to be generated before generating a new wallet address to check.

NgVQuang commented 3 years ago

0xFfAE7915C888DE11f5A76FB4dcCF9d065734C7d8

SmartLayer commented 3 years ago

The following patch allows you to get contract addresses with nonce=1 instead of 0:

diff --git a/profanity.cl b/profanity.cl
index 41a3fcf..41c8c67 100644
--- a/profanity.cl
+++ b/profanity.cl
@@ -690,7 +690,7 @@ __kernel void profanity_transform_contract(__global mp_number * const pInverse)
        for (int i = 0; i < 20; i++) {
                h.b[i + 2] = hash[i];
        }
-       h.b[22] = 128;
+       h.b[22] = 1;

        h.b[23] ^= 0x01; // length 23
        sha3_keccakf(&h);

You need to delete the cache-.* file after applying the patch for it to be regenerated with the patched code. You can start from the binaries in release section. If you need nonce=𝑛, replace 1 with 𝑛.

To make it a parameter, such as

./profanity.x64 --contract-nonce 1

You will need to work quite a bit in the source code since you will need to pass more data to the kernel. A patch is welcome (at least by me, not sure if author will accept).