Docs
Beaconator

How to Update a Beacon

This guide shows you how to update beacon data with new index values using The Beaconator API.

Update a Single Beacon

Update a beacon with new data using a zero-knowledge proof:

curl -X POST http://localhost:8000/update_beacon \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "beacon_address": "0x1234567890123456789012345678901234567890",
    "proof": "0xaabbccdd...",
    "public_signals": "0x11223344..."
  }'

Request Parameters:

  • beacon_address: Address of the beacon to update
  • proof: Zero-knowledge proof data as hex string (with 0x prefix)
  • public_signals: Public signals from the proof as hex string (with 0x prefix), contains the new data value

Response:

{
  "success": true,
  "data": "Transaction hash: 0xabcdef...",
  "message": "Beacon updated successfully"
}

Update Beacon with ECDSA Signature

For beacons that use ECDSA signature verification instead of ZK proofs:

curl -X POST http://localhost:8000/update_beacon_with_ecdsa_adapter \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "beacon_address": "0x1234567890123456789012345678901234567890",
    "measurement": "75"
  }'

Request Parameters:

  • beacon_address: Address of the beacon contract
  • measurement: The measurement value to update the beacon with (uint256 as decimal string). The accepted range depends on the beacon's on-chain verifier contract — for example, beacons tracking scores or percentages typically accept values in the range 0–100.

The Beaconator passes the measurement value directly to the beacon contract. If the beacon's verifier enforces a specific range (e.g., 0–100 for score-based indices), values outside that range will be rejected on-chain.

The Beaconator wallet signs the measurement and submits it to a beacon that uses an ECDSAVerifierAdapter for verification.

Batch Update Multiple Beacons

Update multiple beacons in a single request using Multicall3:

curl -X POST http://localhost:8000/batch_update_beacon \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "updates": [
      {
        "beacon_address": "0x111...",
        "proof": "0xaabb...",
        "public_signals": "0x1122..."
      },
      {
        "beacon_address": "0x222...",
        "proof": "0xccdd...",
        "public_signals": "0x3344..."
      }
    ]
  }'

Request Parameters:

  • updates: Array of update objects, each with beacon_address, proof, and public_signals

Response:

{
  "success": true,
  "data": {
    "results": [
      {
        "beacon_address": "0x111...",
        "success": true,
        "transaction_hash": "0x...",
        "error": null
      },
      {
        "beacon_address": "0x222...",
        "success": true,
        "transaction_hash": "0x...",
        "error": null
      }
    ],
    "total_requested": 2,
    "successful_updates": 2,
    "failed_updates": 0
  },
  "message": "Batch update completed"
}

Batch updates use Multicall3 for gas efficiency. Individual beacon failures do not revert the entire batch — each result reports its own success status.

Error Handling

All error responses use the standard API response format:

{
  "success": false,
  "data": null,
  "message": "Error description here"
}

Common Errors

Invalid Proof: Regenerate the proof with correct inputs.

Beacon Not Found: Verify the beacon address is correct and deployed on the right network.

Next Steps