Blockchain RPCs

getbestblockhash

Returns the hash of the best (tip) block in the most-work fully-validated chain.

Method: POST

https://bch.nownodes.io

Example body (raw)

{"jsonrpc": "1.0", "id": "curltest", "method": "getbestblockhash", "params": []}

Example response: 200

{
    "result": "0000000000000000021a5a4dd26cd5b2c5c4c1a0de19814961fb5bc4a63ab4c0",
    "error": null,
    "id": "curltest"
}

getblock

If verbosity is 0, returns a string that is serialized, hex-encoded data for block โ€˜hashโ€™.

If verbosity is 1, returns an Object with information about block โ€˜hashโ€™.

If verbosity is 2, returns an Object with information about block โ€˜hashโ€™ and information about each transaction.

Method: POST

https://bch.nownodes.io

Example body (raw)

{
    "jsonrpc": "1.0",
    "id": "curltest",
    "method": "getblock",
    "params": [
        "00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09"
    ]
}

Example response: 200

{
    "result": {
        "hash": "00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09",
        "confirmations": 839787,
        "size": 216,
        "height": 1000,
        "version": 1,
        "versionHex": "00000001",
        "merkleroot": "fe28050b93faea61fa88c4c630f0e1f0a1c24d0082dd0e10d369e13212128f33",
        "tx": [
            "fe28050b93faea61fa88c4c630f0e1f0a1c24d0082dd0e10d369e13212128f33"
        ],
        "time": 1232346882,
        "mediantime": 1232344831,
        "nonce": 2595206198,
        "bits": "1d00ffff",
        "difficulty": 1,
        "chainwork": "000000000000000000000000000000000000000000000000000003e903e903e9",
        "nTx": 1,
        "previousblockhash": "0000000008e647742775a230787d66fdf92c46a48c896bfbc85cdc8acc67e87d",
        "nextblockhash": "00000000a2887344f8db859e372e7e4bc26b23b9de340f725afbf2edb265b4c6"
    },
    "error": null,
    "id": "curltest"
}

getblockchaininfo

Returns an object containing various state info regarding blockchain processing.

Method: POST

https://bch.nownodes.io

Example body (raw)

{
    "jsonrpc": "1.0",
    "id": "curltest",
    "method": "getblockchaininfo",
    "params": []
}

Example response: 200

{
    "result": {
        "chain": "main",
        "blocks": 840786,
        "headers": 840786,
        "bestblockhash": "0000000000000000021a5a4dd26cd5b2c5c4c1a0de19814961fb5bc4a63ab4c0",
        "difficulty": 354334960322.4879,
        "mediantime": 1712817583,
        "verificationprogress": 0.9999963986508152,
        "initialblockdownload": false,
        "chainwork": "000000000000000000000000000000000000000001fcbafff61fe0a4f23218e3",
        "size_on_disk": 228167812879,
        "pruned": false,
        "warnings": ""
    },
    "error": null,
    "id": "curltest"
}

getblockcount

Returns the height of the most-work fully-validated chain.

The genesis block has height 0.

Method: POST

https://bch.nownodes.io

Example body (raw)

{
    "jsonrpc": "1.0",
    "id": "curltest",
    "method": "getblockcount",
    "params": []
}

Example response: 200

{
    "result": 840786,
    "error": null,
    "id": "curltest"
}

getblockhash

Returns hash of block in best-block-chain at height provided.

Method: POST

https://bch.nownodes.io

Example body (raw)

{
    "jsonrpc": "1.0",
    "id": "curltest",
    "method": "getblockhash",
    "params": [
        1000
    ]
}

Example response: 200

{
    "result": "00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09",
    "error": null,
    "id": "curltest"
}

getblockheader

If verbose is false, returns a string that is serialized, hex-encoded data for blockheader โ€˜hashโ€™.

If verbose is true, returns an Object with information about blockheader โ€˜hashโ€™.

Method: POST

https://bch.nownodes.io

Example body (raw)

{
    "jsonrpc": "1.0",
    "id": "curltest",
    "method": "getblockheader",
    "params": [
        "00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09"
    ]
}

