RPC API Reference
BLVM node provides both a JSON-RPC 2.0 interface (Bitcoin Core compatible) and a modern REST API for interacting with the node.
API Overview
- JSON-RPC 2.0: Bitcoin Core-compatible interface
- Mainnet:
http://localhost:8332(default) - Testnet/Regtest:
http://localhost:18332(default)
- Mainnet:
- REST API: Modern RESTful interface at
http://localhost:8080/api/v1/
Both APIs provide access to the same functionality, with the REST API offering better type safety, clearer error messages, and improved developer experience.
Connection
Default RPC endpoints:
- Mainnet:
http://localhost:8332 - Testnet/Regtest:
http://localhost:18332
RPC ports are configurable. See Node Configuration for details.
Authentication
For production use, configure RPC authentication:
[rpc]
enabled = true
username = "rpcuser"
password = "rpcpassword"
Example Requests
Get Blockchain Info
# Mainnet uses port 8332, testnet/regtest use 18332
curl -X POST http://localhost:8332 \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "getblockchaininfo",
"params": [],
"id": 1
}'
Get Block
# Mainnet uses port 8332, testnet/regtest use 18332
curl -X POST http://localhost:8332 \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "getblock",
"params": ["000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"],
"id": 1
}'
Get Network Info
# Mainnet uses port 8332, testnet/regtest use 18332
curl -X POST http://localhost:8332 \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "getnetworkinfo",
"params": [],
"id": 1
}'
Available Methods
Methods Implemented: Multiple RPC methods
Blockchain Methods
getblockchaininfo- Get blockchain informationgetblock- Get block by hashgetblockhash- Get block hash by heightgetblockheader- Get block header by hashgetbestblockhash- Get best block hashgetblockcount- Get current block heightgetdifficulty- Get current difficultygettxoutsetinfo- Get UTXO set statisticsverifychain- Verify blockchain databasegetblockfilter- Get block filter (BIP158)getindexinfo- Get index informationgetblockchainstate- Get blockchain stateinvalidateblock- Invalidate a blockreconsiderblock- Reconsider a previously invalidated blockwaitfornewblock- Wait for a new blockwaitforblock- Wait for a specific blockwaitforblockheight- Wait for a specific block height
Raw Transaction Methods
getrawtransaction- Get transaction by txidsendrawtransaction- Submit transaction to mempooltestmempoolaccept- Test if transaction would be accepteddecoderawtransaction- Decode raw transaction hexcreaterawtransaction- Create a raw transactiongettxout- Get UTXO informationgettxoutproof- Get merkle proof for transactionverifytxoutproof- Verify merkle proof
Mempool Methods
getmempoolinfo- Get mempool statisticsgetrawmempool- List transactions in mempoolsavemempool- Persist mempool to diskgetmempoolancestors- Get mempool ancestors of a transactiongetmempooldescendants- Get mempool descendants of a transactiongetmempoolentry- Get mempool entry for a transaction
Network Methods
getnetworkinfo- Get network informationgetpeerinfo- Get connected peersgetconnectioncount- Get number of connectionsping- Ping connected peersaddnode- Add/remove node from peer listdisconnectnode- Disconnect specific nodegetnettotals- Get network statisticsclearbanned- Clear banned nodessetban- Ban/unban a subnetlistbanned- List banned nodesgetaddednodeinfo- Get information about manually added nodesgetnodeaddresses- Get known node addressessetnetworkactive- Enable or disable network activity
Mining Methods
getmininginfo- Get mining informationgetblocktemplate- Get block template for miningsubmitblock- Submit a mined blockestimatesmartfee- Estimate smart fee rateprioritisetransaction- Prioritize a transaction in mempool
Control Methods
stop- Stop the nodeuptime- Get node uptimegetmemoryinfo- Get memory usage informationgetrpcinfo- Get RPC server informationhelp- Get help for RPC methodslogging- Control logging levelsgethealth- Get node health statusgetmetrics- Get node metrics
Address Methods
validateaddress- Validate a Bitcoin addressgetaddressinfo- Get detailed address information
Transaction Methods
gettransactiondetails- Get detailed transaction information
Payment Methods (BIP70, feature-gated)
createpaymentrequest- Create a BIP70 payment request (requiresbip70-httpfeature)
Error Codes
The RPC API uses Bitcoin Core-compatible JSON-RPC 2.0 error codes:
Standard JSON-RPC Errors
| Code | Name | Description |
|---|---|---|
| -32700 | Parse error | Invalid JSON was received |
| -32600 | Invalid Request | The JSON sent is not a valid Request object |
| -32601 | Method not found | The method does not exist |
| -32602 | Invalid params | Invalid method parameter(s) |
| -32603 | Internal error | Internal JSON-RPC error |
Bitcoin-Specific Errors
| Code | Name | Description |
|---|---|---|
| -1 | Transaction already in chain | Transaction is already in blockchain |
| -1 | Transaction missing inputs | Transaction references non-existent inputs |
| -5 | Block not found | Block hash not found |
| -5 | Transaction not found | Transaction hash not found |
| -5 | UTXO not found | UTXO does not exist |
| -25 | Transaction rejected | Transaction rejected by consensus rules |
| -27 | Transaction already in mempool | Transaction already in mempool |
Code: errors.rs
Error Response Format
{
"jsonrpc": "2.0",
"error": {
"code": -32602,
"message": "Invalid params",
"data": {
"param": "blockhash",
"reason": "Invalid hex string"
}
},
"id": 1
}
Code: errors.rs
Authentication
RPC authentication is optional but recommended for production:
Token-Based Authentication
# Mainnet uses port 8332, testnet/regtest use 18332
curl -X POST http://localhost:8332 \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "getblockchaininfo", "params": [], "id": 1}'
Certificate-Based Authentication
TLS client certificates can be used for authentication when QUIC transport is enabled.
Code: auth.rs
Rate Limiting
Rate limiting is enforced per IP, per user, and per method:
- Authenticated users: 100 burst, 10 req/sec
- Unauthenticated: 50 burst, 5 req/sec
- Per-method limits: May override defaults for specific methods
Code: server.rs
Request/Response Format
Request Format
{
"jsonrpc": "2.0",
"method": "getblockchaininfo",
"params": [],
"id": 1
}
Response Format
Success Response:
{
"jsonrpc": "2.0",
"result": {
"chain": "regtest",
"blocks": 123456,
"headers": 123456,
"bestblockhash": "0000...",
"difficulty": 4.656542373906925e-10
},
"id": 1
}
Error Response:
{
"jsonrpc": "2.0",
"error": {
"code": -32602,
"message": "Invalid params"
},
"id": 1
}
Code: types.rs
Batch Requests
Multiple requests can be sent in a single batch:
[
{"jsonrpc": "2.0", "method": "getblockchaininfo", "params": [], "id": 1},
{"jsonrpc": "2.0", "method": "getblockhash", "params": [100], "id": 2},
{"jsonrpc": "2.0", "method": "getblock", "params": ["0000..."], "id": 3}
]
Responses are returned in the same order as requests.
Implementation Status
The RPC API implements Bitcoin Core-compatible JSON-RPC 2.0 methods. See the Available Methods section above for a complete list of implemented methods.
REST API
Overview
The REST API provides a modern, developer-friendly interface alongside the JSON-RPC API. It uses standard HTTP methods and status codes, with JSON request/response bodies.
Base URL: http://localhost:8080/api/v1/
Code: rest/mod.rs
Authentication
REST API authentication works the same as JSON-RPC:
# Token-based authentication
curl -H "Authorization: Bearer <token>" http://localhost:8080/api/v1/node/uptime
# Basic authentication (if configured)
curl -u username:password http://localhost:8080/api/v1/node/uptime
Rate Limiting
Rate limiting is enforced per IP, per user, and per endpoint:
- Authenticated users: 100 burst, 10 req/sec
- Unauthenticated: 50 burst, 5 req/sec
- Per-endpoint limits: Stricter limits for write operations
Code: rest/server.rs
Response Format
All REST API responses follow a consistent format:
Success Response:
{
"status": "success",
"data": {
"chain": "regtest",
"blocks": 123456
},
"request_id": "550e8400-e29b-41d4-a716-446655440000"
}
Error Response:
{
"status": "error",
"error": {
"code": "NOT_FOUND",
"message": "Block not found",
"details": "Block hash 0000... does not exist"
},
"request_id": "550e8400-e29b-41d4-a716-446655440000"
}
Code: rest/types.rs
Endpoints
Node Endpoints
Code: rest/node.rs
GET /api/v1/node/uptime- Get node uptimeGET /api/v1/node/memory- Get memory informationGET /api/v1/node/memory?mode=detailed- Get detailed memory infoGET /api/v1/node/rpc-info- Get RPC server informationGET /api/v1/node/help- Get help for all commandsGET /api/v1/node/help?command=getblock- Get help for specific commandGET /api/v1/node/logging- Get logging configurationPOST /api/v1/node/logging- Update logging configurationPOST /api/v1/node/stop- Stop the node
Example:
curl http://localhost:8080/api/v1/node/uptime
Chain Endpoints
GET /api/v1/chain/info- Get blockchain informationGET /api/v1/chain/blockhash/{height}- Get block hash by heightGET /api/v1/chain/blockcount- Get current block heightGET /api/v1/chain/difficulty- Get current difficultyGET /api/v1/chain/txoutsetinfo- Get UTXO set statisticsPOST /api/v1/chain/verify- Verify blockchain database
Example:
curl http://localhost:8080/api/v1/chain/info
Block Endpoints
Code: rest/blocks.rs
GET /api/v1/blocks/{hash}- Get block by hashGET /api/v1/blocks/{hash}/transactions- Get block transactionsGET /api/v1/blocks/{hash}/header- Get block headerGET /api/v1/blocks/{hash}/header?verbose=true- Get verbose block headerGET /api/v1/blocks/{hash}/stats- Get block statisticsGET /api/v1/blocks/{hash}/filter- Get BIP158 block filterGET /api/v1/blocks/{hash}/filter?filtertype=basic- Get specific filter typeGET /api/v1/blocks/height/{height}- Get block by heightPOST /api/v1/blocks/{hash}/invalidate- Invalidate blockPOST /api/v1/blocks/{hash}/reconsider- Reconsider invalidated block
Example:
curl http://localhost:8080/api/v1/blocks/000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f
Transaction Endpoints
GET /api/v1/transactions/{txid}- Get transaction by txidGET /api/v1/transactions/{txid}?verbose=true- Get verbose transactionPOST /api/v1/transactions- Submit raw transactionPOST /api/v1/transactions/test- Test if transaction would be acceptedGET /api/v1/transactions/{txid}/out/{n}- Get UTXO information
Example:
curl -X POST http://localhost:8080/api/v1/transactions \
-H "Content-Type: application/json" \
-d '{"hex": "0100000001..."}'
Address Endpoints
GET /api/v1/addresses/{address}/balance- Get address balanceGET /api/v1/addresses/{address}/transactions- Get address transaction historyGET /api/v1/addresses/{address}/utxos- Get address UTXOs
Example:
curl http://localhost:8080/api/v1/addresses/1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa/balance
Mempool Endpoints
GET /api/v1/mempool/info- Get mempool informationGET /api/v1/mempool/transactions- List transactions in mempoolGET /api/v1/mempool/transactions?verbose=true- List verbose transactionsPOST /api/v1/mempool/save- Persist mempool to disk
Example:
curl http://localhost:8080/api/v1/mempool/info
Network Endpoints
Code: rest/network.rs
GET /api/v1/network/info- Get network informationGET /api/v1/network/peers- Get connected peersGET /api/v1/network/connections/count- Get connection countGET /api/v1/network/totals- Get network statisticsGET /api/v1/network/nodes- Get added node informationGET /api/v1/network/nodes?dns=true- Get added nodes with DNS lookupGET /api/v1/network/nodes/addresses- Get node addressesGET /api/v1/network/nodes/addresses?count=10- Get N node addressesGET /api/v1/network/bans- List banned nodesPOST /api/v1/network/ping- Ping connected peersPOST /api/v1/network/nodes- Add node to peer listPOST /api/v1/network/active- Activate node connectionPOST /api/v1/network/bans- Ban/unban a subnetDELETE /api/v1/network/nodes/{address}- Remove node from peer listDELETE /api/v1/network/bans- Clear all banned nodes
Example:
curl http://localhost:8080/api/v1/network/info
Fee Estimation Endpoints
GET /api/v1/fees/estimate- Estimate fee rateGET /api/v1/fees/estimate?blocks=6- Estimate fee for N blocksGET /api/v1/fees/smart- Get smart fee estimate
Example:
curl http://localhost:8080/api/v1/fees/estimate?blocks=6
Payment Endpoints (BIP70 HTTP)
Requires: --features bip70-http
Code: rest/payment.rs
GET /api/v1/payments/{payment_id}- Get payment statusPOST /api/v1/payments- Create payment requestPOST /api/v1/payments/{payment_id}/pay- Submit paymentPOST /api/v1/payments/{payment_id}/cancel- Cancel payment
Vault Endpoints (CTV)
Requires: --features ctv
Code: rest/vault.rs
GET /api/v1/vaults- List vaultsGET /api/v1/vaults/{vault_id}- Get vault informationPOST /api/v1/vaults- Create vaultPOST /api/v1/vaults/{vault_id}/deposit- Deposit to vaultPOST /api/v1/vaults/{vault_id}/withdraw- Withdraw from vault
Pool Endpoints (CTV)
Requires: --features ctv
Code: rest/pool.rs
GET /api/v1/pools- List poolsGET /api/v1/pools/{pool_id}- Get pool informationPOST /api/v1/pools- Create poolPOST /api/v1/pools/{pool_id}/join- Join poolPOST /api/v1/pools/{pool_id}/leave- Leave pool
Congestion Control Endpoints (CTV)
Requires: --features ctv
Code: rest/congestion.rs
GET /api/v1/congestion/status- Get congestion statusGET /api/v1/batches- List pending batchesPOST /api/v1/batches- Create batchPOST /api/v1/batches/{batch_id}/submit- Submit batch
Security Headers
The REST API includes security headers by default:
X-Content-Type-Options: nosniffX-Frame-Options: DENYX-XSS-Protection: 1; mode=blockStrict-Transport-Security: max-age=31536000(when TLS enabled)
Code: rest/server.rs
Error Codes
REST API uses standard HTTP status codes:
| Status Code | Meaning |
|---|---|
| 200 | Success |
| 400 | Bad Request (invalid parameters) |
| 401 | Unauthorized (authentication required) |
| 404 | Not Found (resource doesn’t exist) |
| 429 | Too Many Requests (rate limit exceeded) |
| 500 | Internal Server Error |
| 503 | Service Unavailable (feature not enabled) |
See Also
- Node Overview - Node implementation details
- Node Configuration - RPC configuration options
- Node Operations - Node management
- Getting Started - Quick start guide
- API Index - Cross-reference to all APIs
- Troubleshooting - Common RPC issues
- Commons Mesh Module - Payment endpoints and mesh networking
- Module System - Module architecture and IPC