|
| 1 | +## Running a Observer Node |
| 2 | + |
| 3 | +This document describes in details how to run a observer node, and add it to the existing network. |
| 4 | + |
| 5 | +The existing network can be either a custom one, or one of the persistent networks (such as a Test Net). |
| 6 | +Configuration of all persistent networks can be found in [Persistent Chains](../deployment/persistent_chains) |
| 7 | +where each subfolder represents a `<chain-id>`. |
| 8 | + |
| 9 | +If a new network needs to be initialized, please follow the [Running Genesis Node](running-genesis-node.md) |
| 10 | +instructions first. After this more validator nodes can be added by following the instructions from this doc. |
| 11 | + |
| 12 | + |
| 13 | +### Hardware requirements |
| 14 | + |
| 15 | +Minimal: |
| 16 | +- 1GB RAM |
| 17 | +- 25GB of disk space |
| 18 | +- 1.4 GHz CPU |
| 19 | + |
| 20 | +Recommended (for highload applications): |
| 21 | +- 2GB RAM |
| 22 | +- 100GB SSD |
| 23 | +- x64 2.0 GHz 2v CPU |
| 24 | + |
| 25 | +### Operating System |
| 26 | + |
| 27 | +Current delivery is compiled and tested under `Ubuntu 18.04.3 LTS and MacOS` so we recommend using this distribution for now. In future, it will be possible to compile the application for a wide range of operating systems thanks to Go language. |
| 28 | + |
| 29 | +## Components |
| 30 | + |
| 31 | +The latest release can be found at [DCL Releases](https://github.com/zigbee-alliance/distributed-compliance-ledger/releases). |
| 32 | + |
| 33 | +The following components will be needed: |
| 34 | + |
| 35 | +* Binary artifacts (part of the release): |
| 36 | + * dcld: The binary used for running a node. |
| 37 | + * dclcli: The binary that allow users to interact with the network of nodes. |
| 38 | +* The service configuration file `dcld.service` |
| 39 | +(either part of the release or [deployment](https://github.com/zigbee-alliance/distributed-compliance-ledger/deployment) folder). |
| 40 | +* Genesis transactions file: `genesis.json` |
| 41 | +* The list of alive peers: `persistent_peers.txt`. It has the following format: `<node id>@<node ip>,<node2 id>@<node2 ip>,...`. |
| 42 | + |
| 43 | +If you want to join an existing persistent network (such as Test Net), then look at the [Persistent Chains](../deployment/persistent_chains) |
| 44 | +folder for a list of available networks. Each subfolder there represents a `<chain-id>` |
| 45 | +and contains the genesis and persistent_peers files. |
| 46 | + |
| 47 | +### Deployment steps |
| 48 | + |
| 49 | +1. Put `dcld` and `dclcli` binaries to `/usr/bin/` and configure permissions. |
| 50 | + |
| 51 | + |
| 52 | +2. Configure dclcli: |
| 53 | + * `dclcli config chain-id testnet` |
| 54 | + * `dclcli config output json` - Output format (text/json). |
| 55 | + * `dclcli config indent true` - Add indent to JSON response. |
| 56 | + * `dclcli config trust-node false` - Verify proofs for node responses. |
| 57 | + |
| 58 | + |
| 59 | +3. Initialize the observer node and create the necessary config files: |
| 60 | + * Init Node: `dcld init <node name> --chain-id testnet`. |
| 61 | + * Put `genesis.json` into dcld's config directory (usually `$HOME/.dcld/config/`). |
| 62 | + * Use `deployment/persistent_chains/testnet/genesis.json` if you want to connect to the persistent Test Net |
| 63 | + * Open `$HOME/.dcld/config/config.toml` file in your favorite text editor: |
| 64 | + * Tell node how to connect to the network: |
| 65 | + * Set the value for the `persistent_peers` field as the content of `persistent_peers.txt` file. |
| 66 | + * Use `deployment/persistent_chains/testnet/persistent_peers.txt` if you want to connect to the persistent Test Net. |
| 67 | + * Make your node public (this step is only needed for Ubuntu): |
| 68 | + * Open `$HOME/.dcld/config/config.toml` |
| 69 | + * Find the line under `# TCP or UNIX socket address for the RPC server to listen on` |
| 70 | + * Change it to: `laddr = "tcp://0.0.0.0:26657"` |
| 71 | + * Optionally change other setting. |
| 72 | + * Open `26656` (p2p) and `26657` (RPC) ports (Only needed for Ubuntu). |
| 73 | + * `sudo ufw allow 26656/tcp` |
| 74 | + * `sudo ufw allow 26657/tcp` |
| 75 | + * Edit `dcld.service` (Only needed for Ubuntu). |
| 76 | + * Replace `ubuntu` with a user name you want to start service on behalf |
| 77 | + * Copy service configuration. (Only needed for Ubuntu). |
| 78 | + * `cp dcld.service /etc/systemd/system/` |
| 79 | + |
| 80 | + |
| 81 | +4. Start the local observer node |
| 82 | + * Init Node: `dcld start`. |
| 83 | + You should see it trying to get all the blocks from the testnet. (p.s. It can take upto 12+ hrs for all the transactions to be downloaded depending on network speed) |
| 84 | + |
| 85 | + |
| 86 | +5. Check the observer node is running and getting all the transcations: |
| 87 | + |
| 88 | + * Get the node status: `dclcli status --node localhost:26657`. |
| 89 | + |
| 90 | + Make sure that `result.sync_info.latest_block_height` is increasing over the time (once in about 5 sec). When you see the `catching_up` as `true` that signifies that the node is still downloading all the transactions. Once it has fully synced this will value will turn to `false` |
| 91 | + Expected output format: |
| 92 | + ```json |
| 93 | + { |
| 94 | + "node_info": { |
| 95 | + "protocol_version": { |
| 96 | + "p2p": "7", |
| 97 | + "block": "10", |
| 98 | + "app": "0" |
| 99 | + }, |
| 100 | + "id": "15f99a46e3e5b109c02a86586484aa14e28d25b0", |
| 101 | + "listen_addr": "tcp://0.0.0.0:26656", |
| 102 | + "network": "testnet", |
| 103 | + "version": "0.32.8", |
| 104 | + "channels": "4020212223303800", |
| 105 | + "moniker": "myon", |
| 106 | + "other": { |
| 107 | + "tx_index": "on", |
| 108 | + "rpc_address": "tcp://127.0.0.1:26657" |
| 109 | + } |
| 110 | + }, |
| 111 | + "sync_info": { |
| 112 | + "latest_block_hash": "D24C7DE69BB4E38068B5B94F30AA5EAFC4BE8EDE3064BE34FE34DBD8634DB8B5", |
| 113 | + "latest_app_hash": "F6FB39F80629F87E189F64E79B0574D87CEDFAEF80FD34AF4D3250604B471F90", |
| 114 | + "latest_block_height": "6390", |
| 115 | + "latest_block_time": "2020-10-19T19:42:12.923219099Z", |
| 116 | + "catching_up": true |
| 117 | + }, |
| 118 | + "validator_info": { |
| 119 | + "address": "74EDDFE44B1AFD520C8799FFE0E1C2FCC165F9EE", |
| 120 | + "pub_key": { |
| 121 | + "type": "tendermint/PubKeyEd25519", |
| 122 | + "value": "8Sp4VGVjQTaMvz5CTre/kVf2wEOUHg9L4AW6sPevlss=" |
| 123 | + }, |
| 124 | + "voting_power": "0" |
| 125 | + } |
| 126 | + } |
| 127 | + ``` |
| 128 | + |
| 129 | +6. Congrats! You are an now running a observer node. |
0 commit comments