openethereum / parity-ethereum

The fast, light, and robust client for Ethereum-like networks.
Other
6.83k stars 1.69k forks source link

Start a local private chain that forks the state of the Ethereum mainnet #10491

Open meronym opened 5 years ago

meronym commented 5 years ago

I'd like to use Parity to spin up a local, private development chain that forks from mainnet (or other public testnet) at a given block.

The private chain would virtually make the entire state of the mainnet (at the chosen block) available on demand - so when my local contracts need to access something from the mainnet state, Parity would interactively query the remote Ethereum node.

This behavior is implemeted by Testrpc/Ganache's --fork parameter and is really handy when testing my contracts that need to talk to other mainnet contracts/libraries, without actually deploying them on the public network.

Describe the solution you'd like

I would like a command line argument:

./parity --fork=http://remote-node:8545@4242424

This would fork the remote chain (e.g. the Ethereum mainnet) at block 4242424 into a local dev chain. The Parity client would use the provided RPC endpoint to query state (when needed) from the remote node to accomplish the above.

Describe alternatives you've considered

@joshua-mir suggested to consider exporting state from a mainnet node running --fat-db and import it into my local dev chain specification as part of the genesis - but this seems quite intensive, considering that my contracts will only ever need access to a really tiny fraction of the entire mainnet state.

adria0 commented 4 years ago

Closing issue due to its stale state.

ytrezq commented 4 years ago

still interested. @adria0 please reopen!

ytrezq commented 4 years ago

@joshua-mir how to use --fat-db for that?