4

What are the mandatory parameters of genesis.json File in PoA? and what are their expected values? for ex. values of

byzantiumBlock epi155Block DAOForkBlock EIP150Block EIP158Block epoch nonce mixhash

When I tried to change the value of nonce and mixhash and then started the node, it did not start.

5

Use something like this:

{
    "config": {
        "chainId": <yourChainId>,
        "homesteadBlock": 0,
        "eip150Block": 0,
        "eip155Block": 0,
        "eip158Block": 0,
        "byzantiumBlock": 0,
        "clique": {
            "period": <yourPeriodInSecs>,
            "epoch": <yourEpochInBlocks>
        }
    },
    "alloc": {
        "0000000000000000000000000000000000000001": { "balance": "1" },
        "0000000000000000000000000000000000000002": { "balance": "1" },
        "0000000000000000000000000000000000000003": { "balance": "1" },
        "0000000000000000000000000000000000000004": { "balance": "1" },
        "0000000000000000000000000000000000000005": { "balance": "1" },
        "0000000000000000000000000000000000000006": { "balance": "1" },
        "0000000000000000000000000000000000000007": { "balance": "1" },
        "0000000000000000000000000000000000000008": { "balance": "1" },
        "<yourPreallocAccount>": { "balance": "<yourPreallocAmount>" }
    },
    "coinbase": "0x0000000000000000000000000000000000000000",
    "difficulty": "1",
    "extraData": "0x0000000000000000000000000000000000000000000000000000000000000000<yourInitialSigners>0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
    "gasLimit": "<yourInitialGasLimit>",
    "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "nonce": "0",
    "timestamp": "<yourUnixTimeStamp>"
}
  • yourChainId: Just use a number.
  • yourPeriodInSecs: Block time in seconds. 5 or 10 are good values to start with.
  • yourEpochInBlocks: The default of 30000 is usually good enough.
  • yourPreallocAccount, yourPreallocAmount: Since no coins are created through mining, the preallocated amounts are all you have. Give an account some coins here. (No prefixed "0x".)
  • yourInitialSigners: You need at least one initial signer. Add its account address here.
  • yourInitialGasLimit: The initial gas limit per block. Depends on what you want to do. (Consider 21000 gas/transfer, for example.)
  • yourUnixTimeStamp: The number of seconds since the Unix epoch (1970-01-01).

Notes:

  • The other elements in config are optional; the way they are set here get you a blockchain that works like the current Ethereum (except for Clique). They control the blockchain behavior. You'll find more about what they mean by searching for them.
  • The other accounts in alloc are predefined contracts that get initialized by this. Not strictly necessary but recommended.
  • AFAIK, all the other genesis block elements must be like they are here.
  • What about nonce and mixHash values? If I try to change them I'm always getting error as ` ERROR[06-22|03:34:21] Failed to prepare header for mining err="vote nonce not 0x00..0 or 0xff..f" ` – FLASH Jun 21 '18 at 22:09
  • I don't remember what mixHash is about, but the nonce value is used to vote authorities in and out and must always be one of the two values, as the error message says. In the genesis block, only 0 makes sense. – Gerhard Jun 23 '18 at 14:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.