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": "000000000000001328a0522bd16c9963fd13e887bcf08a9d331c2d8ae52a9dae",
        "transactions": [
            {
                "data": "02000000000101114ec8b95c3b672d9c7b6b600928e50ec4ec2ac8cf852dab1306e3eeb80737510000000000fdffffff014d01000000000000225120b30bea97c87075940da625ebd51de6b74daf38765d9cfb0e40f873293e9053410340a1e71d20a1ccc8bd7d5536343123142697ad3e3d7858100b9d4521b6b8c510cb8d20fe0b4e0c6138deb67d1008d6b0adebefadd12e289ca88b66ed4a5195cd6faf20a43240df0e204ccdb4a1ce0642076f16bfcd841e13293c31b2f79747e0d1d3f4ac0063036f726401010a746578742f706c61696e01073a406d6f746f3a737761703a3a636272632d32303a737761703f61623d50495a5a412d4d4f544f26613d3130303026623d302e3030323634303439003a406d6f746f3a737761703a3a636272632d32303a737761703f61623d50495a5a412d4d4f544f26613d3130303026623d302e30303236343034396821c1a43240df0e204ccdb4a1ce0642076f16bfcd841e13293c31b2f79747e0d1d3f400000000",
                "txid": "b6145bb3382defd718e9f774c09edca13406f599e7a820661703ec4c0ce0916c",
                "hash": "99abc2a0361070c5cfa20df875aec63cd0ea23c8d95516f85b7b59bd527fb76e",
                "depends": [],
                "fee": 14904,
                "sigops": 0,
                "weight": 654
            },
            {
                "data": "02000000000101114ec8b95c3b672d9c7b6b600928e50ec4ec2ac8cf852dab1306e3eeb80737510100000000ffffffff02853b0000000000002251209272ab8ff5e8bd7f6dd43cd54064da0c9d74c58badaeebdc63f49f3e2229cb86e6e03e0000000000225120b30bea97c87075940da625ebd51de6b74daf38765d9cfb0e40f873293e90534101407569bef968aae4a9acc80693e3c78536222ba52e507ffbd97c6df57256ee77f7d85fe92b97a5cbd61602b63fccf766c7d2f01bbd008a0b88ee1e9d9c07a154e600000000",
                "txid": "5a8745bf1c0db7887e6e279d5443126490392ffbd658a3410e04227d3849941e",
                "hash": "7593c3093c00414bce32155d5f09696e91da7075fd40e09a473caf20077d953e",
                "depends": [],
                "fee": 10626,
                "sigops": 0,
                "weight": 616
            },
            {
                "data": "020000000001011e9449387d22040e41a358d6fb2f3990641243549d276e7e88b70d1cbf45875a0000000000fdffffff014d01000000000000225120b30bea97c87075940da625ebd51de6b74daf38765d9cfb0e40f873293e9053410340388628c6ebfddca1ac8141a9bb464257154a6d3b5cfe3dd58d972cdb3b0de13ccac7ba94b9eb68fb802990ca299f74f9f85e070fe5f8bd717f204a98498d1348af2087b78b58efc6bd56d5873191045f791d444c4716029e74ce8579a558dd718af8ac0063036f726401010a746578742f706c61696e01073a406d6f746f3a737761703a3a636272632d32303a737761703f61623d50495a5a412d4d4f544f26613d3130303026623d302e3030323433333331003a406d6f746f3a737761703a3a636272632d32303a737761703f61623d50495a5a412d4d4f544f26613d3130303026623d302e30303234333333316821c087b78b58efc6bd56d5873191045f791d444c4716029e74ce8579a558dd718af800000000",
                "txid": "7b470c7911cbabc4e6a659cfc9d6b3fe1479061a1858e83adfebdb4030c2a805",
                "hash": "9f4155f44fd9aef77bc7fcc60910d20203227c99211ffe322c11c436b88c6ff6",
                "depends": [
                    2
                ],
                "fee": 14904,
                "sigops": 0,
                "weight": 654
            },
            {
                "data": "020000000001011ecd3eca43c5a91a62156bd8244eb062affc47683058efcc2808f339a80a1abf0100000000ffffffff02853b0000000000002251202520f0966c2bd90cd4f968a14ad603ac078973203c0e00226a542b68d54c54194ae43800000000002251203426ca0bbeed7ec47b6cd907a656f1333c1aa7d97618f2f496b208925dd81b48014094c433d35a9d25414c8d71b8fb3b156005db3d2f80ff0e8a8aa8c6fe66ce5574149e850ddc66782cdb7ec30d51fdd9f2817b230cf307c4495a37f2e08a075a4d00000000",
                "txid": "1fbe47fce00617ce61075fdd20a941241c0926360cf15f3d250fe45e76595b79",
                "hash": "a7f3ef41acdbad21cdd72628a4568c2d019366175adf7e5ad45e42a053cd0525",
                "depends": [],
                "fee": 10626,
                "sigops": 0,
                "weight": 616
            },

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