|
| 1 | +--- |
| 2 | +description: 'Author: Godwin' |
| 3 | +--- |
| 4 | + |
| 5 | +# 🐳 Docker |
| 6 | + |
| 7 | +## System Requirements |
| 8 | + |
| 9 | +<table><thead><tr><th align="center">CPU</th><th align="center">OS</th><th width="254" align="center">RAM</th><th align="center">DISK</th></tr></thead><tbody><tr><td align="center">4-Core CPU</td><td align="center">Debian 12/Ubuntu 22.04</td><td align="center">=> 8 GB RAM</td><td align="center"><p>500 GB+</p><p> (SSD or NVMe)</p></td></tr></tbody></table> |
| 10 | + |
| 11 | +{% hint style="info" %} |
| 12 | +_Starknet Juno full node has a size of 397GB on April 19th, 2025_ |
| 13 | +{% endhint %} |
| 14 | + |
| 15 | +{% hint style="success" %} |
| 16 | +Juno is a Go implementation of a Starknet full-node client created by Nethermind to allow node operators to easily and reliably support the network and advance its decentralisation goals. Juno supports various node setups, from casual to production-grade indexers. |
| 17 | +{% endhint %} |
| 18 | + |
| 19 | +{% hint style="warning" %} |
| 20 | +## Before you start, make sure that you have your own synced Ethereum mainnet L1 RPC URL ready with WS port enabled |
| 21 | +{% endhint %} |
| 22 | + |
| 23 | +### Pre-Requisites <a href="#pre-requisties" id="pre-requisties"></a> |
| 24 | + |
| 25 | +```bash |
| 26 | +sudo apt update -y && sudo apt upgrade -y && sudo apt autoremove -y |
| 27 | + |
| 28 | +sudo apt install -y wget curl screen git ufw |
| 29 | +``` |
| 30 | + |
| 31 | +### Setting up Firewall <a href="#setting-up-firewall" id="setting-up-firewall"></a> |
| 32 | + |
| 33 | +```bash |
| 34 | +sudo ufw default deny incoming |
| 35 | +sudo ufw default allow outgoing |
| 36 | + |
| 37 | +sudo ufw allow 22/tcp |
| 38 | +sudo ufw allow 80 |
| 39 | +sudo ufw allow 443 |
| 40 | +``` |
| 41 | + |
| 42 | +### Enable Firewall |
| 43 | + |
| 44 | +```bash |
| 45 | +sudo ufw enable |
| 46 | +``` |
| 47 | + |
| 48 | +## Install Docker |
| 49 | + |
| 50 | +#### Run this command to remove any conflicting docker |
| 51 | + |
| 52 | +```bash |
| 53 | +for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done |
| 54 | +``` |
| 55 | + |
| 56 | +#### Add Docker's official GPG key: |
| 57 | + |
| 58 | +```bash |
| 59 | +sudo apt-get update |
| 60 | +sudo apt-get install ca-certificates curl |
| 61 | +sudo install -m 0755 -d /etc/apt/keyrings |
| 62 | +sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc |
| 63 | +sudo chmod a+r /etc/apt/keyrings/docker.asc |
| 64 | +``` |
| 65 | + |
| 66 | +#### Add the repository to ppt sources: |
| 67 | + |
| 68 | +```bash |
| 69 | +echo \ |
| 70 | + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ |
| 71 | + $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ |
| 72 | + sudo tee /etc/apt/sources.list.d/docker.list > /dev/null |
| 73 | + |
| 74 | +sudo apt-get update |
| 75 | +``` |
| 76 | + |
| 77 | +#### Install docker |
| 78 | + |
| 79 | +```bash |
| 80 | +sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin |
| 81 | + |
| 82 | +# Test docker is working |
| 83 | +sudo docker run hello-world |
| 84 | + |
| 85 | +#Install docker compose |
| 86 | + |
| 87 | +sudo apt-get update |
| 88 | +sudo apt-get install docker-compose-plugin |
| 89 | + |
| 90 | +# Test the docker version |
| 91 | +docker compose version |
| 92 | +``` |
| 93 | + |
| 94 | +**Create Starknet directory** |
| 95 | + |
| 96 | +```bash |
| 97 | +mkdir starkent && cd starknet |
| 98 | +``` |
| 99 | + |
| 100 | +{% hint style="danger" %} |
| 101 | +**Juno** only recognizes an endpoint through WebSocket protocol, so make sure to specify it using the `wss://` scheme (e.g., `wss://your-endpoint`) |
| 102 | +{% endhint %} |
| 103 | + |
| 104 | +### Launch Starknet full node |
| 105 | + |
| 106 | +```bash |
| 107 | +sudo nano docker-compose.yml |
| 108 | +``` |
| 109 | + |
| 110 | +Paste the following into the `docker-compose.yml:`  |
| 111 | + |
| 112 | +```bash |
| 113 | +version: '3.9' |
| 114 | + |
| 115 | +networks: |
| 116 | + monitor-net: |
| 117 | + driver: bridge |
| 118 | + |
| 119 | +volumes: |
| 120 | + juno_data: {} |
| 121 | + |
| 122 | +services: |
| 123 | + juno: |
| 124 | + image: nethermind/juno:v0.14.2 |
| 125 | + user: root |
| 126 | + container_name: juno |
| 127 | + volumes: |
| 128 | + - "/var/lib/juno-data:/data" |
| 129 | + restart: unless-stopped |
| 130 | + command: |
| 131 | + - --db-path=/data |
| 132 | + - --network=mainnet |
| 133 | + - --http |
| 134 | + - --http-port=6060 |
| 135 | + - --http-host=0.0.0.0 |
| 136 | + - --metrics |
| 137 | + - --metrics-host=0.0.0.0 |
| 138 | + - --metrics-port=9090 |
| 139 | + - --rpc-cors-enable |
| 140 | + - --ws |
| 141 | + - --ws-port=6061 |
| 142 | + - --ws-host=0.0.0.0 |
| 143 | + - --log-level=trace |
| 144 | + - --eth-node=wss://<l1-endpoint> |
| 145 | + expose: |
| 146 | + - 6060 |
| 147 | + - 5050 |
| 148 | + - 9090 |
| 149 | + - 8545 |
| 150 | + - 6061 |
| 151 | + ports: |
| 152 | + - "5050:5050" # P2P Port |
| 153 | + - "6060:6060" # HTTP RPC Port |
| 154 | + - "9090:9090" # Metrics Port |
| 155 | + - "8545:8545" # JSON-RPC (Ethereum compatible) |
| 156 | + - "6061:6061" # WebSocket |
| 157 | + networks: |
| 158 | + - monitor-net |
| 159 | +``` |
| 160 | + |
| 161 | +```bash |
| 162 | +sudo docker compose up -d |
| 163 | +``` |
| 164 | + |
| 165 | +### Monitor Logs |
| 166 | + |
| 167 | +Use `docker logs` to monitor your starknet node. The `-f` flag ensures you are following the log output |
| 168 | + |
| 169 | +```bash |
| 170 | +docker logs juno -f --tail 100 |
| 171 | +``` |
| 172 | + |
| 173 | +Once your Juno Starknet node starts syncing, the logs are expected to look like this: |
| 174 | + |
| 175 | +```log |
| 176 | +09:28:47.686 02/04/2025 +00:00 INFO migration/migration.go:110 Applying database migration {"stage": "17/18"} |
| 177 | +10:17:08.292 02/04/2025 +00:00 INFO migration/migration.go:110 Applying database migration {"stage": "18/18"} |
| 178 | +10:17:08.293 02/04/2025 +00:00 INFO l1/l1.go:112 Subscribing to L1 updates... |
| 179 | +10:17:08.294 02/04/2025 +00:00 INFO l1/l1.go:121 Subscribed to L1 updates |
| 180 | +10:17:08.494 02/04/2025 +00:00 DEBUG upgrader/upgrader.go:81 Application is up-to-date. |
| 181 | +
|
| 182 | +.... |
| 183 | +
|
| 184 | +16:42:03.829 19/04/2025 +00:00 TRACE jsonrpc/server.go:451 Received request {"req": {"jsonrpc":"2.0","method":"starknet_blockNumber","id":3268045}} |
| 185 | +16:42:03.829 19/04/2025 +00:00 TRACE jsonrpc/server.go:451 Received request {"req": {"jsonrpc":"2.0","method":"starknet_getBlockWithReceipts","params":[{"block_number":1330197}],"id":3268046}} |
| 186 | +16:42:03.965 19/04/2025 +00:00 TRACE jsonrpc/server.go:451 Received request {"req": {"jsonrpc":"2.0","method":"starknet_getStateUpdate","params":[{"block_number":1330197}],"id":3268047}} |
| 187 | +16:42:04.022 19/04/2025 +00:00 TRACE jsonrpc/server.go:451 Received request {"req": {"jsonrpc":"2.0","method":"starknet_blockNumber","id":3268048}} |
| 188 | +``` |
| 189 | + |
| 190 | +#### 1. Block Number |
| 191 | + |
| 192 | +This confirms which Starknet network the node is connected to: |
| 193 | + |
| 194 | +```bash |
| 195 | +curl --location 'http://localhost:6060' --header 'Content-Type: application/json' --data '{ "jsonrpc": "2.0", "method": "starknet_blockNumber", "params": [],"id": 1}' |
| 196 | +``` |
| 197 | + |
| 198 | +**Expected Response:** |
| 199 | + |
| 200 | +```json |
| 201 | +{"jsonrpc":"2.0","result":1330203,"id":1} |
| 202 | +``` |
| 203 | + |
| 204 | +2. Sync Status |
| 205 | + |
| 206 | +This ensures that your node is syncing correctly and producing up-to-date data. |
| 207 | + |
| 208 | +```bash |
| 209 | +curl --location 'http://localhost:6060' --header 'Content-Type: application/json' --data '{ "jsonrpc": "2.0", "method": "starknet_syncing", "params": [],"id": 1}' |
| 210 | +``` |
| 211 | + |
| 212 | +**Expected Response:** |
| 213 | + |
| 214 | +**You get the below result if the node has caught up to the latest block.** |
| 215 | + |
| 216 | +```json |
| 217 | +{"jsonrpc":"2.0","result":false,"id":1} |
| 218 | +``` |
| 219 | + |
| 220 | +{% hint style="success" %} |
| 221 | +**Juno starkent node** takes **approximately 5 days** to fully catch up to the latest chain head when syncing from Genesis |
| 222 | +{% endhint %} |
| 223 | + |
| 224 | +### References <a href="#references" id="references"></a> |
| 225 | + |
| 226 | +{% embed url="https://juno.nethermind.io/hardware-requirements/" %} |
0 commit comments