Files
explorer-monorepo/docs/RPC_FUNCTIONALITY_AND_BLOCKSCOUT_TRACE.md

82 lines
4.1 KiB
Markdown
Raw Permalink Normal View History

# RPC Functionality and Blockscout Trace
## Summary
- **Routing**: VMID 5000 (Blockscout) → public RPC 192.168.11.221:8545 (VMID 2201) is correct; same LAN (192.168.11.0/24), no routing issues.
- **Basic RPC**: `eth_blockNumber`, `eth_chainId`, and standard ETH/NET/WEB3 methods work on the public RPC.
- **Internal transactions / block rewards**: Blockscout requires the **TRACE** API. The public RPC node was configured with `rpc-http-api=["ETH","NET","WEB3"]` only, so `trace_block` and `trace_replayBlockTransactions` returned **"Method not enabled" (-32604)**. **Fix applied:** TRACE was added to `/etc/besu/config-rpc-public.toml` on VMID 2201 and Besu restarted; `trace_block` now returns a result.
## Checks performed
| Check | Result |
|-------|--------|
| `eth_blockNumber` from host to 192.168.11.221:8545 | OK |
| `eth_blockNumber` from VMID 5000 to 192.168.11.221:8545 | OK (routing fine) |
| `eth_chainId` on public RPC | OK (0x8a = 138) |
| `trace_block` on public RPC | Method not enabled (TRACE not in rpc-http-api) |
| `debug_traceBlockByNumber` on public RPC | Method not enabled |
## Routing
- **Blockscout (VMID 5000)**: IP 192.168.11.140, host r630-02 (192.168.11.12).
- **Public RPC (VMID 2201)**: IP 192.168.11.221, host r630-02 (192.168.11.12). Same host as VMID 5000.
- Traffic is host-to-host on 192.168.11.0/24; no firewall or NAT between them in normal setup.
## Fix: Enable TRACE on the public RPC node (VMID 2201)
Blockscout uses [trace_block and trace_replayBlockTransactions](https://docs.blockscout.com/setup/requirements/node-tracing-json-rpc-requirements) for internal transactions and block rewards. Besu exposes these when the **TRACE** API is enabled.
### 1. Config templates (already updated in repo)
- **smom-dbis-138-proxmox/templates/besu-configs/config-rpc.toml**: `rpc-http-api` and `rpc-ws-api` now include `"TRACE"`.
- **smom-dbis-138/config/config-rpc-public.toml**: `rpc-http-api` now includes `"TRACE"`.
Use these for new or redeployed nodes.
### 2. Live node (VMID 2201)
On the **Proxmox host that runs VMID 2201** (r630-02 / 192.168.11.12):
1. **Locate Besu config** inside the container. The `besu-rpc.service` on VMID 2201 uses **`/etc/besu/config-rpc-public.toml`** (see `ExecStart` in the unit). Other nodes may use `config-rpc.toml` or `config.toml`.
2. **Add TRACE** to the RPC APIs. In the config file, change:
- `rpc-http-api=["ETH","NET","WEB3"]``rpc-http-api=["ETH","NET","WEB3","TRACE"]`
- If present: `rpc-ws-api=["ETH","NET","WEB3"]``rpc-ws-api=["ETH","NET","WEB3","TRACE"]`
3. **Restart Besu** in the container:
```bash
pct exec 2201 -- systemctl restart besu-rpc
# or whatever the Besu service name is, e.g. besu
```
4. **Verify** (from any host that can reach 192.168.11.221):
```bash
curl -sS -X POST -H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","method":"trace_block","params":["0x1"],"id":1}' \
http://192.168.11.221:8545
```
You should get a JSON result (or an empty array for block 1), not `"Method not enabled"`.
### 3. Script (recommended)
From repo root (VMID 2201 is on r630-02; script uses `RPC_VM_2201_HOST=root@192.168.11.12` by default):
```bash
bash scripts/besu/enable-trace-api-vmid2201.sh
```
The script finds the Besu config in the container, adds TRACE to `rpc-http-api` and `rpc-ws-api`, restarts Besu, and verifies `trace_block`. Or follow the manual steps in §2 and verify with the curl in §2 step 4.
## After enabling TRACE
- Blockscout will stop logging "Method not enabled" for internal transaction and block-reward fetchers (after it retries).
- Internal transactions and block rewards will index over time.
- No change to Blockscout env: it already points at `ETHEREUM_JSONRPC_HTTP_URL=http://192.168.11.221:8545`.
## References
- [Blockscout: Node tracing / JSON RPC requirements](https://docs.blockscout.com/setup/requirements/node-tracing-json-rpc-requirements)
- [Besu TRACE API](https://besu.hyperledger.org/public-networks/reference/api)
- `config/ip-addresses.conf`: `RPC_PUBLIC_1`, `RPC_URL_138_PUBLIC`
- `docs/04-configuration/RPC_ENDPOINTS_MASTER.md`