3

I want to deploy a private post-merge Ethereum network (i.e. a network that merges right from the genesis). For the execution layer, I created a genesis.json file with the appropriate parameters and I especially included the deposit contract. This gives something like this (note that some values were chosen arbitrarily for example purposes):

{ "config": { "chainId": 2023, "homesteadBlock": 0, "eip150Block": 0, "eip155Block": 0, "eip158Block": 0, "byzantiumBlock": 0, "constantinopleBlock": 0, "petersburgBlock": 0, "istanbulBlock": 0, "muirGlacierBlock": 0, "berlinBlock": 0, "londonBlock": 0, "mergeForkBlock": 0, "mergeNetsplitBlock": 0, "shanghaiTime": 0, "terminalTotalDifficulty": 0, "terminalTotalDifficultyPassed": true }, "nonce": "0x2023", "timestamp": "0x0", "extraData": "0x0", "gasLimit": "0x0", "difficulty": "0x0", "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "coinbase": "0x0000000000000000000000000000000000000000", "number": "0x0", "gasUsed": "0x0", "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "alloc": { "0x4242424242424242424242424242424242424242": { "balance": "0x0", "code": "0x60806040...060b0033", "storage": { "0x0000000000000000000000000000000000000000000000000000000000000022": "0xf5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb4b", "0x0000000000000000000000000000000000000000000000000000000000000023": "0xdb56114e00fdd4c1f85c892bf35ac9a89289aaecb1ebd0a96cde606a748b5d71", ... "0x0000000000000000000000000000000000000000000000000000000000000040": "0x985e929f70af28d0bdd1a90a808f977f597c7c778c489e98d3bd8910d31ac0f7" } }, ... } } 

Regarding the consensus layer configuration, I started by defining a personal version of the mainnet.yaml. Then, based on this configuration file, I want now to generate the necessary genesis.ssz state file. More precisely, I also want to generate N validators and have them registered in the genesis.ssz file. By that, I mean having the following (when parsed into json, with, for instance, lighthouse, lcli pretty-ssz state_merge genesis.ssz | jq):

{ ... "validators": [ { "pubkey": "0xaf8140025e35bf66780ffe7d735465e8d1dcfd2e4fcee5c82ef1add9c6e9e1dc8a5b162ad44b1b1bc88f1d9715f89ebe", "withdrawal_credentials": "0x00fad2a6bfb0e7f1f0f45460944fbd8dfa7f37da06a4d13b3983cc90bb46963b", "effective_balance": "32000000000", "slashed": false, "activation_eligibility_epoch": "0", "activation_epoch": "0", "exit_epoch": "18446744073709551615", "withdrawable_epoch": "18446744073709551615" }, ... { "pubkey": "0x93adea4aed7faa99ad5757fffae398e38130a779b0796bc3ccac76b41dcacfc5d6807659e9afd1189da5aa9e1831d3e8", "withdrawal_credentials": "0x001414bfc6dacca55f974ec910893c8617f9c99da897534c637b50e9fc695323", "effective_balance": "32000000000", "slashed": false, "activation_eligibility_epoch": "0", "activation_epoch": "0", "exit_epoch": "18446744073709551615", "withdrawable_epoch": "18446744073709551615" } ], ... } 

Furthermore, I want to run the lighthouse beacon node and validator clients. So, following the instructions on the lighthouse documentation, I created the validator keys using stacking-deposit-cli:

./deposit new-mnemonic 

This command gives me a validator_keys directory with all the keys following standard EIP-2335.

Small question: this command also gives me a deposit_data-<timestamp>.json file with content as shown partially below. What is this deposit data?

[ { "pubkey": "aee7bbe42b35ecca52ea56c84f9d77d2ab1cdddde508e52faf368b1fde90aa81867e76d5f1a2799446f66ba9eb058057", "withdrawal_credentials": "00898b8a89a9a9774a788a2e94a2518b5a96b290e1bbe8d91237d05481344c72", "amount": 32000000000, "signature": "b56e25e7fbdb6cc9b28bd5987db2dc86b4e87db1d14f50e099616969a9011b757f48ca2c9142f5141bf056f4d6979c2413a6fdc0832fa04ddd6a214a3b50e4f428aaafbff50a691b526554d4817c10fcff72398eff61afbba2c3a298759a7de3", "deposit_message_root": "4982a3020192291799816c6c4675fa9fcd819f09ae89ed6400b3b7c451cac117", "deposit_data_root": "c09670ac47016683236b402d38cac7b01d3f26a6954852cb30a17ab0606bfdd8", "fork_version": "00000000", "network_name": "mainnet", "deposit_cli_version": "2.5.0" }, ... ] 

