Run A Node Using Docker

Overview

For the ease use of Docker and setup a local node or our Mainnet node, we provide a docker helper script called docker_ops.py. For the complete help, you can move forward to this page: Docker reference. Here we will only provide a simple script that will run both a local test node and wallet program.

Step 1: Pull Image

First you need to pull the necessary Docker image

docker pull everitoken/evt:latest

Step 2: Get the Script

Then get the helper script

wget https://raw.githubusercontent.com/everitoken/evt/master/scripts/docker_ops.py
chmod +x ./docker_ops.py

python3 is needed for this script, and these python packages is also needed: click and docker. If you're using Ubuntu, you can install required packages like this:

DEBIAN_FRONTEND=noninteractive apt-get install -y python3-pip && pip3 install click docker

If everything is right, you can get the help page

./docker_ops.py --help

Step 3: Setup the Local Node

Setup Network In order to make it possible to be connected between evtd and evtc, containers should be in the same Docker network. So first we need to create a network in Docker. You can simply called like:

./docker_ops.py network init

This will output:

Network: evt-net network is created

An default evt-net network will be created. If you'd like other name, you can add --name or -n option.

Use the following script to setup a local node

./docker_ops.py evtd init
./docker_ops.py evtd create -t testnet --http-port=8888 --p2p-port=7888 --host=0.0.0.0 -- --http-validate-host=false --verbose-http-errors --plugin=evt::evt_link_plugin --producer-name=evt -e --delete-all-blocks
./docker_ops.py evtd start
./docker_ops.py evtd logs

If you can see the logs like:

info  2018-11-28T08:02:12.123 thread-0  chain_plugin.cpp:419          plugin_initialize    ] Deleting state database and blocks
warn  2018-11-28T08:02:12.124 thread-0  chain_plugin.cpp:561          plugin_initialize    ] Starting up fresh blockchain with default genesis state.
info  2018-11-28T08:02:12.427 thread-0  http_plugin.cpp:536           plugin_initialize    ] configured http to listen on 0.0.0.0:8888
info  2018-11-28T08:02:12.427 thread-0  net_plugin.cpp:3018           plugin_initialize    ] Initialize net plugin
info  2018-11-28T08:02:12.427 thread-0  net_plugin.cpp:3045           plugin_initialize    ] host: 0.0.0.0 port: 7888 
info  2018-11-28T08:02:12.427 thread-0  net_plugin.cpp:3112           plugin_initialize    ] my node_id is afebf7970df1b69d49f9f8d448008b381d2e332eafcad251e3a33662574cc7ab
Logging config file is not avaiable: /opt/evt/etc/evtd/logging.json
info  2018-11-28T08:02:12.427 thread-0  main.cpp:151                  main                 ] evtd version evt-v2.2-61-g6470938b
info  2018-11-28T08:02:12.427 thread-0  main.cpp:152                  main                 ] evt root is /root/.local/share
warn  2018-11-28T08:02:12.427 thread-0  controller.cpp:1167           startup              ] No head block in fork db, perhaps we need to replay
warn  2018-11-28T08:02:12.494 thread-0  token_database.cpp:1294       load_savepoints      ] No savepoints log in token database
warn  2018-11-28T08:02:12.494 thread-0  controller.cpp:497            initialize_fork_db   ]  Initializing new blockchain with genesis state
info  2018-11-28T08:02:12.528 thread-0  chain_plugin.cpp:665          plugin_startup       ] starting chain in read/write mode
info  2018-11-28T08:02:12.528 thread-0  chain_plugin.cpp:670          plugin_startup       ] Blockchain started; head block is #1, genesis timestamp is 2018-05-31T12:00:00.000
info  2018-11-28T08:02:12.538 thread-0  http_plugin.cpp:614           plugin_startup       ] start listening for http requests
info  2018-11-28T08:02:12.538 thread-0  history_api_plugin.cpp:69     plugin_startup       ] starting history_api_plugin
info  2018-11-28T08:02:12.538 thread-0  evt_link_plugin.cpp:225       plugin_startup       ] starting evt_link_plugin
info  2018-11-28T08:02:12.538 thread-0  http_plugin.cpp:723           add_deferred_handler ] add deferred api url: /v1/evt_link/get_trx_id_for_link_id
info  2018-11-28T08:02:12.538 thread-0  net_plugin.cpp:3133           plugin_startup       ] starting listener, max clients is 25
info  2018-11-28T08:02:12.538 thread-0  producer_plugin.cpp:710       plugin_startup       ] producer plugin:  plugin_startup() begin
info  2018-11-28T08:02:12.538 thread-0  producer_plugin.cpp:733       plugin_startup       ] Launching block production for 1 producers at 2018-11-28T08:02:12.538.
info  2018-11-28T08:02:12.538 thread-0  producer_plugin.cpp:745       plugin_startup       ] producer plugin:  plugin_startup() end
info  2018-11-28T08:02:13.001 thread-0  producer_plugin.cpp:1440      produce_block        ] Produced block 000000024909b869... #2 @ 2018-11-28T08:02:13.000 signed by evt [trxs: 0, lib: 0, confirmed: 0]
info  2018-11-28T08:02:13.501 thread-0  producer_plugin.cpp:1440      produce_block        ] Produced block 000000035a52a036... #3 @ 2018-11-28T08:02:13.500 signed by evt [trxs: 0, lib: 2, confirmed: 0]
info  2018-11-28T08:02:14.000 thread-0  producer_plugin.cpp:1440      produce_block        ] Produced block 000000046ef8c6d6... #4 @ 2018-11-28T08:02:14.000 signed by evt [trxs: 0, lib: 3, confirmed: 0]
info  2018-11-28T08:02:14.501 thread-0  producer_plugin.cpp:1440      produce_block        ] Produced block 000000053969d9fc... #5 @ 2018-11-28T08:02:14.500 signed by evt [trxs: 0, lib: 4, confirmed: 0]

