Scripts to automate the replace-operator workflow for Charon distributed validators.
These scripts help operators replace a single operator in an existing distributed validator cluster. This is useful for:
- Operator rotation: Replacing an operator who is leaving the cluster
- Infrastructure migration: Moving an operator to new infrastructure
- Recovery: Replacing an operator whose keys may have been compromised
Warning: This is an alpha feature in Charon and is not yet recommended for production use.
There are two scripts for the two roles involved:
remaining-operator.sh- For operators staying in the clusternew-operator.sh- For the new operator joining the cluster
Important: All participating operators (remaining + new) run the charon alpha edit replace-operator ceremony together. The new operator must receive the current cluster-lock.json BEFORE the ceremony begins.
.envfile withNETWORKandVCvariables set.charondirectory withcluster-lock.jsonandcharon-enr-private-key- Docker running
jqinstalled
Automates the complete workflow for operators staying in the cluster:
./scripts/edit/replace-operator/remaining-operator.sh \
--new-enr "enr:-..." \
--old-enr "enr:-..."Before running: Share your current cluster-lock.json with the new operator so it can participate in the ceremony.
| Option | Required | Description |
|---|---|---|
--new-enr <enr> |
Yes | ENR of the new operator |
--old-enr <enr> |
Yes | ENR of the operator being replaced |
--skip-export |
No | Skip ASDB export if already done |
--dry-run |
No | Preview without executing |
-h, --help |
No | Show help message |
| Environment Variable | Description |
|---|---|
WORK_DIR |
Override the repository root directory (defaults to auto-detected repo root) |
- Export ASDB - Stop VC if running and export anti-slashing database
- Run ceremony - Execute
charon alpha edit replace-operatorwith new ENR - Update ASDB - Replace pubkeys in exported ASDB to match new cluster-lock
- Stop containers - Stop charon and VC
- Backup and replace - Backup old cluster-lock, install new one
- Import ASDB - Import updated anti-slashing database
- Print start commands - Display commands to start containers manually (wait ~2 epochs before starting)
Two-step workflow for the new operator joining the cluster.
Step 1: Generate ENR and share with remaining operators:
./scripts/edit/replace-operator/new-operator.sh --generate-enrStep 2: After receiving cluster-lock.json from remaining operators, run the ceremony together with all other operators:
./scripts/edit/replace-operator/new-operator.sh \
--cluster-lock ./received-cluster-lock.json \
--old-enr "enr:-..."After the ceremony completes, the script automatically backs up the old .charon directory and installs the new configuration from the output directory.
| Option | Required | Description |
|---|---|---|
--cluster-lock <path> |
No | Path to cluster-lock.json (for ceremony) |
--old-enr <enr> |
No | ENR of the operator being replaced (for ceremony) |
--generate-enr |
No | Generate new ENR private key |
--dry-run |
No | Preview without executing |
-h, --help |
No | Show help message |
| Environment Variable | Description |
|---|---|
WORK_DIR |
Override the repository root directory (defaults to auto-detected repo root) |