|
| 1 | +## WCN Node Operator onboarding |
| 2 | + |
| 3 | +### Get `wcn_node` binary |
| 4 | + |
| 5 | +Depending on your infrastructure either pull the docker image |
| 6 | +``` |
| 7 | +docker pull ghcr.io/walletconnectfoundation/wcn-node:1.451.2 |
| 8 | +``` |
| 9 | +or build the binary from source |
| 10 | +``` |
| 11 | +cargo build -p wcn_node --release |
| 12 | +``` |
| 13 | +After a successful build the binary will be located in `target/release` folder. |
| 14 | + |
| 15 | +### Generate cryptographic keypair |
| 16 | + |
| 17 | +``` |
| 18 | +cargo run -p wcn key generate |
| 19 | +``` |
| 20 | +It will show you the following (**DO NOT use these example values for your node**) |
| 21 | +``` |
| 22 | +Key 0 |
| 23 | +Private key: pKESPDecF6OB27qj5/JBKNeyBBdLyv8rkw+cgtjlc6E= |
| 24 | +Public key: eMTmrtqEJKIUDvVgRx6igMJrxMJfTx6VE6KFdhsqZKo= |
| 25 | +Peer ID: 12D3KooWHwoETeshEo4sNSLHv1Hoppq7au87kkDyzhQtgvSjacCR |
| 26 | +``` |
| 27 | + |
| 28 | +You will need `Private key` in the following configuration section. Store it in a secure place, and make sure you won't lose it. |
| 29 | +Your `Peer ID` needs to be provided to the WalletConnectFoundation and to be whitelisted in order for your node to be able to join the network. |
| 30 | +`Peer ID` is similar to `Public key` and is a public information which may be freely shared. |
| 31 | + |
| 32 | +### Configure the node |
| 33 | + |
| 34 | +Configuration is being done via environment variables. |
| 35 | +Here's the list of the required ones: |
| 36 | + |
| 37 | +```bash |
| 38 | +# Your private key, previously generated by `wcn key generate` |
| 39 | +export SECRET_KEY=$your_private_key |
| 40 | + |
| 41 | +# Your public IPv4 address, each time your IP changes this variable needs to be updated. |
| 42 | +export SERVER_ADDR=$your_public_ipv4_address |
| 43 | + |
| 44 | +# The name of your organization, ex. "MyOrg". |
| 45 | +export ORGANIZATION=$your_organization_name |
| 46 | + |
| 47 | +# Identifier of the geographic region in which your node is going to be deployed. |
| 48 | +# Available values: eu, us, ap. |
| 49 | +export REGION=$region |
| 50 | + |
| 51 | +# Directory in which the database data is going to be stored. |
| 52 | +# It MUST be persistent. |
| 53 | +export ROCKSDB_DIR=$rocksdb_dir |
| 54 | + |
| 55 | +# Directory in which the consensus data is going to be stored. |
| 56 | +# It MUST be persistent. |
| 57 | +export RAFT_DIR=$raft_dir |
| 58 | +``` |
| 59 | + |
| 60 | +The following section depends on the network: Mainnet / Testnet. |
| 61 | +**Make sure to select the correct network you're connecting to.** |
| 62 | + |
| 63 | +<details> |
| 64 | + <summary>Mainnet</summary> |
| 65 | + |
| 66 | + ```bash |
| 67 | + # Identifier of the network. |
| 68 | + export NETWORK_ID=mainnet |
| 69 | + |
| 70 | + # For the initial launch of your node (bootstrap) you also need to specify a list of peers to connect to. |
| 71 | + export PEER_12D3KooWFJpHSpFCoHqFJsHyc9JA7C9XPTVhyXsiTRucU6TikGWe=<Ask the team for the correct address> |
| 72 | + export PEER_12D3KooWDdSQWrrkcxs6JGcWYHygwQ4zyoK4SR6Y58f7dsmXsXyp=<Ask the team for the correct address> |
| 73 | + export PEER_12D3KooWNhADaVPZFcRLxvbfp8abbuPLFz9NGxkh75aHivPHnjyP=<Ask the team for the correct address> |
| 74 | + |
| 75 | + ``` |
| 76 | +</details> |
| 77 | +<details> |
| 78 | + <summary>Testnet</summary> |
| 79 | + |
| 80 | + ```bash |
| 81 | + # Identifier of the network. |
| 82 | + export NETWORK_ID=testnet |
| 83 | + |
| 84 | + # For the initial launch of your node (bootstrap) you also need to specify a list of peers to connect to. |
| 85 | + export PEER_12D3KooWDBZx6LibN1Lxvtb45yFNBfons96bn79AokA2amcJpcZd=<Ask the team for the correct address> |
| 86 | + export PEER_12D3KooWDfseE1zdkdPjhwHYfdSUSRZ5mGJoUTNUbiyehWrMDhDM=<Ask the team for the correct address> |
| 87 | + export PEER_12D3KooWJTtT7wUsqWtcGufQrYCcPm8s5vHib9cCVZWiVUKMJz5a=<Ask the team for the correct address> |
| 88 | + ``` |
| 89 | +</details> |
| 90 | + |
| 91 | +Optional configuration variables you may also be interested in: |
| 92 | +```bash |
| 93 | +# Port of the Raft API server. |
| 94 | +export RAFT_SERVER_PORT=3010 |
| 95 | + |
| 96 | +# Port of the Raft API server. |
| 97 | +export REPLICA_API_SERVER_PORT=3011 |
| 98 | + |
| 99 | +# Port of the Coordinator API server. |
| 100 | +export COORDINATOR_API_SERVER_PORT=3012 |
| 101 | + |
| 102 | +# Port of the Admin API server. |
| 103 | +export ADMIN_API_SERVER_PORT=3013 |
| 104 | + |
| 105 | +# Port of the Prometheus metrics server. |
| 106 | +export METRICS_SERVER_PORT=3014 |
| 107 | + |
| 108 | +# Port of the Migration API server. |
| 109 | +export MIGRATION_API_SERVER_PORT=3015 |
| 110 | +``` |
| 111 | + |
| 112 | +### Prepare your infrastructure |
| 113 | + |
| 114 | +#### Firewall |
| 115 | + |
| 116 | +`Raft API`, `Replica API` and `Migration API` server ports need to be open for all connections in your firewall settings. |
| 117 | +Default ports are `3010`, `3011` and `3015`, however you can change them as described in the previous section. |
| 118 | + |
| 119 | +#### Graceful shutdown |
| 120 | + |
| 121 | +WCN nodes require large graceful shutdown timeout to be configured, depending on the network condition the node may refuse to shutdown after `SIGINT`/`SIGTERM` for quite some time. |
| 122 | +Node orchestration is being managed internally by the network itself, if there's an ongoing data migration your node may be forbidden from shutting down. Also, there's a limit on how many nodes can be offline at the same time. |
| 123 | + |
| 124 | +This is required to achieve high availability. |
| 125 | + |
| 126 | +So, you need to make sure that your infrastructure won't `SIGKILL` the WCN node prematurely. |
| 127 | +WalletConnectFoundation nodes are configured to have `12h` graceful shutdown timeout. But we expect other operator nodes to have at least `1h` of graceful shutdown window. |
| 128 | + |
0 commit comments