Files
aitbc/docs/blockchain/10_api-blockchain.md
aitbc 19d415a235
Some checks failed
Blockchain Synchronization Verification / sync-verification (push) Failing after 3s
CLI Tests / test-cli (push) Failing after 3s
Cross-Chain Functionality Tests / test-cross-chain-sync (push) Successful in 2s
Cross-Chain Functionality Tests / test-cross-chain-transactions (push) Successful in 3s
Cross-Chain Functionality Tests / test-cross-chain-bridge (push) Has been skipped
Cross-Chain Functionality Tests / test-multi-chain-consensus (push) Successful in 2s
Cross-Chain Functionality Tests / aggregate-results (push) Has been skipped
Deploy to Testnet / deploy-testnet (push) Successful in 1m12s
Documentation Validation / validate-docs (push) Failing after 8s
Documentation Validation / validate-policies-strict (push) Successful in 3s
Integration Tests / test-service-integration (push) Successful in 2m6s
Multi-Chain Island Architecture Tests / test-multi-chain-island (push) Successful in 2s
Multi-Node Blockchain Health Monitoring / health-check (push) Failing after 4s
P2P Network Verification / p2p-verification (push) Successful in 4s
Package Tests / Python package - aitbc-agent-sdk (push) Successful in 32s
Package Tests / Python package - aitbc-core (push) Successful in 14s
Package Tests / Python package - aitbc-crypto (push) Successful in 12s
Package Tests / Python package - aitbc-sdk (push) Successful in 9s
Package Tests / JavaScript package - aitbc-sdk-js (push) Successful in 8s
Package Tests / JavaScript package - aitbc-token (push) Successful in 17s
Python Tests / test-python (push) Successful in 15s
Security Scanning / security-scan (push) Successful in 27s
Node Failover Simulation / failover-test (push) Successful in 7s
Multi-Node Stress Testing / stress-test (push) Successful in 6s
Cross-Node Transaction Testing / transaction-test (push) Successful in 4s
feat: add SQLCipher database encryption support and consolidate agent documentation
- Add SQLCipher encryption for ait-mainnet database with configurable flag
- Add db_encryption_enabled and db_encryption_key_path config settings
- Implement encryption key loading and PRAGMA key setup via connection events
- Add shutdown_db function for proper database cleanup
- Export middleware classes in aitbc/__init__.py
- Fix import path in sync.py for settings
- Remove duplicate agent documentation from docs
2026-05-03 12:00:38 +02:00

2.6 KiB

Blockchain API Reference

Complete API reference for blockchain node operations.

RPC Endpoints

Get Block

GET /rpc/block/{height}

Response:

{
  "block": {
    "header": {
      "height": 100,
      "timestamp": "2026-02-13T10:00:00Z",
      "proposer": "ait-devnet-proposer-1",
      "parent_hash": "0xabc123...",
      "state_root": "0xdef456...",
      "tx_root": "0xghi789..."
    },
    "transactions": [...],
    "receipts": [...]
  },
  "block_id": "0xjkl012..."
}

Get Transaction

GET /rpc/tx/{tx_hash}

Response:

{
  "tx": {
    "hash": "0xabc123...",
    "type": "transfer",
    "from": "0x1234...",
    "to": "0x5678...",
    "value": 100,
    "gas": 21000,
    "data": "0x..."
  },
  "height": 100,
  "index": 0
}

Submit Transaction

POST /rpc/broadcast_tx_commit

Request Body:

{
  "tx": "0xabc123...",
  "type": "transfer",
  "from": "0x1234...",
  "to": "0x5678...",
  "value": 100,
  "data": "0x..."
}

Response:

{
  "tx_response": {
    "code": 0,
    "data": "0x...",
    "log": "success",
    "hash": "0xabc123..."
  },
  "height": 100,
  "index": 0
}

Get Status

GET /rpc/status

Response:

{
  "node_info": {
    "protocol_version": "v0.1.0",
    "network": "ait-devnet",
    "node_id": "12D3KooW...",
    "listen_addr": "tcp://0.0.0.0:7070"
  },
  "sync_info": {
    "latest_block_height": 1000,
    "catching_up": false,
    "earliest_block_height": 1
  },
  "validator_info": {
    "voting_power": 1000,
    "proposer": true
  }
}

Get Mempool

GET /rpc/mempool

Response:

{
  "size": 50,
  "txs": [
    {
      "hash": "0xabc123...",
      "fee": 0.001,
      "size": 200
    }
  ]
}

WebSocket Endpoints

Subscribe to Blocks

WS /rpc/block

Message:

{
  "type": "new_block",
  "data": {
    "height": 1001,
    "hash": "0x...",
    "proposer": "ait-devnet-proposer-1"
  }
}

Subscribe to Transactions

WS /rpc/tx

Message:

{
  "type": "new_tx",
  "data": {
    "hash": "0xabc123...",
    "type": "transfer",
    "from": "0x1234...",
    "to": "0x5678...",
    "value": 100
  }
}

Error Codes

Code Description
0 Success
1 Internal error
2 Invalid transaction
3 Invalid request
4 Not found
5 Conflict

Rate Limits

  • 1000 requests/minute for RPC
  • 100 requests/minute for writes
  • 10 connections per IP

Next