|
| 1 | +# Ink Node |
| 2 | + |
| 3 | +> Forked and customized from https://github.com/smartcontracts/simple-optimism-node |
| 4 | +
|
| 5 | +A simple docker compose script for launching full / archive node for the Ink chain. |
| 6 | + |
| 7 | +## Recommended Hardware |
| 8 | + |
| 9 | +### Mainnet |
| 10 | + |
| 11 | +- 16GB+ RAM |
| 12 | +- 2 TB SSD (NVME Recommended) |
| 13 | +- 100mb/s+ Download |
| 14 | + |
| 15 | +### Testnet |
| 16 | + |
| 17 | +- 16GB+ RAM |
| 18 | +- 500 GB SSD (NVME Recommended) |
| 19 | +- 100mb/s+ Download |
| 20 | + |
| 21 | +## Installation and Configuration |
| 22 | + |
| 23 | +### Install docker and docker compose |
| 24 | + |
| 25 | +> Note: If you're not logged in as root, you'll need to log out and log in again after installation to complete the docker installation. |
| 26 | +
|
| 27 | +Note: This command install docker and docker compose for Ubuntu. For windows and mac desktop or laptop, please use Docker Desktop. For other OS, please find instruction in Google. |
| 28 | + |
| 29 | +```sh |
| 30 | +# Update and upgrade packages |
| 31 | +sudo apt-get update |
| 32 | +sudo apt-get upgrade -y |
| 33 | + |
| 34 | +### Docker and docker compose prerequisites |
| 35 | +sudo apt-get install -y curl |
| 36 | +sudo apt-get install -y gnupg |
| 37 | +sudo apt-get install -y ca-certificates |
| 38 | +sudo apt-get install -y lsb-release |
| 39 | + |
| 40 | +### Download the docker gpg file to Ubuntu |
| 41 | +sudo mkdir -p /etc/apt/keyrings |
| 42 | +curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg |
| 43 | + |
| 44 | +### Add Docker and docker compose support to the Ubuntu's packages list |
| 45 | +echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null |
| 46 | + |
| 47 | +sudo apt-get update |
| 48 | + |
| 49 | +### Install docker and docker compose on Ubuntu |
| 50 | +sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin |
| 51 | + |
| 52 | +sudo usermod -aG docker $(whoami) |
| 53 | + |
| 54 | +### Verify the Docker and docker compose install on Ubuntu |
| 55 | +sudo docker run hello-world |
| 56 | +``` |
| 57 | + |
| 58 | +(For non-root user) After logged out and logged back in, test if docker is working by running. |
| 59 | + |
| 60 | +```sh |
| 61 | +docker ps |
| 62 | +``` |
| 63 | + |
| 64 | +It should returns an empty container list without having any error. Otherwise, restart your machine if there are errors. |
| 65 | + |
| 66 | +### Clone the Repository |
| 67 | + |
| 68 | +```sh |
| 69 | +git clone https://github.com/inkonchain/node |
| 70 | +cd node |
| 71 | +``` |
| 72 | + |
| 73 | +### Copy .env.example to .env |
| 74 | + |
| 75 | +Make a copy of `.env.example` named `.env`. |
| 76 | + |
| 77 | +```sh |
| 78 | +cp .env.example .env |
| 79 | +``` |
| 80 | + |
| 81 | +Open `.env` with your editor of choice |
| 82 | + |
| 83 | +### Mandatory configurations |
| 84 | + |
| 85 | +- **NETWORK_NAME** - Choose which Optimism network layer you want to operate on: |
| 86 | + - `ink-sepolia` - Ink Sepolia (Testnet) |
| 87 | + - `ink-mainnet` - Ink (Mainnet) |
| 88 | +- **NODE_TYPE** - Choose the type of node you want to run: |
| 89 | + - `full` (Full node) - A Full node contains a few recent blocks without historical states. |
| 90 | + - `archive` (Archive node) - An Archive node stores the complete history of the blockchain, including historical states. |
| 91 | +- **OP_NODE\_\_RPC_ENDPOINT** - Specify the endpoint for the RPC of Layer 1 (e.g., Ethereum mainnet). For instance, you can use the free plan of Quicknode for the Ethereum mainnet. |
| 92 | +- **OP_NODE\_\_L1_BEACON** - Specify the beacon endpoint of Layer 1. You can use [QuickNode for the beacon endpoint](https://www.quicknode.com). For example: https://xxx-xxx-xxx.quiknode.pro/db55a3908ba7e4e5756319ffd71ec270b09a7dce |
| 93 | +- **OP_NODE\_\_RPC_TYPE** - Specify the service provider for the RPC endpoint you've chosen in the previous step. The available options are: |
| 94 | + - `alchemy` - Alchemy |
| 95 | + - `quicknode` - Quicknode (ETH only) |
| 96 | + - `erigon` - Erigon |
| 97 | + - `basic` - Other providers |
| 98 | + |
| 99 | +### Optional configurations |
| 100 | + |
| 101 | +- **OP_GETH\_\_SYNCMODE** - Specify sync mode for the execution client |
| 102 | + - Unspecified - Use default snap sync for full node and full sync for archive node |
| 103 | + - `snap` - Snap Sync (Default) |
| 104 | + - `full` - Full Sync (For archive node, not recommended for full node) |
| 105 | +- **IMAGE_TAG\_\_[...]** - Use custom docker image for specified components. |
| 106 | +- **PORT\_\_[...]** - Use custom port for specified components. |
| 107 | + |
| 108 | +## Operating the Node |
| 109 | + |
| 110 | +### Start |
| 111 | + |
| 112 | +```sh |
| 113 | +docker compose up -d --build |
| 114 | +``` |
| 115 | + |
| 116 | +Will start the node in a detatched shell (`-d`), meaning the node will continue to run in the background. We recommended to add `--build` to make sure that latest changes are being applied. |
| 117 | + |
| 118 | +### View logs |
| 119 | + |
| 120 | +```sh |
| 121 | +docker compose logs -f --tail 10 |
| 122 | +``` |
| 123 | + |
| 124 | +To view logs of all containers. |
| 125 | + |
| 126 | +```sh |
| 127 | +docker compose logs <CONTAINER_NAME> -f --tail 10 |
| 128 | +``` |
| 129 | + |
| 130 | +To view logs for a specific container. Most commonly used `<CONTAINER_NAME>` are: |
| 131 | + |
| 132 | +- op-geth |
| 133 | +- op-node |
| 134 | +- bedrock-init |
| 135 | + |
| 136 | +### Stop |
| 137 | + |
| 138 | +```sh |
| 139 | +docker compose down |
| 140 | +``` |
| 141 | + |
| 142 | +Will shut down the node without wiping any volumes. |
| 143 | +You can safely run this command and then restart the node again. |
| 144 | + |
| 145 | +### Restart |
| 146 | + |
| 147 | +```sh |
| 148 | +docker compose restart |
| 149 | +``` |
| 150 | + |
| 151 | +Will restart the node safely with minimal downtime but without upgrading the node. |
| 152 | + |
| 153 | +### Upgrade |
| 154 | + |
| 155 | +Pull the latest updates from GitHub, and Docker Hub and rebuild the container. |
| 156 | + |
| 157 | +```sh |
| 158 | +git pull |
| 159 | +docker compose pull |
| 160 | +docker compose up -d --build |
| 161 | +``` |
| 162 | + |
| 163 | +Will upgrade your node with minimal downtime. |
| 164 | + |
| 165 | +### Wipe [DANGER] |
| 166 | + |
| 167 | +```sh |
| 168 | +docker compose down -v |
| 169 | +``` |
| 170 | + |
| 171 | +Will shut down the node and WIPE ALL DATA. Proceed with caution! |
| 172 | + |
| 173 | +## Monitoring |
| 174 | + |
| 175 | +### Estimate remaining sync time |
| 176 | + |
| 177 | +Run progress.sh to estimate remaining sync time and speed. |
| 178 | + |
| 179 | +```sh |
| 180 | +./progress.sh |
| 181 | +``` |
| 182 | + |
| 183 | +This will show the sync speed in blocks per minute and the time until sync is completed. |
| 184 | + |
| 185 | +``` |
| 186 | +Chain ID: 57073 |
| 187 | +Please wait |
| 188 | +Blocks per minute: ... |
| 189 | +Hours until sync completed: ... |
| 190 | +``` |
| 191 | + |
| 192 | +### Grafana dashboard |
| 193 | + |
| 194 | +Grafana is exposed at [http://localhost:3000](http://localhost:3000) and comes with one pre-loaded dashboard ("Simple Node Dashboard"). |
| 195 | +Simple Node Dashboard includes basic node information and will tell you if your node ever falls out of sync with the reference L2 node or if a state root fault is detected. |
| 196 | + |
| 197 | +Use the following login details to access the dashboard: |
| 198 | + |
| 199 | +- Username: `admin` |
| 200 | +- Password: `ink` |
| 201 | + |
| 202 | +Navigate over to `Dashboards > Manage > Simple Node Dashboard` to see the dashboard, see the following gif if you need help: |
| 203 | + |
| 204 | + |
| 205 | + |
| 206 | +## Troubleshooting |
| 207 | + |
| 208 | +### Walking back L1Block with curr=0x0000...:0 next=0x0000...:0 |
| 209 | + |
| 210 | +If you experience "walking back L1Block with curr=0x0000...:0 next=0x0000...:0" for a long time after the Ecotone upgrade, consider these fixes: |
| 211 | + |
| 212 | +1. Wait for a few minutes. This issue usually resolves itself after some time. |
| 213 | +2. Restart docker compose: `docker compose down` and `docker compose up -d --build` |
| 214 | +3. If it's still not working, try setting `OP_GETH__SYNCMODE=full` in .env and restart docker compose |
0 commit comments