Proton Technical How To #3
In Proton Technical How To #1 you learnt how to build a Node and sync it to the Proton Testnet. Providing API and Seed services are key to being part of the Proton Service Provider Ecosystem, however to be rewarded for your efforts and to participate in the governance of the chain you will need to become a Proton Block Producer.
Rewards and governance participation can only be achieved by being elected as a Block Producer on the Proton Mainnet. However a prerequisite for Mainnet registration requires all candidate Proton Block Producers to successfully register and produce on the Proton Testnet for a minimum of Two Weeks without missing any rounds.
This 3rd Edition will show you how to configure a Proton Testnet Block Production Node and register your account as a Proton Testnet Block Producer.
How to Set Up a Proton Testnet Block Producer Node
In this example we will be using the same Proton software build process for the Block Producer Node and Cleos Interface Node as used in the first Proton Technical How To.
The Block Producer Node also needs to be configured and sync’d up to the Proton Testnet precisely the same as the first Proton example, additional configuration will be applied later in this guide.
Environment
There is consensus amongst Block Producers that best practice for any EOSIO production deployment is that each node serve a specific function. In particular the Block Producer Node should not be publicly accessible or used as a Public API or Peer.
In this example we will have three different nodes serving specific functions:
Public API and Peer Node
This is the Node created in the First Proton How To Article and will be used to provide public API and Peer services.
It will need to be Sync’d to the current Proton Testnet Headblock
Block Producer Node
This is the Node used to securely sign blocks on the Proton Testnet and the main additional production Node in this example.
It will need to be Sync’d to the current Proton Testnet Headblock.
In addition to configuring the latest available peer list typically found in the Proton Testnet Telegram or in the Proton Testnet Github, it is a good idea to allow it to peer to your own Public Peer Node.
Cleos Interface Node
This Node is completely private and used to interact with the Public Testnet Network via command line. Ubuntu Terminal / MacOS Terminal / Windows Ubuntu Shell are great lightweight OS’s for running this private interface.
Two EOSIO software included applications are used: cleos
which is the command line interface for the EOSIO software and keosd
which is essentially a wallet / key manager service daemon for storing private keys and signing digital messages. If you hadn’t run the installation script after compiling the EOSIO Software you can find the binary’s here: ~/eos/build/programs
As you will be importing your private keys into keosd
it is important that this Node is secured and treated as private.
cleos
uses your keys imported into keosd
as authority to execute privileged actions on the network through an API running in nodeos
Getting a Testnet Account
A Proton Testnet Block Producer requires an account to be created that can be used to register intent to become a producer that Token Holders (Or the Testnet Overlords) are able to vote for.
There is a cost in Proton Testnet Tokens associated with registering an account, however you need an account to hold tokens. This would be problematic, however there is a great tool to get over this hurdle.
The Proton Testnet Monitor provides an excellent interface to create a Testnet Account.
If you are looking for a Testnet token faucet please use the Proton Testnet Resources Faucet to fund your account with Proton Testnet Tokens.
To create an account two key pairs are needed, an active_key and owner_key. It is possible to generate both these key pairs in the Proton Testnet Monitor Tool, however it is best practice to generate your own keys offline using cleos
.
Create two key pairs on the Cleos Interface Node as below:
> cleos create key --to-console
Private key: 5KRenxe8bfYZFufCFcY73Y6gmvkx8mp7oq9XoQAr3hMgieTy
Public key: EOS8kVdQGc1Gv6QGorG3xFsfVaEc4toCPeT6sXKKKBV9i79AyX> cleos create key --to-console
Private key: 5JoxbEYG8F9BzJvAoDwxBUfXkgAVNCHbGqrwk5gGGcm7axQ3
Public key: EOS5ThNtYADR2aqqLjh5w6mpLHQQ3k8bT5tJdPdm7x1r8JeMEC
Next use the Proton Testnet Monitor Tool by selecting <Create Account> to create your account on chain.
The first key will be used as the owner_key and the second as the active_key, notice that the public keys are used.
Keep both of these pairs safely stored in this example we will be using the active_key.
Import your account key to keosd
Now that we have an account lets’s import it to a keosd
wallet so we can use it with cleos
On your Cleos Interface Node Create a Proton Testnet Wallet and import your account key:
> cleos wallet create -n protontestnet --to-console
Creating wallet: protontestnet
Save password to use in the future to unlock this wallet.
Without password imported keys will not be retrievable.
"PW5JqnWs7mZqeAkJQj3PvyU7cS2dTQkM7neJBna6goT1ssS75swYC"
keosd
is automatically started (you may have to make sure it’s in the local path) .. the wallet is then created. This password is for your local wallet called protontestnet, keep is safe. By default the wallets are stored here: ~/eosio-wallet
Import your private active account key:
#Unlock your wallet with the password from before
> cleos wallet unlock -n protontestnet
password: Unlocked: protontestnet#Import your active_key : private
> cleos wallet import -n protontestnet
private key: imported private key for: EOS5ThNtYADR2aqqLjh5w6mpLHQQ3k8bT5tJdPdm7x1r8JeMEC
Configure the Block Producer Node
As already mentioned previously the Block Producer Node needs some specific configuration that enables block signing.
Firstly we need another EOSIO key-pair specifically for signing use, which can be accomplished using the Cleos Interface Node:
> cleos create key --to-console
Private key: 5KEE7HqsNkhx6yWMUwjEp1Zg4Y9L3qnBMjtySThVTWAoGaS
Public key: EOS7QCbXWJxhy8wX2iHRgYD11DvV7jMrRJPdzVb4HQbSRMdLr
Next configure the config.ini
on your Block Producer Node with the following block production additions specific to your deployment:
#This is your BP account name
producer-name = eospherewoot#This is your block signing key-pair
signature-provider = EOS7QCbXWJxhy8wX2iHRgYD11DvV7jMrRJPdzVb4HQbSRMdLr=KEY:5KEE7HqsNkhx6yWMUwjEp1Zg4Y9L3qnBMjtySThVTWAoGaS#Optimises hand off by producing a bit earlier
last-block-time-offset-us = -200000#Lowers CPU time available on last block for better hand off
last-block-cpu-effort-percent = 20#Enables block production on this node
plugin = eosio::producer_plugin
Now restart nodeos
on your Block Producer Node and ensure it catches back up to the headblock.
You can check on both your nodeos
Nodes by querying them from your Cleos Interface Node to ensure they are in a good state.. and on the correct chain:
> cleos -u https://proton-testnet.eosphere.io get info
{
"server_version": "26a4d285",
"chain_id": "71ee83bcf52142d61019d95f9cc5427ba6a0d7ff8accd9e2088ae2abeaf3d3dd",
"head_block_num": 139612109,
"last_irreversible_block_num": 139611776,
"last_irreversible_block_id": "08524e803277b5ec61d9d17fd7576f8f38a61ad931c5b1e4c1e5bd7d0e202b60",
"head_block_id": "08524fcd7a1c1b0cb234501cda617ab1050e3552ba06513f10a608fbce8d9a39",
"head_block_time": "2022-06-23T03:05:58.000",
"head_block_producer": "brotonbp",
"virtual_block_cpu_limit": 200000000,
"virtual_block_net_limit": 1048576000,
"block_cpu_limit": 199900,
"block_net_limit": 1048576,
"server_version_string": "v2.1.0",
"fork_db_head_block_num": 139612109,
"fork_db_head_block_id": "08524fcd7a1c1b0cb234501cda617ab1050e3552ba06513f10a608fbce8d9a39",
"server_full_version_string": "v2.1.0-26a4d285d0be1052d962149e431eb81500782991"
}
Registering your Block Producer Account
Now that you are sure all is correctly configured and your Nodes are in sync with the network, you can register your intent to sign blocks and allow token holders to vote for you.
Before you execute the regproducer
action, now is probably a good time to advertise your intent to the rest of the Proton Testnet Community.
There is a Proton Testnet Telegram Group where you can interact with other Block Producers, Service Providers and DApp builders. You will need to be voted into the #21 to be able to produce blocks, the Telegram Group is the place to ask for these votes as well.
The Proton Testnet also requires that you are approved for registration by the Proton Committee Members. You must apply by completing the Proton Testnet Information Form.
Once approved execute the regproducer
action as below with your specifc details:
> cleos -u https://proton-testnet.eosphere.io system regproducer eospherewoot EOS7QCbXWJxhy8wX2iHRgYD11DvV7jMrRJPdzVb4HQbSRMdLr https://www.eosphere.io
As the action is executed on the block-chain level you can actually point your request to any sync’d testnet API i.e you don’t have to execute this action on your own Nodes.
info 2022-06-23T03:18:56.033 nodeos producer_plugin.cpp:421 on_incoming_block ] Received block 9e9ad0b811995042... #139613664 @ 2022-06-23T03:18:56.000 signed by eospherewoot [trxs: 0, lib: 139613335, conf: 0, latency: 33 ms]
info 2022-06-23T03:18:56.535 nodeos producer_plugin.cpp:421 on_incoming_block ] Received block 8c11cc7ca6dc97fc... #139613665 @ 2022-06-23T03:18:56.500 signed by eospherewoot [trxs: 0, lib: 139613335, conf: 0, latency: 35 ms]
If you have any questions or challenges with getting your Proton Testnet Block Producer Node up and running feel free to reach-out to me or one of the team in the EOSphere Telegram Channel.