I can then later easily import these keys in the lighthouse validator clients using:

lighthouse account validator import --directory /path/to/validator_keys 

However, I'm missing something, which is having these newly created validators included in the genesis.ssz state file as claimed earlier. How can I achieve this? Also, am I missing something crucial in the consensus layer configuration?

Regarding the lighthouse beacon node client, how do I start them given the genesis.ssz generated? The documentation states that, for a manual checkpoint sync, both --checkpoint-state and --checkpoint-block must be provided. Is the first one our genesis.ssz file? And what is the second one? How do I get it?

Thank you in advance for your help!

2
  • Hey, have you got the answer. Can you write the whole process in detail to setup a private PoS Ethereum mainnet network? Commented Sep 8, 2024 at 15:23
  • Hi @AbhishekPandey, yes! Describing the whole process would take a while, but here is my repo with all the scripts: github.com/BastienFaivre/minion-L2. If you have any questions about them, feel free to reach out! Commented Sep 9, 2024 at 19:42

1 Answer 1

0

Initializing the db and stuff

reth init --datadir "/Users/qoneqt/Desktop/shubham/rethnode/data" --chain config.json 

Running the node

reth node --datadir "/Users/qoneqt/Desktop/shubham/rethnode/data" --http --ws --port 30303 --http.api all --chain config.json 

Add as many as v for more verbosity ggs

Create the jwt token

header='{"alg":"HS256","typ":"JWT"}' payload='{"iat": '$(date -u +%s)', "exp": '$(date -u -v +100y +%s)'}' secret="a4460edff3b2d2624aa264a3187e06a8f2ce6d2b537918af8d1493c2fce3292e" header_base64=$(echo -n "$header" | openssl base64 -A | tr '+/' '-_' | tr -d '=') payload_base64=$(echo -n "$payload" | openssl base64 -A | tr '+/' '-_' | tr -d '=') signature=$(echo -n "$header_base64.$payload_base64" | openssl dgst -sha256 -mac HMAC -macopt hexkey:$secret -binary | openssl base64 -A | tr '+/' '-_' | tr -d '=') echo "$header_base64.$payload_base64.$signature" 

jwt token

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOiAxNzQ3MDU0MTgzLCAiZXhwIjogNDkwMjcyNzc4M30.4cIrO3f4jRk6KhL1bPsvQ3Qu1JfQrL4wD2D2BJeWxWQ 

check if node is running or not

curl -X POST http://localhost:8551 \ -H "Content-Type: application/json" \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOiAxNzQ3MDUwMjcxfQ.AZN-Qb1eQprecQPuJRsiCSnDYjVQmG1GLWDvaNdMBxw" \ --data '{ "jsonrpc":"2.0", "method":"eth_blockNumber", "params":[], "id":1 }' 

To get the chain id

curl -X POST --data '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":1}' -H "Content-Type: application/json" localhost:8545 

To get the Eth parent hash

curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x0", false],"id":1}' http://127.0.0.1:8545 

Generate your validator keys using the Ethereum Staking Deposit CLI.

then place it here in same dir and run

lighthouse account validator import --directory validator_keys 

what it will do it will !!

Successfully imported 3 validators (0 skipped). 

Running Consensus client - Lighthouse

lighthouse beacon_node \ --testnet-dir ./config \ --datadir ./lighthouse-data \ --jwt-secrets ./data/jwt.hex \ --execution-endpoint http://localhost:8551 \ --disable-packet-filter \ --port 9000 \ --http \ --http-address 0.0.0.0 \ --disable-upnp \ --disable-deposit-contract-sync 

Generate the genesis state of the chain using this command and

this config.yaml is config for our consensus client

eth2-testnet-genesis capella --config=config.yaml --eth1-config="config.json" --mnemonics=mnemonics.yaml --shadow-fork-eth1-rpc=http://localhost:8545 

This still does not connect and gives errors but still solves the issue of connecting the beacon_node idk why?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.