Start the Second Producer Node

The following commands assume that you are running this tutorial from your ${EOSIO_SOURCE}directory, from which you ran ./

To start additional nodes, you must first load the eosio.bios contract. This contract enables you to have direct control over the resource allocation of other accounts and to access other privileged API calls. Return to the second terminal window and run the following command to load the contract:

$ cleos --wallet-url http://localhost:8899 set contract eosio build/contracts/eosio.bios
Reading WAST/WASM from build/contracts/eosio.bios/eosio.bios.wast...
Assembling WASM...
Publishing contract...
executed transaction: 808599e85909b5793819a6f303c499d776fede9c9cc2cc1dc9776d3877c60e87  3280 bytes  2200576 cycles
#         eosio <= eosio::setcode               {"account":"eosio","vmtype":0,"vmversion":0,"code":"0061736d0100000001581060037f7e7f0060057f7e7e7e7e...
#         eosio <= eosio::setabi                {"account":"eosio","abi":{"types":[],"structs":[{"name":"set_account_limits","base":"","fields":[{"n...

We will create an account to become a producer, using the account name inita. To create the account, we need to generate keys to associate with the account, and import those into our wallet.

$ cleos create key
Private key: 5HvbXnMVLLQEQRR3He7fu4rj7JziCiCcmWgAVkyhWbatBNFw8sw
Public key: EOS7J9pSmsJLQuHwQ5NZAH1V3MKKGgZtwZ92GqmAfbJqdUXDehiCE

Now import the private key portion into your wallet.

$ cleos --wallet-url http://localhost:8899 wallet import 5HvbXnMVLLQEQRR3He7fu4rj7JziCiCcmWgAVkyhWbatBNFw8sw
imported private key for: EOS7J9pSmsJLQuHwQ5NZAH1V3MKKGgZtwZ92GqmAfbJqdUXDehiCE

Create the inita account that we will use to become a producer.

$ cleos --wallet-url http://localhost:8899 create account eosio inita EOS7J9pSmsJLQuHwQ5NZAH1V3MKKGgZtwZ92GqmAfbJqdUXDehiCE EOS7J9pSmsJLQuHwQ5NZAH1V3MKKGgZtwZ92GqmAfbJqdUXDehiCE
executed transaction: 03d801831dc30fe43a355b2a5e1ff553c5081f6fc8a89a93c86fdffcbb4c891c  352 bytes  102400 cycles
#         eosio <= eosio::newaccount            {"creator":"eosio","name":"inita","owner":{"threshold":1,"keys":[{"key":"EOS7J9pSmsJLQuHwQ5NZAH1V3MK...

In the 4th terminal window, start a second nodeos instance.

$ nodeos --producer-name inita --plugin eosio::chain_api_plugin --plugin eosio::net_api_plugin --http-server-address --p2p-listen-endpoint --p2p-peer-address --config-dir node2 --data-dir node2 --private-key [\"EOS7J9pSmsJLQuHwQ5NZAH1V3MKKGgZtwZ92GqmAfbJqdUXDehiCE\",\"5HvbXnMVLLQEQRR3He7fu4rj7JziCiCcmWgAVkyhWbatBNFw8sw\"]

At this point, the second nodeos is an idle producer. To turn it into an active producer, inita needs to be registered as a producer with the bios node, and the bios node needs to perform an action to update the producer schedule.

$ cleos --wallet-url http://localhost:8899 push action eosio setprods "{ \"version\": 1, \"producers\": [{\"producer_name\": \"inita\",\"block_signing_key\": \"EOS7J9pSmsJLQuHwQ5NZAH1V3MKKGgZtwZ92GqmAfbJqdUXDehiCE\"}]}" -p eosio@active
executed transaction: 95baf281e32f1e54686518c85a1317f4e387977b6f16d2b74061cec605f22238  272 bytes  105472 cycles
#         eosio <= eosio::setprods              {"version":1,"producers":[{"producer_name":"inita","block_signing_key":"EOS7J9pSmsJLQuHwQ5NZAH1V3MKK...

Congratulations, you have now configured a two-node testnet! You can see that the original node is no longer producing blocks but it is receiving them. You can verify this by running the get info commmand against each node.

Close Menu