Then the local node is setup.

Step 4: Setup Wallet Program

Then use the scripts below to setup wallet program

./docker_ops.py evtwd init
./docker_ops.py evtwd create
./docker_ops.py evtwd start
./docker_ops.py evtwd logs

If you see the logs like

info  2018-11-28T09:50:57.252 thread-0  wallet_plugin.cpp:46          plugin_initialize    ] initializing wallet plugin
info  2018-11-28T09:50:57.252 thread-0  http_plugin.cpp:706           add_handler          ] add local only api url: /v1/evtwd/stop
info  2018-11-28T09:50:57.252 thread-0  wallet_api_plugin.cpp:77      plugin_startup       ] starting wallet_api_plugin
info  2018-11-28T09:50:57.252 thread-0  http_plugin.cpp:706           add_handler          ] add local only api url: /v1/wallet/create
info  2018-11-28T09:50:57.252 thread-0  http_plugin.cpp:706           add_handler          ] add local only api url: /v1/wallet/create_key
info  2018-11-28T09:50:57.252 thread-0  http_plugin.cpp:706           add_handler          ] add local only api url: /v1/wallet/get_my_signatures
info  2018-11-28T09:50:57.252 thread-0  http_plugin.cpp:706           add_handler          ] add local only api url: /v1/wallet/get_public_keys
info  2018-11-28T09:50:57.252 thread-0  http_plugin.cpp:706           add_handler          ] add local only api url: /v1/wallet/import_key
info  2018-11-28T09:50:57.252 thread-0  http_plugin.cpp:706           add_handler          ] add local only api url: /v1/wallet/list_keys
info  2018-11-28T09:50:57.252 thread-0  http_plugin.cpp:706           add_handler          ] add local only api url: /v1/wallet/list_wallets
info  2018-11-28T09:50:57.252 thread-0  http_plugin.cpp:706           add_handler          ] add local only api url: /v1/wallet/lock
info  2018-11-28T09:50:57.252 thread-0  http_plugin.cpp:706           add_handler          ] add local only api url: /v1/wallet/lock_all
info  2018-11-28T09:50:57.252 thread-0  http_plugin.cpp:706           add_handler          ] add local only api url: /v1/wallet/open
info  2018-11-28T09:50:57.252 thread-0  http_plugin.cpp:706           add_handler          ] add local only api url: /v1/wallet/remove_key
info  2018-11-28T09:50:57.252 thread-0  http_plugin.cpp:706           add_handler          ] add local only api url: /v1/wallet/set_timeout
info  2018-11-28T09:50:57.252 thread-0  http_plugin.cpp:706           add_handler          ] add local only api url: /v1/wallet/sign_digest
info  2018-11-28T09:50:57.252 thread-0  http_plugin.cpp:706           add_handler          ] add local only api url: /v1/wallet/sign_transaction
info  2018-11-28T09:50:57.252 thread-0  http_plugin.cpp:706           add_handler          ] add local only api url: /v1/wallet/unlock

Then the wallet program is setup.

Step 5: Use the CLI Program

Now you can use out CLI program evtc, simply run like

./docker_ops.py evtc --help
./docker_ops.py evtc wallet create

That's all! For the detail usage of this script, please refer to Docker reference.




Continue Reading: Non-Fungible Tokens And Domains