Building the Main Network Node for the EOS DApp Development Series

Building the Main Network Node for the EOS DApp Development Series

Preparation of the Machine

To build a robust main network node for the EOS DApp development series, we need to prepare a powerful machine. The recommended configuration is as follows:

  • CPU: 4-core processor
  • RAM: 8 GB
  • Operating System: CentOS 7
  • System Disk: 50 GB
  • Efficient Cloud Disk: 200 GB

Note that the configuration for this tutorial is general, and you may need to adjust it according to your specific requirements, especially if you plan to provide services.

Creating Profiles

To create a profile for the EOS main network node, we need to create three files: genesis.json, config.ini, and nodeos.

2.1 Creating the genesis.json File

The genesis.json file is the foundation of the EOS blockchain. It contains the initial configuration of the network, including the initial timestamp, initial key, and initial configuration. Here’s an example of what the genesis.json file should look like:

{
  "initial_timestamp": "2018-06-08T08: 08: 08.888",
  "initial_key": "EOS7EarnUhcyYqmdnPon8rm7mBCTnBoot6o7fE2WzjvEX2TdggbL3",
  "initial_configuration": {
    "max_block_net_usage": 1048576,
    "target_block_net_usage_pct": 1000,
    "max_transaction_net_usage": 524288,
    "base_per_transaction_net_usage": 12,
    "net_usage_leeway": 500,
    "context_free_discount_net_usage_num": 20,
    "context_free_discount_net_usage_den": 100,
    "max_block_cpu_usage": 200000,
    "target_block_cpu_usage_pct": 1000,
    "max_transaction_cpu_usage": 150000,
    "min_transaction_cpu_usage": 100,
    "max_transaction_lifetime": 3600,
    "deferred_trx_expiration_window": 600,
    "max_transaction_delay": 3888000,
    "max_inline_action_size": 4096,
    "max_inline_action_depth": 4,
    "max_authority_depth": 6
  }
}

2.1 Creating the config.ini File

The config.ini file is used to configure the EOS node. It contains settings such as the maximum block net usage, target block net usage percentage, and maximum transaction net usage. Here’s an example of what the config.ini file should look like:

[options]
max_block_net_usage = 1048576
target_block_net_usage_pct = 1000
max_transaction_net_usage = 524288
base_per_transaction_net_usage = 12
net_usage_leeway = 500
context_free_discount_net_usage_num = 20
context_free_discount_net_usage_den = 100
max_block_cpu_usage = 200000
target_block_cpu_usage_pct = 1000
max_transaction_cpu_usage = 150000
min_transaction_cpu_usage = 100
max_transaction_lifetime = 3600
deferred_trx_expiration_window = 600
max_transaction_delay = 3888000
max_inline_action_size = 4096
max_inline_action_depth = 4
max_authority_depth = 6

3.1 Installing EOS

To install EOS, we need to download the EOSIO binary from the official GitHub repository and install it on our system. Here are the steps to follow:

$ wget https://github.com/eosio/eos/releases/download/v1.5.3/eosio-1.5.3-1.el7.x86_64.rpm
$ sudo yum install ./eosio-1.5.3-1.el7.x86_64.rpm

4.1 Starting the Node

To start the EOS node, we need to run the nodeos command with the following options:

nodeos --genesis-json /data/eos/genesis.json --data-dir /data/eos/data --config-dir /data/eos/data

5.1 Checking the Status

To check the status of the EOS node, we can use the cleos command with the get info option:

[Root @ t-eos ~] # cleos get info | jq
{
  "server_version": "ced8d7db",
  "chain_id": "aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906",
  "head_block_num": 9083495,
  "last_irreversible_block_num": 9083178,
  "last_irreversible_block_id": "008a992a7c930230b3810faf782c12969ef2d1185b9dc0835e4ab998ab90bd43",
  "head_block_id": "008a9a671cb1a6586d1b89c07cef337e4e288f2a7c638ebe14ffa51ce4195c4d",
  "head_block_time": "2018-08-02T15: 22: 42.000",
  "head_block_producer": "zbeosbp11111",
  "virtual_block_cpu_limit": 200000000,
  "virtual_block_net_limit": 1048576000,
  "block_cpu_limit": 200000,
  "block_net_limit": 1048576,
  "server_version_string": "v1.5.3"
}

This concludes the process of building the main network node for the EOS DApp development series.