Example response: 200

{
    "result": {
        "hash": "00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09",
        "confirmations": 839787,
        "height": 1000,
        "version": 1,
        "versionHex": "00000001",
        "merkleroot": "fe28050b93faea61fa88c4c630f0e1f0a1c24d0082dd0e10d369e13212128f33",
        "time": 1232346882,
        "mediantime": 1232344831,
        "nonce": 2595206198,
        "bits": "1d00ffff",
        "difficulty": 1,
        "chainwork": "000000000000000000000000000000000000000000000000000003e903e903e9",
        "nTx": 1,
        "previousblockhash": "0000000008e647742775a230787d66fdf92c46a48c896bfbc85cdc8acc67e87d",
        "nextblockhash": "00000000a2887344f8db859e372e7e4bc26b23b9de340f725afbf2edb265b4c6"
    },
    "error": null,
    "id": "curltest"
}

getblockstats

Compute per block statistics for a given window. All amounts are in satoshis.

It wonโ€™t work for some heights with pruning.

Method: POST

https://bch.nownodes.io

Example body (raw)

{
    "jsonrpc": "1.0",
    "id": "curltest",
    "method": "getblockstats",
    "params": [
        1000,
        [
            "minfeerate",
            "avgfeerate"
        ]
    ]
}

Example response: 200

{
    "result": {
        "avgfeerate": 0.00000000,
        "minfeerate": 0.00000000
    },
    "error": null,
    "id": "curltest"
}

getchaintips

Return information about all known tips in the block tree, including the main chain as well as orphaned branches.

Method: POST

https://bch.nownodes.io

Example body (raw)

{
    "jsonrpc": "1.0",
    "id": "curltest",
    "method": "getchaintips",
    "params": []
}

Example response: 200

