π Chain Implementation Guides
Developer guide for managing blockchain networks, organization wallets, on-chain transactions and chain adapters. This document only references operations and schemas from
openapi/chain.yaml.
π Quick Navigation
Getting Started
Register chains, wallets, and track transactions
Blockchain Integrations
Production-ready guides for Ethereum, Solana, L2s & more
Core Operations
Chain registration, wallet management, transaction tracking
Advanced Topics
Chain adapters, health monitoring, and optimization
π― API Overview & Architecture
Business Purpose
- Maintain a system-wide registry of supported blockchain networks (L1/L2) and their metadata.
- Manage organization-scoped wallets (custodial, MPC, hardware) and their lifecycle.
- Record and reconcile on-chain transactions with rich metadata for auditing and reconciliation.
- Configure and operate chain adapters (RPC endpoints, signer policies, priorities and fallbacks).
- Provide health and observability for adapters and the chain service.
Technical Architecture (ASCII)
Client/Backoffice ---> Chain Service API ---> Adapters / RPC Providers / Indexers
| | |
| |-- Chains (registry) |
| |-- Wallets (org-scoped)|
| |-- OnChainTx registry |
| |-- ChainAdapters |
Core Data Models (from spec)
- Chain (required: id, chainId, name, shortName, networkType, layer, nativeCurrency, status)
- Wallet (required: id, orgId, address, type, chainId, status)
- OnChainTx (required: id, orgId, chainId, hash, status)
- ChainAdapter (required: id, chainId, name, rpcEndpoint, signerPolicy, status)
Refer to openapi/chain.yaml for full schema property lists and exact types.
βοΈ Blockchain Integrations
Production-Ready Integration Guides β Comprehensive implementation guides for major blockchain networks with real-world examples, security best practices, and production checklists.
Layer 1 Blockchains
Ethereum
EVM flagship β’ Smart contracts β’ MEV protection
L1BNB Chain
3s blocks β’ Low fees β’ BEP-20 tokens
L1Avalanche
Sub-second finality β’ C-Chain β’ Subnets
L1Solana
Non-EVM β’ 400ms slots β’ SPL tokens
Non-EVMLayer 2 Networks
Polygon
PoS sidechain β’ Checkpoints β’ Bridge finality
L2Arbitrum One
Optimistic rollup β’ 7-day challenge β’ 250ms blocks
L2Optimism
OP Stack β’ Fault proofs β’ Standard bridge
L2Base
Coinbase L2 β’ OP Stack β’ Ultra-low gas
L2Whatβs Included in Each Guide
Each blockchain integration guide provides:
- ποΈ Chain Registration β Register blockchain networks with proper configuration
- π RPC Adapter Setup β Configure and manage chain adapters with health monitoring
- πΌ Wallet Management β Create and manage wallets for the specific chain
- π Transaction Tracking β Monitor on-chain transactions with proper confirmation handling
- π Security Best Practices β Chain-specific security considerations and MEV protection
- β‘ Performance Optimization β Gas strategies, batching, and throughput optimization
- β Production Checklist β Comprehensive deployment and monitoring checklist
Quick Integration Comparison
| Feature | Ethereum | BNB | Solana | Polygon | Arbitrum | Optimism | Base | Avalanche |
|---|---|---|---|---|---|---|---|---|
| Block Time | 12s | 3s | 400ms | 2s | 250ms | 2s | 2s | <1s |
| Finality | 15m | 15s | 13s | 30m | 7d | 7d | 7d | <2s |
| Gas Token | ETH | BNB | SOL | MATIC | ETH | ETH | ETH | AVAX |
| EVM Compatible | β | β | β | β | β | β | β | β |
| Bridge Required | - | - | - | β | β | β | β | - |
π View All Integrations β Complete integration guides index with architecture diagrams and comparison matrices.
π― Quick Start
Prerequisites
- Base URL:
https://api.quub.exchange/v2(production) orhttps://api.sandbox.quub.exchange/v2(sandbox) - Authentication: OAuth2 bearer token (scopes such as
read:chainandwrite:chain) or API key per common security schemes - Organization-scoped endpoints require
orgId(path param) and matching header where specified incommon/components.yaml
Minimal Node.js example β list active chains
import fetch from "node-fetch";
const BASE = "https://api.sandbox.quub.exchange/v2";
async function listChains(token) {
const res = await fetch(`${BASE}/chains?status=ACTIVE&limit=25`, {
headers: { Authorization: `Bearer ${token}` },
});
return res.json();
}
// usage: await listChains(process.env.ACCESS_TOKEN)
Minimal Python example β register a wallet for an org
import requests
BASE = 'https://api.sandbox.quub.exchange/v2'
def create_wallet(org_id, token, payload):
url = f"{BASE}/orgs/{org_id}/wallets"
headers = { 'Authorization': f'Bearer {token}', 'Content-Type': 'application/json' }
r = requests.post(url, json=payload, headers=headers)
return r.json()
# payload must conform to CreateWalletInput in the spec
ποΈ Core API Operations
Chains
List Blockchain Networks
GET /chains
- Description: Retrieve a list of supported blockchain networks.
- Query Parameters:
networkType(optional): Filter by network type (MAINNET,TESTNET,DEVNET).layer(optional): Filter by chain layer (L1,L2).status(optional): Filter by status (ACTIVE,DEPRECATED,DISABLED).
- Responses:
200 OK: List of blockchain networks.400 Bad Request,401 Unauthorized,403 Forbidden,500 Internal Server Error.
Register a New Blockchain Network
POST /chains
- Description: Register a new blockchain network.
- Request Body:
idempotencyKey(header): Unique key to ensure idempotency.- JSON payload matching
CreateChainInputschema.
- Responses:
201 Created: Chain created successfully.400 Bad Request,401 Unauthorized,403 Forbidden,409 Conflict,500 Internal Server Error.
Blockchain Network Details
Get Blockchain Network Details
GET /chains/{chainId}
- Description: Retrieve details of a specific blockchain network.
- Path Parameters:
chainId(required): Unique identifier of the blockchain network.
- Responses:
200 OK: Blockchain network details.400 Bad Request,401 Unauthorized,403 Forbidden,500 Internal Server Error.
Wallets
-
GET /orgs/{orgId}/wallets β List organization wallets
- Path:
orgId. Optional query:chainId, pagination. - Response: paginated
data: Wallet[].
- Path:
-
POST /orgs/{orgId}/wallets β Register wallet for organization
- Headers:
idempotencyKey. - Body:
CreateWalletInput. Returns 201 withdata: Wallet.
- Headers:
-
GET /orgs/{orgId}/wallets/{walletId} β Get wallet details
-
PATCH /orgs/{orgId}/wallets/{walletId} β Update wallet metadata
- Headers: optional
idempotencyKey. Body:UpdateWalletInput. Returns{ data: Wallet }.
- Headers: optional
Example (Node.js) β list org wallets:
async function listOrgWallets(orgId, token) {
const res = await fetch(`${BASE}/orgs/${orgId}/wallets`, {
headers: { Authorization: `Bearer ${token}` },
});
return res.json();
}
On-chain Transactions
-
GET /orgs/{orgId}/onchain/txs β List on-chain transactions
-
Filters: chainId,status(PENDINGCONFIRMED FAILED), refType,refId, pagination. - Response: paginated
data: OnChainTx[].
-
-
POST /orgs/{orgId}/onchain/txs β Register new on-chain transaction
- Headers:
idempotencyKey. - Body:
CreateOnChainTxInput(required:chainId,hash). Returns 201 withdata: OnChainTx.
- Headers:
Example (Python) β create an OnChainTx (payload must follow spec):
payload = { 'chainId': 1, 'hash': '0x...', 'fromAddress': '0x...', 'toAddress': '0x...', 'direction': 'OUTBOUND' }
resp = requests.post(f"{BASE}/orgs/{org_id}/onchain/txs", json=payload, headers=headers)
Chain Adapters
-
GET /chain/adapters β List chain adapters
- Pagination supported. Response:
data: ChainAdapter[].
- Pagination supported. Response:
-
POST /chain/adapters β Register chain adapter
- Headers:
idempotencyKey. - Body:
CreateChainAdapterInput. Returns 201 withdata: ChainAdapter.
- Headers:
-
GET /chain/adapters/{adapterId} β Get chain adapter details
-
PATCH /chain/adapters/{adapterId} β Update adapter configuration
-
Body:
UpdateChainAdapterInput. Returns{ data: ChainAdapter }. - GET /chain/health β Overall chain service health summary
- Returns overall health data with adapter counts and chain summaries.
-
π Authentication Setup
Security schemes are defined in openapi/chain.yaml and reference common/components.yaml:
- OAuth2 (client credentials) β use
Authorization: Bearer <token>with scopes likeread:chain,write:chain. - API Key β per
common/componentsif configured. - bearerAuth β token-based examples.
Ensure requests include required org-scoped headers/params (orgId) when calling organization endpoints.
β¨ Best Practices
- Validate payloads against the exact request schemas in
openapi/chain.yaml(e.g.,CreateWalletInput,CreateOnChainTxInput). - Use
idempotencyKeyon POST endpoints to prevent duplicates. - Send numeric amounts and gas values as strings when the schema requires stringified integers to avoid precision loss.
- Use pagination (
cursor,limit) for list endpoints and filter server-side when possible. - Respect enum values and patterns (uuid, 0x-prefixed hex) defined in schemas.
π Troubleshooting
- 400 / 422: Invalid payload β check required fields and value formats (hex patterns, uuid, enums).
- 401 / 403: Authorization error β verify token scopes and API key permissions.
- 404: Resource not found β confirm
chainId,walletId, oradapterIdand correctorgId. - 409: Conflict (create endpoints) β respect idempotency keys and check for existing resources.
οΏ½ Monitoring & Observability
- Monitor adapter health (
/chain/adapters/{adapterId}/health) and the overall/chain/healthsummary. - Track OnChainTx statuses and confirmation counts to detect stalled transactions.
- Emit traces (traceId) on write operations to correlate events with indexers and adapters.
οΏ½ Additional Resources
- OpenAPI spec:
/openapi/chain.yaml - Common components:
/openapi/common/
This guide was rewritten to match openapi/chain.yaml exactly. All endpoints, parameters, and request/response shapes are derived from the spec; nothing was invented.
- 409: Creation conflict (e.g., duplicate
ChainorChainAdapter); useidempotencyKey. - 429: Back off and retry per response headers.
π Monitoring & Observability
- Poll
GET /chain/adapters/{adapterId}/healthfor adapter health and surfacestatus,latencyMs,syncLag. - Use
GET /chain/healthto summarize service state for dashboards. - Log request
traceIdfrom responses where provided (meta.traceId) for cross-system tracing.
π Additional Resources
- API Documentation:
../api-documentation/ - Service Overview:
../overview/ - OpenAPI Specification:
/openapi/chain.yaml