ape icon indicating copy to clipboard operation
ape copied to clipboard

Deployments: Nonce mining

Open fubuloubu opened this issue 3 years ago • 2 comments

Overview

It can be really handy to be able to find a nonce value that would lead to a particularly small number of leading zeros on a contract address. This would make it so you would need less bytecode to express that constant in any type of call (PUSH16 instead of PUSH20 uses less gas and code). Here's an example: https://github.com/ProjectOpenSea/seaport#deployments

Specification

acct.deploy(project.MyContract, ..., leading_zeros=8)

This could will hunt for a nonce by doing acct.transfer(acct, 0) a bunch of times until it finds a deployment address with 8 or more leading zeros in the address

Dependencies

N/a

fubuloubu avatar May 22 '22 02:05 fubuloubu

You don't do this by nonce mining, but rather by generating a new keypair.

It's a feature in tools like VanityEth and profanity and it's unlikely a Python implementation would be faster.

banteg avatar May 25 '22 11:05 banteg

You don't do this by nonce mining, but rather by generating a new keypair.

It's a feature in tools like VanityEth and profanity and it's unlikely a Python implementation would be faster.

Ah... Well, maybe this is an idea for an "ephermal accounts" AccountAPI plugin? :thinking:

Like, maybe:

$ ape ephemeral new --leading-zeroes 8 yearn-v3-deployer
# The next contract that `yearn-v3-deployer` deploys will have 8 leading zeros on it's address

Could also add some TornadoCash integration for funding the account

fubuloubu avatar May 25 '22 16:05 fubuloubu