Skip to main content

Launching Local Node

This section explains launching a local node by starting up the nodeop and kiod services.

Prerequisites

  • You have successfully installed Wire Sysio and Wire CDT on your computer without using the wire-cli automation script. The steps below are only relevant if you followed the Binary Installation instructions.

Starting kiod

Typically a user would just create a wallet first and in doing so it would start up kiod.

You can use kiod command to start and restart the process.

kiod
info 2024-05-29T13:48:18.634 kiod wallet_plugin.cpp:38 plugin_initialize ] initializing wallet plugin
info 2024-05-29T13:48:18.635 kiod wallet_api_plugin.cpp:69 plugin_startup ] starting wallet_api_plugin
info 2024-05-29T13:48:18.635 kiod http_plugin.cpp:927 add_handler ] add api url: /v1/wallet/create
info 2024-05-29T13:48:18.635 kiod http_plugin.cpp:927 add_handler ] add api url: /v1/wallet/create_key
info 2024-05-29T13:48:18.635 kiod http_plugin.cpp:927 add_handler ] add api url: /v1/wallet/get_public_keys
info 2024-05-29T13:48:18.635 kiod http_plugin.cpp:927 add_handler ] add api url: /v1/wallet/import_key
info 2024-05-29T13:48:18.635 kiod http_plugin.cpp:927 add_handler ] add api url: /v1/wallet/list_keys
info 2024-05-29T13:48:18.635 kiod http_plugin.cpp:927 add_handler ] add api url: /v1/wallet/list_wallets
info 2024-05-29T13:48:18.635 kiod http_plugin.cpp:927 add_handler ] add api url: /v1/wallet/lock
info 2024-05-29T13:48:18.635 kiod http_plugin.cpp:927 add_handler ] add api url: /v1/wallet/lock_all
info 2024-05-29T13:48:18.635 kiod http_plugin.cpp:927 add_handler ] add api url: /v1/wallet/open
info 2024-05-29T13:48:18.635 kiod http_plugin.cpp:927 add_handler ] add api url: /v1/wallet/remove_key
info 2024-05-29T13:48:18.635 kiod http_plugin.cpp:927 add_handler ] add api url: /v1/wallet/set_timeout
info 2024-05-29T13:48:18.635 kiod http_plugin.cpp:927 add_handler ] add api url: /v1/wallet/sign_digest
info 2024-05-29T13:48:18.635 kiod http_plugin.cpp:927 add_handler ] add api url: /v1/wallet/sign_transaction
info 2024-05-29T13:48:18.635 kiod http_plugin.cpp:927 add_handler ] add api url: /v1/wallet/unlock
info 2024-05-29T13:48:18.636 kiod http_plugin.cpp:927 add_handler ] add api url: /v1/node/get_supported_apis

Verify that kiod is running by:

pidof kiod

Troubleshooting

If you encounter a message similar to the one below:

info  2024-09-25T13:51:58.918 kiod      wallet_plugin.cpp:38          plugin_initialize    ] initializing wallet plugin
warn 2024-09-25T13:51:58.918 kiod wallet_plugin.cpp:65 plugin_initialize ] 3120000 wallet_exception: Wallet exception
Failed to lock access to wallet directory; is another kiod running?
{}
kiod wallet_manager.cpp:304 initialize_lock

Failed to initialize

This is because another instance of kiod process might be running in the background.

Kill all instances: pkill kiod and the restart it.

Starting nodeop

To start nodeop, run:

nodeop -e -p sysio \
--plugin sysio::producer_plugin \
--plugin sysio::producer_api_plugin \
--plugin sysio::chain_api_plugin \
--plugin sysio::http_plugin \
--plugin sysio::state_history_plugin \
--access-control-allow-origin='*' \
--contracts-console \
--http-validate-host=false --disable-replay-opts \
--verbose-http-errors >> ~/nodeop.log 2>&1 &

Command breakdown:

  • starts nodeop with essential plugins;
  • configures the server address;
  • enables CORS without restrictions (*) and includes development logging; logs will be saved to ~/nodeop.log;

For more information on nodeop flags, see nodeop --help or the output of this command here.

NOTE

CORS is enabled for all (*) for development only. Never enable unrestricted CORS on publicly accessible nodes!

Troubleshooting

  • Database dirty flag error

If you see error that looks like the examples below:

