Anchor Service API

State root anchoring to multiple blockchains with Merkle proof generation and verification. Supports EVM chains, Bitcoin OP_RETURN, and Solana for immutable timestamping and cross-chain verification.

Endpoints

MethodEndpointDescription
POST/api/anchor/submitSubmit state root for anchoring
GET/api/anchor/latestGet latest confirmed anchor
GET/api/anchor/batchesList anchor batches
GET/api/anchor/batches/:idGet batch by ID
GET/api/anchor/proof/:state_rootGet Merkle proof for state root
POST/api/anchor/verifyVerify proof structure
GET/api/anchor/tx-proof/:tx_idGet transaction proof
POST/api/anchor/merkle/rootCompute Merkle root from leaves
POST/api/anchor/merkle/verifyVerify Merkle proof
GET/api/anchor/statsGet anchor statistics
GET/api/anchor/chains/:nameGet chain information

Submit State Root

POST /api/anchor/submit
X-Tenant-Id: your-tenant-id
Content-Type: application/json

{
  "stateRoot": "0xa1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2",
  "namespace": "wallet-state",
  "metadata": {
    "blockHeight": 12345678,
    "transactionCount": 150
  }
}

Request Parameters

FieldTypeRequiredDescription
stateRootstringYes0x-prefixed 64-char hex string
namespacestringNoLogical namespace for grouping
metadataobjectNoAdditional metadata

Response

{
  "data": {
    "anchorId": "anchor_abc123",
    "stateRoot": "0xa1b2c3d4...",
    "txHash": "0x...",
    "blockNumber": 12345678,
    "timestamp": "2024-01-15T10:30:00Z",
    "status": "pending"
  }
}

Get Latest Anchor

GET /api/anchor/latest?namespace=wallet-state
X-Tenant-Id: your-tenant-id

Response

{
  "data": {
    "anchorId": "anchor_abc123",
    "stateRoot": "0xa1b2c3d4...",
    "txHash": "0x...",
    "blockNumber": 12345678,
    "timestamp": "2024-01-15T10:30:00Z",
    "status": "finalized",
    "confirmations": 64
  }
}

Get Merkle Proof

GET /api/anchor/proof/0xa1b2c3d4e5f6...
X-Tenant-Id: your-tenant-id

Response

{
  "data": {
    "stateRoot": "0xa1b2c3d4...",
    "proof": [
      "0x...",
      "0x...",
      "0x..."
    ],
    "leafIndex": 42,
    "batchMerkleRoot": "0x...",
    "verified": true
  }
}

Verify Proof

POST /api/anchor/verify
X-Tenant-Id: your-tenant-id
Content-Type: application/json

{
  "stateRoot": "0xa1b2c3d4...",
  "leaf": "0xe5f6g7h8...",
  "proof": ["0x...", "0x..."],
  "index": 42
}

Response

{
  "data": {
    "valid": true,
    "stateRoot": "0xa1b2c3d4...",
    "leafHash": "0xe5f6g7h8...",
    "computedRoot": "0xa1b2c3d4..."
  }
}

Compute Merkle Root

POST /api/anchor/merkle/root
X-Tenant-Id: your-tenant-id
Content-Type: application/json

{
  "leaves": [
    "0x...",
    "0x...",
    "0x..."
  ]
}

Response

{
  "data": {
    "root": "0xa1b2c3d4...",
    "leafCount": 3
  }
}

Anchor Status

StatusDescription
pendingAwaiting blockchain confirmation
confirmedConfirmed on blockchain
finalizedFinality reached (sufficient confirmations)
failedAnchor transaction failed

Supported Chains

ChainMethodConfirmations
EthereumSmart Contract12
BaseSmart Contract1
ArbitrumSmart Contract1
BitcoinOP_RETURN6
SolanaProgram32

Bitcoin OP_RETURN Format

For Bitcoin anchoring, state roots are embedded in OP_RETURN transactions:

// OP_RETURN data format (47 bytes)
TENZRO<version:1><block_height:8><state_root:32>

// Example (hex)
54454e5a524f01 00000000000bc614e a1b2c3d4...

Get Anchor Statistics

GET /api/anchor/stats
X-Tenant-Id: your-tenant-id

Response

{
  "data": {
    "totalAnchors": 1250,
    "pendingAnchors": 3,
    "confirmedAnchors": 1247,
    "lastAnchorAt": "2024-01-15T10:30:00Z",
    "chainStats": {
      "ethereum": { "count": 500, "avgConfirmTime": "180s" },
      "base": { "count": 600, "avgConfirmTime": "5s" },
      "bitcoin": { "count": 150, "avgConfirmTime": "3600s" }
    }
  }
}

Error Codes

CodeDescription
INVALID_STATE_ROOTState root is not valid 32-byte hex
ANCHOR_NOT_FOUNDAnchor does not exist
PROOF_INVALIDMerkle proof verification failed
CHAIN_UNAVAILABLETarget chain is not available

Use Cases

  • Cross-chain state verification
  • Canton Network state anchoring
  • Audit trail immutability
  • Document timestamping
  • Bridge operation verification