Skip to content

Latest commit

 

History

History
104 lines (72 loc) · 4.89 KB

producer-node-lab.md

File metadata and controls

104 lines (72 loc) · 4.89 KB

Run a Local Producer Node

Goal

This laboratory aims to set up a single-node blockchain configuration running on a single host. This is referred to as a single host, single-node testnet. We will set up one node on your local computer to have it producing blocks. The following diagram depicts the desired single host testnet.

Single host single node testnet

Workshop instructions

Complete step two by finding the missing plugin to configure nodeos using the config.ini file and also the console inline configuration.

The student must send:

  1. The config.ini file used to run nodeos.
  2. The command used to run nodeos from the terminal with the needed plugins. Add the command in a .txt file extension.

Help material

To successfully complete this workshop the student can use the next support material:

Prerequisite

Install the EOSIO software. It is assumed that nodeos, cleos, and keosd are accessible through the execution PATH.

Workshop

1. Start the Producer Node

Start your own single-node blockchain:

  • Create a config.ini file.
  • Configure the producer node.

The more advanced user will likely need to modify the configuration. nodeos uses a custom configuration folder where the location is determined by your system.

You can override this if you set a config dir using the --config-dir flag followed by the folder dir.

The default path for the nodeos configuration files are:

  • Mac OS: ~/Library/Application\ Support/eosio/nodeos/config
  • Linux: ~/.local/share/eosio/nodeos/config

A configuration folder can be specified using the --config-dir command line argument to nodeos. If you use this option, you will need to manually copy a config.ini file to your custom config folder path.

If you do not already have a config.ini file ready to use, run nodeos and then close it immediately with Ctrl-C. A default configuration (config.ini) will have been created in the config folder. Edit the config.ini file, adding/updating the following settings to the defaults already in place:

# config.ini:

# Enable production on a stale chain, since a single-node test chain is pretty much always stale
enable-stale-production = true
# Enable block production with the testnet producers
producer-name = eosio
# Load the block producer plugin, so you can produce blocks
plugin = eosio::producer_plugin

Now it should be possible to run nodeos that will start producing blocks.

nodeos

nodeos stores runtime data (e.g., shared memory and log content) in a custom data folder. The location of this folder is determined by your system:

  • Mac OS: ~/Library/Application\ Support/eosio/nodeos/data
  • Linux: ~/.local/share/eosio/nodeos/data

A data folder can be specified using the --data-dir command line argument to nodeos.

2. Get Node Info

To check if the node is running there are two main approaches, the first option is to get the information from the terminal with cleos get info and the second option is to query http://127.0.0.1:8888/v1/chain/get_info from the browser, both of them require the action of a specific plugin.

The output information is as follow:

{
"server_version": "26a4d285",
"chain_id": "8a34ec7df1b8cd06ff4a8abbaa7cc50300823350cadc59ab296cb00d104d2b8f",
"head_block_num": 2690,
"last_irreversible_block_num": 2689,
"last_irreversible_block_id": "00000a81bbf44ad047212432e73a6b35b0ffe3da7d686506c54a0accf2c150f7",
"head_block_id": "00000a82d6d2e84fb203b40f49a8587507c49c18882b452b02a8249da3b7f6d1",
"head_block_time": "2021-12-24T03:43:23.000",
"head_block_producer": "eosio",
"virtual_block_cpu_limit": 2940449,
"virtual_block_net_limit": 15445818,
"block_cpu_limit": 199900,
"block_net_limit": 1048576,
"server_version_string": "v2.1.0",
"fork_db_head_block_num": 2690,
"fork_db_head_block_id": "00000a82d6d2e84fb203b40f49a8587507c49c18882b452b02a8249da3b7f6d1",
"server_full_version_string": "v2.1.0-26a4d285d0be1052d962149e431eb81500782991",
"last_irreversible_block_time": "2021-12-24T03:43:22.500"
}

What's next?

To learn more about nodeos setup, you can explore: