Ethereum Genesis Block Private Network
Asked Answered
C

5

10

I am trying to mine on a private network.

How does one go about creating a genesis block for a private network in frontier ethereum?

I have seen: https://blog.ethereum.org/2015/07/27/final-steps/ but this is to get the public Genesis block.

Conducive answered 4/8, 2015 at 18:31 Comment(1)
I found that page really hard to follow tooLakia
C
8
{
    "nonce": "0x0000000000000042",
    "difficulty": "0x000000100",
    "alloc": {

    },
    "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "coinbase": "0x0000000000000000000000000000000000000000",
    "timestamp": "0x00",
    "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "gasLimit": "0x16388"
}
Conducive answered 11/8, 2015 at 1:59 Comment(1)
This worked for me. It's basically a blank genesis block, without any of all the initial block sales.Cloudberry
F
5

You can simple take the generated one here and modify the accounts and balances.

Also put the gas limit to a higher number like 0x2dc6c0 (3mio) and move the difficulty down to 0xb

Foggia answered 6/8, 2015 at 8:28 Comment(0)
M
3

You can basically create any Genesis Block that you like, as long as it is valid according to the Yellowpaper, 4.3.4. Block Header Validity.

The Genesis Block does not indicate on which Blockchain a miner works. This is defined by connecting to the right peer-to-peer network or, if you are using the discovery mechanism on a network with multiple Blockchains running, using the network ID.

The (Genesis) Block describes the parameters of this specific Block and they are set according to the Miner's algorithm. Of course, any illegal behavior will be rejected by the consensus mechanism.

In conclusion, you can use the same GB for all custom Blockchains.

The values that have to be of correct in terms of mathematical validation are nonce (Proof of Work), mixhash (Fowler–Noll–Vo reduced DAG value set), timestamp (creation time). The geeky values in this example are a copy from the original Frontier release Genesis Block. The parentHash points to the parent block in the chain and the Genesis Block is the only Block where 0 is allowed and required. alloc allows to "pre-fill" accounts with Ether, but that's not needed here since we can mine Ether very quickly.

The difficulty defines the condition to satisfy by the Miner (hash) algorithm to find a valid block. On a test network, it's generally kept small in order to find a block for every iteration. This is useful for testing since needed to execute transactions on the Blockchain. The block generation frequency is kind of the response time of the Blockchain.

The gasLimit is the upper limit of Gas that a transaction can burn. It's inherited into the next Block. extraData is 32 bytes of free text where you can et(h)ernalise smart things on the Blockchain :) The coinbase is the address that got the mining and transaction execution rewards, in Ether, for this Block. It can be 0 here, since it will be set for each new block according to the coinbase of the Miner that found the Block (and added the transactions).

I have documented this a bit more in detail here.

Hope this helps :)

Memorandum answered 23/9, 2015 at 10:53 Comment(0)
C
2
{
"config": {
           "chainId":2010,
           "homesteadBlock":0,
           "eip155Block":0,
           "eip158Block":0
           },
"gasLimit": "0x8000000",     
"difficulty": "0x400",
"alloc": {}
}

Only above Attributes are accepted in Geth version 1.9 (go1.9)

Coacervate answered 19/9, 2017 at 7:4 Comment(0)
T
-1

Specifically, the genesis block building for private network is well explained in this short article.

One thing that I want to mention here is that the only difference of the genesis block is that it has no reference to the previous block.

Tennies answered 13/11, 2015 at 0:36 Comment(1)
Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference.Tref

© 2022 - 2024 — McMap. All rights reserved.