info  timestamp nodeop    chain_plugin.cpp:461          operator()           ] Support for builtin protocol feature 'GET_SENDER' (with digest of 'f0af56d2c5a48d60a4a5b5c903edfb7db3a736a94ed589d0b797df33ff9d3e1d') is enabled with preactivation required
info timestamp nodeop chain_plugin.cpp:955 plugin_initialize ] Starting fresh blockchain state using genesis state extracted from blocks.log.
warn timestamp nodeop chain_plugin.cpp:1237 plugin_initialize ] 13 N5boost10wrapexceptISt12system_errorEE: Database dirty flag set
rethrow Database dirty flag set:
{"what":"Database dirty flag set"}
nodeop chain_plugin.cpp:1237 plugin_initialize
error timestamp nodeop main.cpp:153 main ] database dirty flag set (likely due to unclean shutdown): replay required
Database dirty flag set (likely due to unclean shutdown): replay required

Try and include --replay-blockchain or --hard-replay-blockchain flag to the nodeop startup command.

nodeop -e -p sysio \
--plugin sysio::producer_plugin \
--plugin sysio::producer_api_plugin \
--plugin sysio::chain_api_plugin \
--plugin sysio::http_plugin \
--plugin sysio::state_history_plugin \
--access-control-allow-origin='*' \
--contracts-console \
--http-validate-host=false --replay-blockchain --disable-replay-opts \
--verbose-http-errors >> ~/nodeop.log 2>&1 &

If you want to a clean fresh state of the chain, you may want to use --delete-all-blocks.

More details on troubleshooting nodeop can be found here.

You could also change nodeop.log file's location to whatever directory you want.

If there isn't a process running, use the startup command.

Validating nodeop

Check that nodeop is producing blocks. Run the following command:

tail -f ~/nodeop.log

You should see some output in the console similar to:

info  [timestamp] nodeop producer_plugin.cpp:2293 produce_block ] Produced block b50adde5943bdde1... #44 at [timestamp] signed by sysio [trxs: 0, lib: 43, confirmed: 0]
info [timestamp] nodeop producer_plugin.cpp:2293 produce_block ] Produced block 39b2a4fef9db084f... #45 at [timestamp] signed by sysio [trxs: 0, lib: 44, confirmed: 0]
info [timestamp] nodeop producer_plugin.cpp:2293 produce_block ] Produced block cd23d3646d0166dc... #46 at [timestamp] signed by sysio [trxs: 0, lib: 45, confirmed: 0]
info [timestamp] nodeop producer_plugin.cpp:2293 produce_block ] Produced block 14bd99c3c3ffd441... #47 at [timestamp] signed by sysio [trxs: 0, lib: 46, confirmed: 0]
info [timestamp] nodeop producer_plugin.cpp:2293 produce_block ] Produced block 2e5fb9d0f2dce119... #48 at [timestamp] signed by sysio [trxs: 0, lib: 47, confirmed: 0]

Verify the [timestamp] is a recent one and that you aren't looking at a stale logs.

To exit logs: Ctrl + C

Check the Wallet

Open the shell and run the clio wallet list command to list available wallets. We need to validate the installation and see that the command line client clio is working as intended.

You should see a response with an empty list of wallets:

Wallets:
[]

From this point forward, you'll be executing commands from your local system.

Check nodeop endpoints

This step ensures that the RPC API is functioning properly. You can choose one of the following methods:

3.1. Using clio

clio get info 

3.2. HTTP GET request to /get_info

Use your browser to access the get_info endpoint from the chain_api_plugin. Simply click http://localhost:8888/v1/chain/get_info.

http://localhost:8888/v1/chain/get_info
  {
"server_version": "1dd2fd86",
"chain_id": "8a34ec7df1b8cd06ff4a8abbaa7cc50300823350cadc59ab296cb00d104d2b8f",
"head_block_num": 1769,
"last_irreversible_block_num": 1768,
"last_irreversible_block_id": "000006e810b62ae346aa0066d7e3d5fe152285692c4d15dc742e1733b61eb27b",
"head_block_id": "000006e931c346d88fc5cb63ce025bfd5f0843656761ac074b35c1c941684f64",
"head_block_time": "2024-09-25T15:43:18.000",
"head_block_producer": "sysio",
"virtual_block_cpu_limit": 1170419,
"virtual_block_net_limit": 6146775,
"block_cpu_limit": 200000,
"block_net_limit": 1048576,
"server_version_string": "v3.1.6",
"fork_db_head_block_num": 1769,
"fork_db_head_block_id": "000006e931c346d88fc5cb63ce025bfd5f0843656761ac074b35c1c941684f64",
"server_full_version_string": "v3.1.6-1dd2fd862c04c1b49df6b2314eb1a621d0301c9f",
"total_cpu_weight": 0,
"total_net_weight": 0,
"earliest_available_block_num": 1,
"last_irreversible_block_time": "<timestamp>"
}

Alternatively, check the endpoint directly from your terminal using the command:

curl http://localhost:8888/v1/chain/get_info | jq .

Third-party tools used in the steps above: