githubEdit

preciousblock - Bitcoin

Example code for the preciousblock JSON-RPC method. Complete guide on how to use preciousblock JSON-RPC in GetBlock Web3 documentation.

This method treats a block as if it were received before others with the same work. A later call can override the effect of an earlier one. The effects of this method are not retained across restarts.

Parameters

Parameter
Type
Required
Description

blockhash

string

Yes

The hash of the block to mark as precious.

Request

curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "preciousblock",
    "params": ["000000000000000000046b9302e08c16ea186950f42a5498320ddd1bd7ab3428"],
    "id": "getblock.io"
}'

Response

{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": null
}

Response Parameters

Field
Type
Description

result

null

Returns null on success.

Use Case

The preciousblock method is essential for:

  • Resolving chain tip conflicts

  • Testing chain reorganization behavior

  • Favoring specific chain branches

  • Mining pool conflict resolution

  • Advanced node management

  • Research and testing scenarios

Error Handling

Status Code
Error Message
Cause

403

Forbidden

Missing or invalid ACCESS-TOKEN.

-5

Block not found

The specified block hash does not exist.

Integration With Web3

The preciousblock method helps developers:

  • Manage chain tip preferences

  • Test reorganization scenarios

  • Handle competing chain tips

  • Support advanced node operations

  • Research consensus behavior

Last updated

Was this helpful?