Deploy Private Ethash Network
Deploy Private Network Node
In this tutorial we will use the following private keys and their corresponding addresses.
DON'T use these keys in production.
0xbAa5f05af4A67A467cEcA89085f162aFb4206Aaa
fb5411342ae51291447515c89bcf6a057e3dbd0b51e060c45cb73406c38f851d
0xc1381ED43B327e3C7A1ADb21285f1e9cB82Bc00d
153b174f5e9948ae4678baed54f88244cc9c39d56b9f17ecef93d7ede633f56b
0x7DE985E2f878c83C4e91b6B1312c0f63A56C844a
89b03c4de62d61be16d22e09c8a48929a9bccd11fa6b37809cfef290292bcba3
Let's describe an Ethereum Node
that uses a custom genesis block to join a private Proof of Work network using Ethash consensus configuration in the genesis block.
In this node, we're using Hyperledger besu client client: besu
, enabling JSON-RPC server rpc: true
so we can query number of peers later in this tutorial, turning on Proof of Work mining miner: true
, setting the address that will collect block reward using coinbase
, and we're loading the node private key from Kubernetes secretd called besu-ethash-nodekey
, this is the private from which the coinbase address is derived.
We're defining a genesis block that uses the value 4444
as network and chain identifier, and used ethash
proof of work consensus engine.
ethash
is required in proof of work networks, even if it's empty like in our example: ethash: {}
.
This node private key secret can be created by:
Private key must not start with 0x
, and must be stored in secret data field called key
.
Let's deploy the node:
Kotal operator will notice your besu-ethash-node
and will create all the necessary pods, persistent volumes, services, configmaps, and secrets.
You can fetch the deployed Ethereum Node
using:
It will return an output similar to the following:
Fetch Node Logs
Get the pods that has been created by Kotal for the node:
It will return an output similar to the following:
Get the logs of the running node:
Deploy a Second Node
Let's deploy another go-ethereum node, and connect it to the previous node in our private proof of work network.
Genesis block must be the same in both nodes, or they will fork at genesis block, and won't reach consensus.
In this node, we're using go-ethereum client client: geth
, turning on Proof of Work mining miner: true
, setting the address that will collect block reward using coinbase
, and loading the miner account private key and password from kubernetes secrets privateKeySecretName: ...
and passwordSecretName: ...
. We're connecting to the first node using staticNodes
option which accepts Node
name or enode url.
staticNodes
accept Node
name or enode URL. Node
name has the format of name.namespace
, namespace is optional if Node
is in the same namespace. If the node doesn't exist, or is not up and running yet, Kotal will not raise an error.
You can create the private key and password secrets using:
Deploy the second node using:
Kotal operator will notice your second geth-ethash-node
and will create all the necessary pods, persistent volumes, services, configmaps, and secrets.
You can fetch the deployed Ethereum Node
s using:
It will return an output similar to the following:
Call JSON-RPC Method net_peerCount
net_peerCount
Get the pods that has been created by Kotal for the node:
It will return an output similar to the following:
Forward localhost:8545 calls to the node pod:
In another terminal window call net_peerCount
JSON-RPC method
You will get JSON result similar to the following:
Homework
Deploy a third node that uses Nethermind client, and use the third private key and address from the table above. Nethermind client is similar to geth, you will import signer account private key and password from kubernetes secrets, and use the same genesis as the other nodes.
Finally you can delete all the nodes by:
Kubernetes garbage collector will delete all the resources that has been created by Kotal Ethereum Node
controller.
Last updated