This PR adds dumpgenesis
capability to geth: ethereum/go-ethereum#20191
git clone [email protected]:etclabscore/ethereum.go-ethereum.git etc-geth
cd etc-geth
git checkout etclabscore:feat/cmd-dumpgenesis
make geth
./build/geth dumpgenesis > genesis-mainnet.json
./build/geth --testnet dumpgenesis > genesis-ropsten.json
I'm using jq, a sed-like text manipulation for JSON.
- Transform
{… alloc:{address: {balance: 123}, …}
to{address: 123}
- Prepend 0x to address
geth dumpgenesis
already comes with hex balances, so no balance transformation needed
cat genesis-mainnet.json | jq '.alloc | to_entries[] | { ("0x"+.key): .value.balance }' | jq -s add > mainnet.json
wget https://github.com/paritytech/parity-ethereum/blob/master/ethcore/res/ethereum/kovan.json
Transforms it to our genesis format, removing null entries
cat kovan.json | jq '.accounts | to_entries[] | {(.key): .value.balance}' | jq -s add | grep -v "null" > genesis-kovan.json
Manually converting the only decimal value to hex
echo "obase=16; 1606938044258990275541962092341162602522202993782792835301376" | bc
- run
npm run dist
(ethereumjs-common) - link/import this branch to
ethereumjs-vm/node_modules/ethereumjs-common
- from ethereumjs-vm dir, run
npm run build:dist && tape './tests/api/state/stateManager.js'
This test ensures genesis block hash matches state root for each chain.