Skip to content

REST API

The Cloud Service REST API provides simple HTTP endpoints for querying blockchain data without authentication for read-only operations.

Base URL

http://localhost:16180/rest/

Endpoints

Chain Info

GET /rest/chaininfo

Returns blockchain information.

bash
curl http://localhost:16180/rest/chaininfo

Response:

json
{
    "chain": "main",
    "blocks": 524288,
    "headers": 524288,
    "bestblockhash": "0000...",
    "difficulty": 12345678.90,
    "verificationprogress": 0.999999
}

Block Details

GET /rest/block/<hash>

Returns block details given block hash.

bash
curl http://localhost:16180/rest/block/0000000000000000000.json

Response:

json
{
    "hash": "0000...",
    "confirmations": 100,
    "height": 524288,
    "version": 536870912,
    "merkleroot": "abc...",
    "time": 1234567890,
    "nonce": 123456789,
    "bits": "1a0fffff",
    "difficulty": 12345678.90,
    "tx": ["txid1", "txid2", ...],
    "previousblockhash": "prev...",
    "nextblockhash": "next..."
}

Transaction Details

GET /rest/tx/<txid>

Returns transaction details.

bash
curl http://localhost:16180/rest/tx/txid.json

Response:

json
{
    "txid": "txid",
    "hash": "hash",
    "version": 2,
    "size": 250,
    "vsize": 250,
    "weight": 1000,
    "locktime": 0,
    "vin": [
        {
            "txid": "input_txid",
            "vout": 0,
            "scriptSig": {
                "asm": "...",
                "hex": "..."
            },
            "sequence": 4294967295
        }
    ],
    "vout": [
        {
            "value": 10.5,
            "n": 0,
            "scriptPubKey": {
                "asm": "...",
                "hex": "...",
                "address": "csc1q...",
                "type": "witness_v0_keyhash"
            }
        }
    ],
    "blockhash": "blockhash",
    "confirmations": 10,
    "time": 1234567890,
    "blocktime": 1234567890
}

Address Information

GET /rest/address/<address>

Returns address information and balance.

bash
curl http://localhost:16180/rest/address/csc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh

Response:

json
{
    "address": "csc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh",
    "balance": 1234.56,
    "totalReceived": 5000.00,
    "totalSent": 3765.44,
    "unconfirmedBalance": 0,
    "txApperances": 150,
    "unconfirmedTxApperances": 0,
    "transactions": ["txid1", "txid2", ...]
}

Mempool Information

GET /rest/mempool/info

Returns mempool statistics.

bash
curl http://localhost:16180/rest/mempool/info

Response:

json
{
    "size": 1500,
    "bytes": 2500000,
    "usage": 10000000,
    "maxmempool": 300000000,
    "mempoolminfee": 0.00001000,
    "minrelaytxfee": 0.00001000
}

GET /rest/mempool/contents

Returns all transactions in mempool.

bash
curl http://localhost:16180/rest/mempool/contents.json

UTXO Set Information

GET /rest/getutxos/<checkmempool>/<txid>-<n>/<txid>-<n>

Returns unspent transaction outputs.

bash
curl http://localhost:16180/rest/getutxos/checkmempool/txid-0.json

Block Header

GET /rest/headers/<count>/<hash>

Returns block headers.

bash
curl http://localhost:16180/rest/headers/5/0000000000000000000.json

Response Formats

All endpoints support multiple response formats:

FormatExtensionContent-Type
JSON.jsonapplication/json
Binary.binapplication/octet-stream
Hex.hextext/plain

Example: Binary Response

bash
curl http://localhost:16180/rest/block/0000000000000000000.bin

Rate Limiting

EndpointLimit
/rest/chaininfo200 req/min
/rest/block/*200 req/min
/rest/tx/*200 req/min
/rest/address/*100 req/min
/rest/mempool/*100 req/min

Error Responses

404 Not Found

json
{
    "error": "Block not found"
}

500 Internal Server Error

json
{
    "error": "Internal server error"
}

429 Too Many Requests

json
{
    "error": "Rate limit exceeded"
}

CORS Support

For browser-based applications, enable CORS in cs.conf:

ini
# Allow cross-origin requests
rpccorsdomain=https://yourdomain.com

Next Steps

Released under the MIT License.