ethereum / staking-deposit-cli

Secure key generation for deposits
Creative Commons Zero v1.0 Universal
538 stars 339 forks source link

Add cli flag for custom network #336

Open dapplion opened 1 year ago

dapplion commented 1 year ago

Producing changes for a custom network requires changes to the source code.

The only data points this tool needs to know about a network to produce deposits and credential changes are:

Both are sufficiently succinct that could be pass as command line args, with some TBD serialization:

csv

--chain 0x41e7c2a77cbd4ecd1b238e7bbcc5e8570edf655b16861b69635d8a1b4fe4a3fd,0x00000000

json

--chain `{"genesis_validators_root": "0x41e7c2a77cbd4ecd1b238e7bbcc5e8570edf655b16861b69635d8a1b4fe4a3fd", "genesis_fork_version": "0x00000000"}`

yaml

--chain `{genesis_validators_root: "0x41e7c2a77cbd4ecd1b238e7bbcc5e8570edf655b16861b69635d8a1b4fe4a3fd", genesis_fork_version: "0x00000000"}`

yaml succinct

--chain `{vr: "0x41e7c2a77cbd4ecd1b238e7bbcc5e8570edf655b16861b69635d8a1b4fe4a3fd", fv: "0x00000000"}`

Allowing to just pass a CLI arg would make it very easy to add to guides as a copy paste command and allow to run any network for free without your maintenance.

avenbreaks commented 1 year ago

working on custom network?

canximan commented 8 months ago

Hi @dapplion, can you explain what is genesis_validators_root (or a document explain it).

I am working on a custom chain, pre-merge. But don't know how to generate this root.

Thank you.

dapplion commented 8 months ago

@canximan sure genesis_validators_root is the root of the validators array at genesis time:

state.genesis_validators_root = hash_tree_root(state.validators)

Code for it here https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#genesis

canximan commented 8 months ago

@canximan sure genesis_validators_root is the root of the validators array at genesis time:

state.genesis_validators_root = hash_tree_root(state.validators)

Code for it here https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#genesis

Great, thank you very much.

So deposit before the merge will have the genesis_validators_root = zero hash.