Last time topic was Adding Another Node to Private Ethereum Network now we will have look how to add Sealer in Proof of Authority chain.
Sealer on a PoA is like a miner on PoW. You can start a sealer with geth –mine –unlock “0xa132432bf” with a genesis using the clique consensus. The initial sealers are defined in the genesis block.
The protocol defines a voting mechanism to dynamically add new signers and remove existing ones. In Geth this can be controlled via the clique.propose(address, authorized) method (clique_propose for remote RPC calls).
To authorize a new signer, existing ones can propose it via clique.propose(“0x…”, true). When more than half the signers proposed it, the authorization comes into effect immediately and the new account can start signing blocks.
Similarly, existing signers can propose deauthorizing existing ones via clique.propose(“0x…”, false). Again if half + 1 signers deauthorize a signer, it is immediately removed from the list and blocks minted by it are rejected from that point onward.
- list sealers clique.getSigners()
- list propositions: clique.proposals
- discard a proposition: clique.discard(“0x1234234234234”)
- add a new sealer: clique.propose(“0x1234243214312”, true)
- remove a sealer: clique.propose(“0x1234243214312”, false)
So we run next command on geth console for both nodes:
Result can be confirmed with command:
clique.getSigners() ["0x47698a0744d4645b8f8753e4285828dec174fb6f", "0x2C80fc7FAE05Ec4daCC44465fa0a9989C3147bA1"]
If addition was successful then both signer addresses should be in list.
Start mining on second node.
If you see message “Successfully sealed new block” then all is OK and you are ready to go.
If you see message “Signed recently, must wait for others” then there seems to be issue in two nodes connectivity or synchronization.
Usually restarting both nodes helps.
In last article we added connection to other node using Geth console command like this:
Connection to node can also be added as permanent solution.
Geth supports a feature called static nodes if you have certain peers you always want to connect to. Static nodes are re-connected on disconnects. You can configure permanent static nodes by putting something like the following into /geth/static-nodes.json:
[ "enode://email@example.com:3001", "enode://pubkey@ip:port" ]
Bod info for geth node can be obtained via command admin.nodeInfo.enode