johguse / ERADICATE2

Vanity address generator for CREATE2 addresses
261 stars 59 forks source link

More thoughts on 0 bytes #5

Open BlinkyStitt opened 4 years ago

BlinkyStitt commented 4 years ago

So it looks like having 5 leading zero bytes is helpful in reducing deployment costs.

Would it be possible to have a pattern that requires the first 5 bytes to be zero and then adds extra score for more zero bytes anywhere else in the address?

BlinkyStitt commented 4 years ago

Actually, nevermind. Deployment cost ended up being the same.

BlinkyStitt commented 4 years ago

Sorry. Still thinking this through. This might be true.

johguse commented 4 years ago

I'm ready to add functionality, just generalize the required pattern over the hash as much as possible and I'll add it. I.e, is 2 leading zero bytes + 4 additional random zero bytes better than 4 leading zero bytes and 0 additional random zero bytes?

matnad commented 4 years ago

I think leading zero bytes are always worth a lot more than random zero bytes. But among the addresses found with n leading zero bytes, it should prefer ones where more mixed in zero bytes are found.

Leading Zero Bytes: Weight 20 Random Zero Byte: Weight 1

Reasoning:

@WyseNynja

johguse commented 4 years ago

Wonderful, I'll implement this tomorrow and upload a new release.

matnad commented 4 years ago

Thanks, I will definitely be using this once it is available :)

johguse commented 4 years ago

Yeah, sorry for the long delay. Been prioritizing day work, will try to get this done during the week.

BlinkyStitt commented 3 years ago

Will you have any time to work on this soon? If not, could you give some guidance. I'm about ready to deploy some contracts and would like to have lots of leading and mixed 0s

pokrovskyy commented 2 years ago

I think my comment goes along the lines with this request - I would like to score for zero-bytes. This is important for gas-optimization purposes (each non-zero byte in calldata in 18 gas while zero bytes are only 4, please don't ask why does this matter 😆 )

Currently, it seems --zeros option scores for individual zero characters. However, from gas-optimization standpoint, byte alignment is crucial - eg. 2005 is same as 2525 (2 non-zero bytes), but 0025 is much better (1 zero byte, 1 non-zero byte). Thus, it would be great to optimize for zero-bytes @johguse please. Thanks!

pokrovskyy commented 2 years ago

lol @johguse ignore my request above, as I went into the code to implement the above, I noticed you actually added that in 41b8c8e4517ebc6801f38efc2d113cd57f42f6e9 😆 👏 But you should really add that to README.