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
| Method | Endpoint | Description |
|---|
POST | /api/anchor/submit | Submit state root for anchoring |
GET | /api/anchor/latest | Get latest confirmed anchor |
GET | /api/anchor/batches | List anchor batches |
GET | /api/anchor/batches/:id | Get batch by ID |
GET | /api/anchor/proof/:state_root | Get Merkle proof for state root |
POST | /api/anchor/verify | Verify proof structure |
GET | /api/anchor/tx-proof/:tx_id | Get transaction proof |
POST | /api/anchor/merkle/root | Compute Merkle root from leaves |
POST | /api/anchor/merkle/verify | Verify Merkle proof |
GET | /api/anchor/stats | Get anchor statistics |
GET | /api/anchor/chains/:name | Get 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
| Field | Type | Required | Description |
|---|
stateRoot | string | Yes | 0x-prefixed 64-char hex string |
namespace | string | No | Logical namespace for grouping |
metadata | object | No | Additional 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
| Status | Description |
|---|
pending | Awaiting blockchain confirmation |
confirmed | Confirmed on blockchain |
finalized | Finality reached (sufficient confirmations) |
failed | Anchor transaction failed |
Supported Chains
| Chain | Method | Confirmations |
|---|
| Ethereum | Smart Contract | 12 |
| Base | Smart Contract | 1 |
| Arbitrum | Smart Contract | 1 |
| Bitcoin | OP_RETURN | 6 |
| Solana | Program | 32 |
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
| Code | Description |
|---|
INVALID_STATE_ROOT | State root is not valid 32-byte hex |
ANCHOR_NOT_FOUND | Anchor does not exist |
PROOF_INVALID | Merkle proof verification failed |
CHAIN_UNAVAILABLE | Target chain is not available |
Use Cases
- Cross-chain state verification
- Canton Network state anchoring
- Audit trail immutability
- Document timestamping
- Bridge operation verification