-
Notifications
You must be signed in to change notification settings - Fork 604
Custom genesis
Genesis file is a database file containing Genesis Block. It contains all the transactions from the Ether sale, and when a user inputs it into the client, it represents their decision to join the network under its terms: it is the first step to consensus.
Genesis files for Frontier and Morden testnets are available here
You can select which genesis to load by specifying profile
parameter on pyethapp startup:
pyethapp --profile morden run
It is possible to load custom genesis allocation in pyethapp. Genesis format is a json and might look like this:
{
"nonce": "0x0000000000000042",
"difficulty": "0x400000000",
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x0000000000000000000000000000000000000000",
"timestamp": "0x00",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData": "0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa",
"gasLimit": "0x1388",
"alloc": {
"3282791d6fd713f1e94f4bfd565eaa78b3a0599d": {
"balance": "1337000000000000000000"
},
"17961d633bcf20a7b029a7d94b7df4da2ec5427f": {
"balance": "229427000000000000000"
}
}
}
There are 3 ways to load custom genesis in pyethapp:
-
Save genesis json as a file (e.g
mygenesis.json
) and use-c
andeth.genesis
:$ pyethapp -c eth.genesis=mygenesis.json run
-
Pass genesis json as a string using
-c
andeth.genesis
argument:$ pyethapp -c eth.genesis='{"nonce":"0x0000000000000042","difficulty":"0x400000000","mixhash":"0x0000000000000000000000000000000000000000000000000000000000000000","coinbase":"0x0000000000000000000000000000000000000000","timestamp":"0x00","parentHash":"0x0000000000000000000000000000000000000000000000000000000000000000","extraData":"0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa","gasLimit":"0x1388","alloc":{"3282791d6fd713f1e94f4bfd565eaa78b3a0599d":{"balance":"1337000000000000000000"},"17961d633bcf20a7b029a7d94b7df4da2ec5427f":{"balance":"229427000000000000000"}}}' run
-
Put genesis json in a config file (e.g.
myconfig.yaml
) and use-C
/--Config
to run pyethapp with that configuration instead of default one~/.config/pyethapp/config.yaml
$ pyethapp -C myconfig.yaml run
or
```console
$ pyethapp --Config myconfig.yaml run
```
`myconfig.yaml` might look like:
```console
accounts:
privkeys_hex: [482580fe05668c54ed16708d17481cf6546be6faca24d4b80919a6ef5ed95c92]
node: {privkey_hex: 7c4a6bc6367dd0cfe27848a1da86ac4f0c5f947f4eefb857ed58728147778d89}
eth:
genesis: PUT_YOUR_GENESIS_JSON_HERE
```
Refer sample genesis files for genesis json format.
Refer Configuring for more details on custom configuration.
You might also find test_app.py helpful to see how custom config can be passed to the app.