Genesis block Explanation
mixhash A 256-bit hash which proves, combined with the nonce
, that a sufficient amount of computation has been carried out on this block: the Proof-of-Work (PoW).
The combination of nonce
and mixhash
must satisfy a mathematical condition described in the Yellowpaper, 4.3.4. Block Header Validity, (44). It allows to verify that the Block has really been cryptographically mined, thus, from this aspect, is valid.
nonce A 64-bit hash, which proves, combined with the mix-hash, that a sufficient amount of computation has been carried out on this block: the Proof-of-Work (PoW).
The combination of nonce
and mixhash
must satisfy a mathematical condition described in the Yellowpaper, 4.3.4. Block Header Validity, (44), and allows to verify that the Block has really been cryptographically mined and thus, from this aspect, is valid.
The nonce
is the cryptographically secure mining proof-of-work that proves beyond reasonable doubt that a particular amount of computation has been expended in the determination of this token value. (Yellowpager, 11.5. Mining Proof-of-Work).
difficulty A scalar value corresponding to the difficulty level applied during the nonce
discovering of this block. It defines the mining Target, which can be calculated from the previous block’s difficulty level and the timestamp. The higher the difficulty, the statistically more calculations a Miner must perform to discover a valid block. This value is used to control the Block generation time of a Blockchain, keeping the Block generation frequency within a target range. On the test network, we keep this value low to avoid waiting during tests, since the discovery of a valid Block is required to execute a transaction on the Blockchain.
alloc Allows defining a list of pre-filled wallets. That’s an Ethereum specific functionality to handle the “Ether pre-sale” period. Since we can mine local Ether quickly, we don’t use this option.
coinbase The 160-bit address to which all rewards (in Ether) collected from the successful mining of this block have been transferred. They are a sum of the mining reward itself and the Contract transaction execution refunds. Often named “beneficiary” in the specifications, sometimes “etherbase” in the online documentation. This can be anything in the Genesis Block since the value is set by the setting of the Miner when a new Block is created.
timestamp A scalar value equal to the reasonable output of Unix time()
function at this block inception.
This mechanism enforces a homeostasis in terms of the time between blocks. A smaller period between the last two blocks results in an increase in the difficulty level and thus additional computation required to find the next valid block. If the period is too large, the difficulty, and expected time to the next block, is reduced.
The timestamp also allows verifying the order of block within the chain (Yellowpaper, 4.3.4. (43)).
parentHash The Keccak 256-bit hash of the entire parent block header (including its nonce
and mixhash
). Pointer to the parent block, thus effectively building the chain of blocks. In the case of the Genesis block, and only in this case, it’s 0
.
extraData An optional free, but max. 32-byte long space to conserve smart things for ethernity. :)
gasLimit A scalar value equal to the current chain-wide limit of Gas expenditure per block. High in our case to avoid being limited by this threshold during tests. Note: this does not indicate that we should not pay attention to the Gas consumption of our Contracts.
If you can't telnet then there is something wrong with your networking. Either your virtual network connection between hosts is the problem or there is a firewall blocking connections.
If you are just getting started then I'd keep things really simple first of all and:
- Use standard geth nodes
- Run your nodes on one virtual machine on different ports
e.g. initialise your geth nodes like this:
ethuser@host01:~$ mkdir test1
ethuser@host01:~$ cd test1
ethuser@host01:~/test1$ mkdir nodeA
ethuser@host01:~/test1$ mkdir nodeB
ethuser@host01:~/test1$ <use your favourite editor to create a genesis.json file in this directory>
ethuser@host01:~/test1$ geth --datadir nodeA init genesis.json
WARN [08-04|10:41:41] No etherbase set and no accounts found as default
INFO [08-04|10:41:41] Allocated cache and file handles database=/home/ethuser/test1/nodeA/geth/chaindata cache=16 handles=16
INFO [08-04|10:41:41] Writing custom genesis block
INFO [08-04|10:41:41] Successfully wrote genesis state database=chaindata hash=dd3f8d…707d0d
INFO [08-04|10:41:41] Allocated cache and file handles database=/home/ethuser/test1/nodeA/geth/lightchaindata cache=16 handles=16
INFO [08-04|10:41:41] Writing custom genesis block
INFO [08-04|10:41:41] Successfully wrote genesis state database=lightchaindata hash=dd3f8d…707d0d
ethuser@host01:~/test1$ geth --datadir nodeB init genesis.json
WARN [08-04|10:41:52] No etherbase set and no accounts found as default
INFO [08-04|10:41:52] Allocated cache and file handles database=/home/ethuser/test1/nodeB/geth/chaindata cache=16 handles=16
INFO [08-04|10:41:52] Writing custom genesis block
INFO [08-04|10:41:52] Successfully wrote genesis state database=chaindata hash=dd3f8d…707d0d
INFO [08-04|10:41:52] Allocated cache and file handles database=/home/ethuser/test1/nodeB/geth/lightchaindata cache=16 handles=16
INFO [08-04|10:41:52] Writing custom genesis block
INFO [08-04|10:41:52] Successfully wrote genesis state database=lightchaindata hash=dd3f8d…707d0d
ethuser@host01:~/test1$
Then launch your first geth node like this
ethuser@host01:~/test1$ geth --datadir nodeA --networkid 1234567 console
WARN [08-04|10:42:22] No etherbase set and no accounts found as default
INFO [08-04|10:42:22] Starting peer-to-peer node instance=Geth/v1.6.7-stable-ab5646c5/linux-amd64/go1.8.1
INFO [08-04|10:42:22] Allocated cache and file handles database=/home/ethuser/test1/nodeA/geth/chaindata cache=128 handles=1024
WARN [08-04|10:42:22] Upgrading chain database to use sequential keys
INFO [08-04|10:42:22] Initialised chain configuration config="{ChainID: 1907 Homestead: 0 DAO: <nil> DAOSupport: false EIP150: <nil> EIP155: 0 EIP158: 0 Metropolis: <nil> Engine: unknown}"
INFO [08-04|10:42:22] Disk storage enabled for ethash caches dir=/home/ethuser/test1/nodeA/geth/ethash count=3
INFO [08-04|10:42:22] Disk storage enabled for ethash DAGs dir=/home/ethuser/.ethash count=2
WARN [08-04|10:42:22] Upgrading db log bloom bins
INFO [08-04|10:42:22] Bloom-bin upgrade completed elapsed=252.683µs
INFO [08-04|10:42:22] Initialising Ethereum protocol versions="[63 62]" network=1234567
INFO [08-04|10:42:22] Database conversion successful
INFO [08-04|10:42:22] Loaded most recent local header number=0 hash=dd3f8d…707d0d td=40
INFO [08-04|10:42:22] Loaded most recent local full block number=0 hash=dd3f8d…707d0d td=40
INFO [08-04|10:42:22] Loaded most recent local fast block number=0 hash=dd3f8d…707d0d td=40
INFO [08-04|10:42:22] Starting P2P networking
INFO [08-04|10:42:22] UDP listener up self=enode://9ce583f7e1905b23217cd2a92894291c6d8f5ce7a29e85fdeaf48b3ab065c6d5b6cce4f064fdaf26f41d2354bf0a203438563f6ffdba73cec3b8692f6f850817@[::]:30303
INFO [08-04|10:42:22] RLPx listener up self=enode://9ce583f7e1905b23217cd2a92894291c6d8f5ce7a29e85fdeaf48b3ab065c6d5b6cce4f064fdaf26f41d2354bf0a203438563f6ffdba73cec3b8692f6f850817@[::]:30303
INFO [08-04|10:42:22] IPC endpoint opened: /home/ethuser/test1/nodeA/geth.ipc
Welcome to the Geth JavaScript console!
instance: Geth/v1.6.7-stable-ab5646c5/linux-amd64/go1.8.1
modules: admin:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0
>
And then start up your second node. In my case I needed to use ethuser@host01:~/test1$ geth --datadir nodeB --port 30304 --networkid 1234567 --bootnodes enode://9ce583f7e1905b23217cd2a92894291c6d8f5ce7a29e85fdeaf48b3ab065c6d5b6cce4f064fdaf26f41d2354bf0a203438563f6ffdba73cec3b8692f6f850817@127.0.0.1:30303
Wait a few moments to give the nodes a chance to connect and then double check in your console that admin.peers
returns some more info, e.g.
> admin.peers
[{
caps: ["eth/63"],
id: "9ce583f7e1905b23217cd2a92894291c6d8f5ce7a29e85fdeaf48b3ab065c6d5b6cce4f064fdaf26f41d2354bf0a203438563f6ffdba73cec3b8692f6f850817",
name: "Geth/v1.6.7-stable-ab5646c5/linux-amd64/go1.8.1",
network: {
localAddress: "127.0.0.1:41900",
remoteAddress: "127.0.0.1:30303"
},
protocols: {
eth: {
difficulty: 40,
head: "0xdd3f8d61f38ebc195a6c9b0e5888e7e035f31ecd92e4427fb01176b984707d0d",
version: 63
}
}
}]
>
I've left out creating accounts etc as you don't specifically ask it but if you're interested here are some more of my own newbie experiences: https://alanbuxton.wordpress.com/2017/07/19/first-steps-with-ethereum-private-networks-and-smart-contracts-on-ubuntu-16-04/
Best Answer
You can follow the steps given in the answer link below to create a private net and the steps also include how to fund your default account while initializing genesis block.
Basically, you need to allocate balance in Genesis file to an account which you might have created using this command -
Please take a look at this answer for the steps - How do I set up a private ethereum network?