← Back to Skills

Chain Backups, Restore and Fork Rehearsals

The PolicyBlockchain chains (Settlement mainnet **1117710**, InsureBio mainnet **1140615**, and their testnets **11177102** and **11406152**) are Besu QBFT…

Commandprovision

About

The PolicyBlockchain chains (Settlement mainnet **1117710**, InsureBio mainnet **1140615**, and their testnets **11177102** and **11406152**) are Besu QBFT networks of 4 validators plus a writer. This page is the chain part of the platform backup/DR runbook (tawa-docs#166). The procedures live in the chain repos' RUNBOOKs; this page says what exists, the measured times, and the two rules.

Skill Content

This is the raw markdown that gets installed as a Claude Code command.

---
name: tawa-chain-backup-restore
description: "PolicyBlockchain/InsureBio chain backups, restore rehearsals, fork rehearsals before contract changes, and chain-watch monitoring. Use for any mainnet contract change or chain node restore."
---

# Chain Backups, Restore and Fork Rehearsals

The PolicyBlockchain chains (Settlement mainnet **1117710**, InsureBio mainnet **1140615**, and their testnets
**11177102** and **11406152**) are Besu QBFT networks of 4 validators plus a writer. This page is the chain part of
the platform backup/DR runbook (tawa-docs#166). The procedures live in the chain repos' RUNBOOKs; this page says
what exists, the measured times, and the two rules.

## The two rules

1. **No mainnet contract change without a fork rehearsal.** Before deploying, upgrading, re-granting or
   re-configuring any contract on 1117710 or 1140615, run
   `scripts/fork-rehearsal.sh all --ref <iec-contracts ref>` from `insureco/policyblockchain-node`
   (RUNBOOK section 14). It forks the live chain onto a local anvil on the builder host, runs iec-contracts
   `test/Fork*.t.sol`, sends real transactions inside anvil, proves the real chain was not written, and tears down.
   It uses no key. A new or changed contract needs its own `test/Fork*.t.sol` before the rehearsal counts.
2. **Rehearse restores on testnet only.** `scripts/restore-rehearsal.sh testnet single|full --yes` in each chain repo.
   Both refuse mainnet. Never restore a testnet archive onto mainnet (the genesis differs and Besu refuses it).

## What is backed up

| What | How | Where | When |
|---|---|---|---|
| Each node's data dir | `/opt/besu/bin/backup.sh`: stop Besu, `tar \| zstd`, start, upload (one node at a time; a validator stops only if every other validator proposed in the last 60 blocks) | platform MinIO `pbc-chain-backups/{policyblockchain,settlement-testnet,insurebio-mainnet,insurebio-testnet}/<node>/`, mirrored off-site nightly; 7 local copies | nightly, 30 min apart per node |
| Node keys | not in the data archive; generated on the node | daryx vault `<node>-key`; testnet keys also in the Locker `lk://insureco/daryx/<alias>` | at build |
| Contract role keys | never on a node | daryx vault (`septor-anchor-*`, `pbc-recordregistry-*`, `pbc-testnet-deployer`, `iec-contracts-testnet-*`) | at deploy |

An archive from any node works for any other node of the same network. Every validator also holds the whole chain,
so one healthy node is a backup of the others; the archives cover losing all of them.

## Measured restore times (testnets, 17 Oct 2026)

| | Settlement testnet (26 MB) | InsureBio testnet (681 MB) |
|---|---|---|
| Nightly backup of one validator | 8 s | 20 s |
| **One validator wiped, restored from MinIO, at the tip and proposing** | **56 s** | **63 s** |
| **Whole network stopped, restored from one snapshot, all validators proposing** | **~68 s** without blocks | **~93 s** without blocks |

With one validator down the chain kept producing blocks (QBFT tolerates 1 of 4). After the full restore every node
had the pre-stop head with the same hash. The tar, upload and extract steps scale with the data size; Besu start
(~40 s) and the QBFT round do not. A fork rehearsal of both mainnets takes ~32 s.

## RPO and RTO

| Scenario | RPO | RTO (measured basis) |
|---|---|---|
| One node lost | none (the other nodes have every block) | about 1 minute plus the download for its size |
| Whole network lost | back to the newest nightly archive | about 1.5 minutes plus download, plus re-sending transactions after the archive |
| A node key lost | n/a | a key rotation (RUNBOOK section 6), not a restore |

## Monitoring and alerts (chain-watch)

Backups are only half of safe operations: a stopped validator, a lost quorum or a missed anchor must reach a person within
2 minutes. One watcher (`ops/chain-watch/` in `insureco/policyblockchain-node`) covers Settlement `1117710` / `11177102` and
InsureBio `1140615` / `11406152`.

```
builder host: pm2 `chain-watch` on 10.124.0.3:9310     iec-pulse (unmanaged monitors, 15 s)     ALERT_EMAIL
  every 10 s scrape :9545 of every node + writer RPC  <-- GET /check/<net>/<check> -->  3 failures = DOWN, 2 ok = RECOVERED
```

It runs on the builder host because only the builder and explorer may scrape validator metrics. A dead watcher fails the probe, so
silence is never "all good". Each network has four monitors, `chain-<net>-<check>`, plus one global `chain-anchor`:

| Check | Fails when |
|---|---|
| `chain` | best height unchanged for 30 s (quorum lost) |
| `validators` | a validator is unreachable, over 5 blocks behind, or proposed nothing in the last 30 blocks |
| `peers` | a reachable node has fewer peers than the mesh (4; InsureBio mainnet 7) |
| `writer` | writer RPC down, wrong chain id, or over 5 blocks behind |
| `chain-anchor` | after 00:40 UTC, yesterday's Septor nightly batch is missing or not anchored on 1117710 or 1140615 |

`<net>` is `settlement`, `settlement-testnet`, `insurebio`, `insurebio-testnet`. Look now: `ssh tawa 'curl -s 10.124.0.3:9310/status'`.
After any node, IP or validator change regenerate `networks.json` with `gen-config.py`, copy it to the builder host, `pm2 restart chain-watch`.

**Drill, 22 Oct 2026 (InsureBio testnet, one validator stopped):** DOWN email (`validators`) at 57 s, `peers` at 60 s, chain stayed up at
3 of 4. Validator restarted at 82 s; RECOVERED at 129 s. Repeat after any watcher change. Never drill by stopping a mainnet validator.
Only the validator-down path was drilled live; stall, writer, peer-drop and anchor logic are covered by unit tests (`test_checks.py`).

## Where the procedures are

- `insureco/policyblockchain-node` RUNBOOK: section 4 backups, 5 restore, 13 Settlement testnet, 14 fork
  rehearsal, 15 restore rehearsal.
- `insureco/insurebio-chain-node` RUNBOOK: section 7 backups and restore, 8 testnet reset, 12 rehearsals.
- Monitoring: `policyblockchain-node` RUNBOOK section 16; `insurebio-chain-node` RUNBOOK section 11.
- Contract fork tests: `insureco/iec-contracts` `test/Fork.t.sol`, `test/ForkRegistries.t.sol`.

## Common mistakes

- Deploying a contract change straight to mainnet because the unit tests pass. The fork rehearsal is the gate.
- Running the restore rehearsal during a backup window: the script refuses; wait.
- Expecting a backup timer to run because it is `enabled`: it must also be started. Check
  `systemctl list-timers besu-backup.timer`.
- Restoring a node's key from a data archive: keys are not in it.
- Taking a validator down for maintenance without expecting the alert, or a second validator while one alert is open: one down is tolerated, two halt the chain.
- Adding a node or changing an IP and not regenerating the watcher config: the new node is not watched.

Install

Copy the skill content and save it to:

~/.claude/commands/tawa-chain-backup-restore.md
Download .md

Coming soon via CLI:

tawa chaac install tawa-chain-backup-restore

Details

Format
Command
Category
provision
Version
1.0.39475
Tokens
~1,694
Updated
2026-11-25
platformpolicyblockchaininsurebiobesumonitoringalertsbackupsrestoredisaster-recoveryforkcontracts