{
    "result": [
        {
            "height": 840786,
            "hash": "0000000000000000021a5a4dd26cd5b2c5c4c1a0de19814961fb5bc4a63ab4c0",
            "branchlen": 0,
            "status": "active"
        },
        {
            "height": 839006,
            "hash": "000000000000000000d863752cedc2b3a697f8600b9a59424231fb18e199db29",
            "branchlen": 1,
            "status": "valid-fork"
        },
        {
            "height": 834892,
            "hash": "000000000000000001dd0521568e0cfff89d0c2aaaa48ff30c63fcfcd856656f",
            "branchlen": 1,
            "status": "valid-fork"
        },
        {
            "height": 833934,
            "hash": "00000000000000000194d8508e06ae8cc01f2bd616f6d5f93754f3bf3c18d9bb",
            "branchlen": 1,
            "status": "valid-fork"
        },
        {
            "height": 826704,
            "hash": "000000000000000002b96268604d82cd848e66315a6b0be1884f3b32fea253d9",
            "branchlen": 1,
            "status": "valid-fork"
        },
        {
            "height": 826265,
            "hash": "000000000000000001be6726a33853fda5f56abce2ac17e7005795ecf0694acf",
            "branchlen": 1,
            "status": "valid-fork"
        },
        {
            "height": 825592,
            "hash": "0000000000000000030591a6d9676691e53e2b08f5a3c69ebd1a7aa44f165f27",
            "branchlen": 1,
            "status": "valid-fork"
        },
        {
            "height": 824638,
            "hash": "000000000000000000e4f4d835abbc16946c858ebbaa3fd31194c5fa95ddecc5",
            "branchlen": 1,
            "status": "valid-fork"
        },
...

getchaintxstats

Compute statistics about the total number and rate of transactions in the chain.

Method: POST

https://bch.nownodes.io

Example body (raw)

{
    "jsonrpc": "1.0",
    "id": "curltest",
    "method": "getchaintxstats",
    "params": [
        2016
    ]
}

Example response: 200

{
    "result": {
        "time": 1712820726,
        "txcount": 389435980,
        "window_final_block_hash": "0000000000000000021a5a4dd26cd5b2c5c4c1a0de19814961fb5bc4a63ab4c0",
        "window_block_count": 2016,
        "window_tx_count": 2183413,
        "window_interval": 1323269,
        "txrate": 1.650014471736283
    },
    "error": null,
    "id": "curltest"
}

getdifficulty

Returns the proof-of-work difficulty as a multiple of the minimum difficulty.

Method: POST

https://bch.nownodes.io

Example body (raw)

{
    "jsonrpc": "1.0",
    "id": "curltest",
    "method": "getdifficulty",
    "params": []
}

Example response: 200

{
    "result": 354334960322.4879,
    "error": null,
    "id": "curltest"
}

getmempoolancestors

If txid is in the mempool, returns all in-mempool ancestors.

Method: POST

https://bch.nownodes.io

Example body (raw)

{
    "jsonrpc": "1.0",
    "id": "curltest",
    "method": "getmempoolancestors",
    "params": [
        "mytxid"
    ]
}

Example response: 200

{
    "result": null,
    "error": {
        "code": -8,
        "message": "parameter 1 must be of length 64 (not 6, for 'mytxid')"
    },
    "id": "curltest"
}

getmempooldescendants

If txid is in the mempool, returns all in-mempool descendants.

Method: POST

https://bch.nownodes.io

Example body (raw)

{
    "jsonrpc": "1.0",
    "id": "curltest",
    "method": "getmempooldescendants",
    "params": [
        "mytxid"
    ]
}

Example response: 200

{
    "result": null,
    "error": {
        "code": -8,
        "message": "parameter 1 must be of length 64 (not 6, for 'mytxid')"
    },
    "id": "curltest"
}

getmempoolentry

Returns mempool data for given transaction

Method: POST

https://bch.nownodes.io

Example body (raw)

{
    "jsonrpc": "1.0",
    "id": "curltest",
    "method": "getmempoolentry",
    "params": [
        "mytxid"
    ]
}

Example response: 200

{
    "result": null,
    "error": {
        "code": -8,
        "message": "parameter 1 must be of length 64 (not 6, for 'mytxid')"
    },
    "id": "curltest"
}

getmempoolinfo

Returns details on the active state of the TX memory pool.

Method: POST

https://bch.nownodes.io

Example body (raw)

{
    "jsonrpc": "1.0",
    "id": "curltest",
    "method": "getmempoolinfo",
    "params": []
}

Example response: 200

{
    "result": {
        "loaded": true,
        "size": 721,
        "bytes": 347568,
        "usage": 1030272,
        "maxmempool": 2000000000,
        "mempoolminfee": 0.00001000,
        "minrelaytxfee": 0.00001000
    },
    "error": null,
    "id": "curltest"
}

getrawmempool

Returns all transaction ids in memory pool as a json array of string transaction ids.

Hint: use getmempoolentry to fetch a specific transaction from the mempool.

Method: POST

https://bch.nownodes.io

Example body (raw)

{
    "jsonrpc": "1.0",
    "id": "curltest",
    "method": "getrawmempool",
    "params": [
        true
    ]
}

Example response: 200

{
    "result": {
        "dc7d5a1ceb723d6c9c0722654715614969ba67b42ebe976f90affb2dbfe3d29b": {
            "fees": {
                "base": 0.00000220,
                "modified": 0.00000220
            },
            "size": 219,
            "time": 1712820732,
            "depends": [],
            "spentby": [
                "95eef46b8fc488bbd8ce92341c9650181f9a0cf4417f7bd4753e03826a304f94"
            ]
        },
        "06ed5782e38f023d4d75f0d97ae585f9187112daf71afa91d4b02a806033ffec": {
            "fees": {
                "base": 0.00000738,
                "modified": 0.00000738
            },
            "size": 370,
            "time": 1712820734,
            "depends": [],
            "spentby": []
        },
        "95eef46b8fc488bbd8ce92341c9650181f9a0cf4417f7bd4753e03826a304f94": {
            "fees": {
                "base": 0.00000220,
                "modified": 0.00000220
            },
            "size": 219,
            "time": 1712820736,
            "depends": [
                "dc7d5a1ceb723d6c9c0722654715614969ba67b42ebe976f90affb2dbfe3d29b"
            ],
            "spentby": [
                "7222bccedc7e3f5889f534365ef5d4e025e9b955e5c4ac966b718c61a03d82ea"
            ]
        },
        "aba6f8ef8efbddd72a45862926efaf2135f8d888b0301a3d3a502a294ec749fb": {
            "fees": {
                "base": 0.00000225,
                "modified": 0.00000225
            },
            "size": 225,
            "time": 1712820736,
            "depends": [],
            "spentby": []
        },
        "7222bccedc7e3f5889f534365ef5d4e025e9b955e5c4ac966b718c61a03d82ea": {
            "fees": {
                "base": 0.00000220,
                "modified": 0.00000220
            },
            "size": 219,
            "time": 1712820738,
            "depends": [
                "95eef46b8fc488bbd8ce92341c9650181f9a0cf4417f7bd4753e03826a304f94"
            ],
            "spentby": [
                "0acd4a0bf88ef54327c19be80d160e4a701ffa1e09166c26c59c1acb405b6039"
            ]
        },
...

gettxout

Returns details about an unspent transaction output.

Method: POST

https://bch.nownodes.io

Example body (raw)

{
    "jsonrpc": "1.0",
    "id": "curltest",
    "method": "gettxout",
    "params": [
        "txid",
        1
    ]
}

Example response: 200

{
    "result": null,
    "error": {
        "code": -8,
        "message": "txid must be of length 64 (not 4, for 'txid')"
    },
    "id": "curltest"
}

gettxoutproof

Returns a hex-encoded proof that โ€œtxidโ€ was included in a block.

Method: POST

https://bch.nownodes.io

Example body (raw)

{
    "jsonrpc": "1.0",
    "id": "curltest",
    "method": "gettxoutproof",
    "params": [
        [
            "afea852d1e2e7008f24152ed27aae270e9c35b129daf01235304703906ce6098",
            "0032e4a1d17ffd1e0865be230436834eae24f810a94a40ad85365f57afaf8923"
        ],
        null
    ]
}

Example response: 200

{
    "result": "00a07a26c0b43aa6c45bfb61498119dea0c1c4c5b2d56cd24d5a1a020000000000000000eb399dac780ae220510212a3ba5dbaa87d1150f214825f44237e7c96f5917ebc5da41766ec1b03181d2b17acd10200000b9860ce06397004532301af9d125bc3e970e2aa27ed5241f208702e1e2d85eaaf2389afaf575f3685ad404aa910f824ae4e83360423be65081efd7fd1a1e432001cc828f9ddc4fb3af983628c04bc30aae9c88552c3bcfd6ae01ca8b4c03a13c45c1be6d17fb70823c21637b6c89599b03168df21ca30e9a4fc0f68a4d3f6c08dad93261a13b8cf600c5f9e0986b4956e97ca6c82e3e2dcd3f4447cd7ad66b2aa54de0a5bc36f6d9b984fe3609f531534bd13647e8993ac662ace931ed3ad437f1be6b415e1e65de39bf37f0a33c6ec7d9c6ece0838036844872d588ed472ced6d8817057d0fc7c549c9d6be83daeee6b46f86d1ac44ab5eb5a2850416eb63b5bf490d37e92efeabd4b52c992be841f40faf2ce356169a3440dc32146780763552a5ea5c8e975d19f7c8ac6540b3b98e7a9171df998be29b1929f80ecdb3bb706c6075bd613e051057748f66c398630d2577462e42ff2808827983219133c23b203ff0f00",
    "error": null,
    "id": "curltest"
}

preciousblock

Treats a block as if it were received before others with the same work.

A later preciousblock call can override the effect of an earlier one.

The effects of preciousblock are not retained across restarts.

Method: POST

https://bch.nownodes.io

Example body (raw)

{
    "jsonrpc": "1.0",
    "id": "curltest",
    "method": "preciousblock",
    "params": [
        "blockhash"
    ]
}

Example response: 200

{
    "result": null,
    "error": {
        "code": -8,
        "message": "blockhash must be of length 64 (not 9, for 'blockhash')"
    },
    "id": "curltest"
}

Last updated