Mining RPCs

getblocktemplate

If the request parameters include a ‘mode’ key, that is used to explicitly select between the default ‘template’ request or a ‘proposal’.

It returns data needed to construct a block to work on.

Method: POST

https://btc-testnet.nownodes.io

Example body (raw)

{
    "jsonrpc": "1.0",
    "id": "curltest",
    "method": "getblocktemplate",
    "params": [
        {
            "rules": [
                "segwit"
            ]
        }
    ]
}

Example response: 200

  {
    "result": {
        "capabilities": [
            "proposal"
        ],
        "version": 536870912,
        "rules": [
            "csv",
            "!segwit",
            "taproot"
        ],
        "vbavailable": {},
        "vbrequired": 0,
        "previousblockhash": "000000000000000000017a4ab8b59b36ad349bc96b2e7daeed3fffd14e7a8779",
        "transactions": [
           {
                "data": "020000000001016039a139f3bccf1aa6128c165da4766072b8415e8ab98ede85019b2c88fdb77a0f00000000fdffffff014a01000000000000225120f4ab67f5486e62eb2d5345a5bcb99f2dc97e5d3aa35d313abdd62337e314c060034093ff6a8254cd3bf5ab66a4581563a6e6a42ec4c9731493308bd500feaa63c7f38a78631042edb9d2f285e02b97e776e7a3c9ac92387729ba299e35d491a73c4e7b20e330f9b8434c4701589d7b6730370e5ea5f4420f972c921a802fb7f4b3f741e5ac0063036f7264010118746578742f706c61696e3b636861727365743d7574662d3800357b2270223a226272632d3230222c226f70223a226d696e74222c227469636b223a2262726320222c22616d74223a2231303030227d6821c1e330f9b8434c4701589d7b6730370e5ea5f4420f972c921a802fb7f4b3f741e500000000",
                "txid": "9527bca48fcf17f7041f4d29c0d9af4d9d892fffbcd89f5d5cf1b50fb0c9defd",
                "hash": "e5706208a3f6825091d5b76954c4eab0e8683e50bddf7c42e5d8b089766465d2",
                "depends": [],
                "fee": 151,
                "sigops": 0,
                "weight": 602
            }
        ],
        "coinbaseaux": {},
        "coinbasevalue": 313888447,
        "longpollid": "000000000000000000017a4ab8b59b36ad349bc96b2e7daeed3fffd14e7a877921651",
        "target": "000000000000000000025ced0000000000000000000000000000000000000000",
        "mintime": 1746357246,
        "mutable": [
            "time",
            "transactions",
            "prevblock"
        ],
        "noncerange": "00000000ffffffff",
        "sigoplimit": 80000,
        "sizelimit": 4000000,
        "weightlimit": 4000000,
        "curtime": 1746358998,
        "bits": "17025ced",
        "height": 895191,
        "default_witness_commitment": "6a24aa21a9ed0b248731086daddb3d84c2b30ab090ec4dec149659e0d9c94db908fdd767d67e"
    },
    "error": null,
    "id": "curltest"
}

getmininginfo

Returns a json object containing mining-related information.

Method: POST

https://btc-testet.nownodes.io

Example body (raw)

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

Example response: 200

{
    "result": {
        "blocks": 2585861,
        "currentblockweight": 241556,
        "currentblocktx": 355,
        "difficulty": 110454122.3273832,
        "networkhashps": 354429648566452.2,
        "pooledtx": 535,
        "chain": "test",
        "warnings": "Unknown new rules activated (versionbit 28)"
    },
    "error": null,
    "id": "curltest"
}

getnetworkhashps

Returns the estimated network hashes per second based on the last n blocks.

Pass in [blocks] to override # of blocks, -1 specifies since last difficulty change.

Pass in [height] to estimate the network speed at the time when a certain block was found.

Method: POST

https://btc-testnet.nownodes.io

Example body (raw)

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

Example response: 200

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

prioritisetransaction

Accepts the transaction into mined blocks at a higher (or lower) priority

Method: POST

https://btc-testnet.nownodes.io

Example body (raw)

{
    "jsonrpc": "1.0",
    "id": "curltest",
    "method": "prioritisetransaction",
    "params": [
        "txid",
        0.0,
        10000
    ]
}

Example response: 200

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

submitblock

Attempts to submit new block to network.

Method: POST

https://btc-testnet.nownodes.io

Example body (raw)

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

Example response: 200

{
    "result": null,
    "error": {
        "code": -22,
        "message": "Block decode failed"
    },
    "id": "curltest"
}

submitheader

Decode the given hexdata as a header and submit it as a candidate chain tip if valid.

Throws when the header is invalid.

Method: POST

https://btc-testnet.nownodes.io

Example body (raw)

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

Example response: 200

{
    "result": null,
    "error": {
        "code": -22,
        "message": "Block header decode failed"
    },
    "id": "curltest"
}

Last updated