Chia RPC (2.3.0)

Download OpenAPI specification:Download

The Chia node and services come with a JSON RPC API server that allows you to access information and control the services. These are accessible via HTTPS, WebSockets, or via client SDKs. The ports can be configured in ~/.chia/mainnet/config/config.yaml. The RPC ports should not be exposed to the internet. TLS certificates are used to secure the communication using mutualTLS. The full node uses port 8555 by default.

Blocks

Methods for managing blocks.

Retrieves aggregate information about blocks.

Retrieves aggregate information about blocks.

Authorizations:
bearerAuth
Request Body schema: application/json
required

Empty request body

object

Responses

Request samples

Content type
application/json
{ }

Response samples

Content type
application/json
{
  • "metrics": {
    },
  • "success": true,
  • "error": "string"
}

Retrieves a block record by header hash.

Retrieves a block record by header hash.

Authorizations:
bearerAuth
Request Body schema: application/json
required

the block's header_hash

header_hash
required
string <hex>

Responses

Request samples

Content type
application/json
{
  • "header_hash": "string"
}

Response samples

Content type
application/json
{
  • "block_record": {
    },
  • "success": true,
  • "error": "string"
}

Retrieves block records in a range.

Retrieves block records in a range

Authorizations:
bearerAuth
Request Body schema: application/json
required

Start and end heights

start
required
integer <uint32>
end
required
integer <uint32>

Responses

Request samples

Content type
application/json
{
  • "start": 0,
  • "end": 0
}

Response samples

Content type
application/json
{
  • "block_records": [
    ],
  • "success": true,
  • "error": "string"
}

Retrieves a block record by height.

Retrieves a block record by height (assuming the height <= peak height). Note that not all blocks will have all fields set here (depending on transaction block, finishing sub epoch, etc).

Authorizations:
bearerAuth
Request Body schema: application/json
required

the block height

height
required
integer <uint32>

Responses

Request samples

Content type
application/json
{
  • "height": 0
}

Response samples

Content type
application/json
{
  • "block_record": {
    },
  • "success": true,
  • "error": "string"
}

Retrieves a block by header hash.

Retrieves a block by header hash.

Authorizations:
bearerAuth
Request Body schema: application/json
required

the block's header_hash

header_hash
required
string <hex>

Responses

Request samples

Content type
application/json
{
  • "header_hash": "string"
}

Response samples

Content type
application/json
{
  • "block": {
    },
  • "success": true,
  • "error": "string"
}

Retrieves the spends in the given block.

Retrieves the spends in the given block.

Authorizations:
bearerAuth
Request Body schema: application/json
required

the block's header_hash

header_hash
required
string <hex>

Responses

Request samples

Content type
application/json
{
  • "header_hash": "string"
}

Response samples

Content type
application/json
{
  • "block_spends": [
    ],
  • "success": true,
  • "error": "string"
}

Get the blocks between a start and end height.

Get the blocks between a start and end height

Authorizations:
bearerAuth
Request Body schema: application/json
required

Start and end heights

start
required
integer <uint32>
end
required
integer <uint32>
exclude_header_hash
boolean
Default: false
exclude_reorged
boolean
Default: false

Responses

Request samples

Content type
application/json
{
  • "start": 0,
  • "end": 0,
  • "exclude_header_hash": false,
  • "exclude_reorged": false
}

Response samples

Content type
application/json
{
  • "blocks": [
    ],
  • "success": true,
  • "error": "string"
}

Retrieves unfinished block headers.

Retrieves unfinished block headers.

Authorizations:
bearerAuth
Request Body schema: application/json
required

Empty request body

object

Responses

Request samples

Content type
application/json
{ }

Response samples

Content type
application/json
{
  • "headers": [
    ],
  • "success": true,
  • "error": "string"
}

Retrieves the additions and removals for a certain block.

Retrieves the additions and removals (state transitions) for a certain block. Returns coin records for each addition and removal.

Authorizations:
bearerAuth
Request Body schema: application/json
required

the block's header_hash

header_hash
required
string <hex>

Responses

Request samples

Content type
application/json
{
  • "header_hash": "string"
}

Response samples

Content type
application/json
{
  • "additions": [
    ],
  • "removals": [
    ],
  • "success": true,
  • "error": "string"
}

Retrieves a recent signage point or end of slot.

Retrieves a recent signage point or end of slot.

Authorizations:
bearerAuth
Request Body schema: application/json
required

The signage point hash or challenge hash. If both are present sp_hash takes precedence.

One of
sp_hash
string <hex>

Responses

Request samples

Content type
application/json
{
  • "challenge_hash": "string"
}

Response samples

Content type
application/json
{
  • "eos": {
    },
  • "time_received": 0,
  • "reverted": true,
  • "success": true,
  • "error": "string"
}

Retrieves the spends in the given block, including its conditions.

Retrieves the spends in the given block, including its conditions.

Authorizations:
bearerAuth
Request Body schema: application/json
required

the block's header_hash

header_hash
required
string <hex>

Responses

Request samples

Content type
application/json
{
  • "header_hash": "string"
}

Response samples

Content type
application/json
{
  • "block_spends_with_conditions": [
    ],
  • "success": true,
  • "error": "string"
}

Coins

Methods for managing coins.

Retrieves the coins for a given puzzlehash.

Retrieves the coins for a given puzzlehash, by default returns unspent coins.

Authorizations:
bearerAuth
Request Body schema: application/json
required

The puzzle hash.

puzzle_hash
required
string <hex>
start_height
integer <uint32>
end_height
integer <uint32>
include_spent_coins
boolean

Responses

Request samples

Content type
application/json
{
  • "puzzle_hash": "string",
  • "start_height": 0,
  • "end_height": 0,
  • "include_spent_coins": true
}

Response samples

Content type
application/json
{
  • "coin_records": [
    ],
  • "success": true,
  • "error": "string"
}

Retrieves the coins for a given puzzlehashes

Retrieves the coins for a given puzzlehashes, by default returns unspent coins.

Authorizations:
bearerAuth
Request Body schema: application/json
required

The puzzle hashes.

puzzle_hashes
required
Array of strings <hex> [ items <hex > ]
start_height
integer <uint32>
end_height
integer <uint32>
include_spent_coins
boolean

Responses

Request samples

Content type
application/json
{
  • "puzzle_hashes": [
    ],
  • "start_height": 0,
  • "end_height": 0,
  • "include_spent_coins": true
}

Response samples

Content type
application/json
{
  • "coin_records": [
    ],
  • "success": true,
  • "error": "string"
}

Retrieves coins by hint.

Retrieves coins by hint, by default returns unspent coins.

Authorizations:
bearerAuth
Request Body schema: application/json
required

The hint.

hint
required
string <hex>
start_height
integer <uint32>
end_height
integer <uint32>
include_spent_coins
boolean

Responses

Request samples

Content type
application/json
{
  • "hint": "string",
  • "start_height": 0,
  • "end_height": 0,
  • "include_spent_coins": true
}

Response samples

Content type
application/json
{
  • "coin_records": [
    ],
  • "success": true,
  • "error": "string"
}

Retrieves a coin record by it's name.

Retrieves a coin record by it's name.

Authorizations:
bearerAuth
Request Body schema: application/json
required

The coin name.

name
required
string <hex>

Responses

Request samples

Content type
application/json
{
  • "name": "string"
}

Response samples

Content type
application/json
{
  • "coin_record": {
    },
  • "success": true,
  • "error": "string"
}

Retrieves the coins for given coin IDs.

Retrieves the coins for given coin IDs, by default returns unspent coins.

Authorizations:
bearerAuth
Request Body schema: application/json
required

The coin names.

names
required
Array of strings <hex> [ items <hex > ]
start_height
integer <uint32>
end_height
integer <uint32>
include_spent_coins
boolean

Responses

Request samples

Content type
application/json
{
  • "names": [
    ],
  • "start_height": 0,
  • "end_height": 0,
  • "include_spent_coins": true
}

Response samples

Content type
application/json
{
  • "coin_records": [
    ],
  • "success": true,
  • "error": "string"
}

Retrieves the coins for given parent coin IDs.

Retrieves the coins for given parent coin IDs, by default returns unspent coins.

Authorizations:
bearerAuth
Request Body schema: application/json
required

The parent ids.

parent_ids
required
Array of strings <hex> [ items <hex > ]
start_height
integer <uint32>
end_height
integer <uint32>
include_spent_coins
boolean

Responses

Request samples

Content type
application/json
{
  • "parent_ids": [
    ],
  • "start_height": 0,
  • "end_height": 0,
  • "include_spent_coins": true
}

Response samples

Content type
application/json
{
  • "coin_records": [
    ],
  • "success": true,
  • "error": "string"
}

Retrieves a coin solution.

Retrieves a coin solution.

Authorizations:
bearerAuth
Request Body schema: application/json
required

The coin id and height

coin_id
required
string <hex>
height
required
integer <uint32>

Responses

Request samples

Content type
application/json
{
  • "coin_id": "string",
  • "height": 0
}

Response samples

Content type
application/json
{
  • "coin_solution": {
    },
  • "success": true,
  • "error": "string"
}

Pushes a transaction/spend bundle to the mempool and blockchain.

Pushes a transaction/spend bundle to the mempool and blockchain. Returns whether the spend bundle was successfully included into the mempool.

Authorizations:
bearerAuth
Request Body schema: application/json
required

The spend bundle

required
object (spend_bundle)

Responses

Request samples

Content type
application/json
{
  • "spend_bundle": {
    }
}

Response samples

Content type
application/json
{
  • "status": "string",
  • "success": true,
  • "error": "string"
}

Shared

Methods shared by all services.

Stop the node.

Stop the node.

Authorizations:
bearerAuth
Request Body schema: application/json
required

Empty request body

object

Responses

Request samples

Content type
application/json
{ }

Response samples

Content type
application/json
{
  • "success": true,
  • "error": "string"
}

Add a connection to another node.

Add a connection to another node.

Authorizations:
bearerAuth
Request Body schema: application/json
required

the address of the connection

ip
required
string <ipaddress>
port
required
integer

Responses

Request samples

Content type
application/json
{
  • "ip": "string",
  • "port": 0
}

Response samples

Content type
application/json
{
  • "success": true,
  • "error": "string"
}

Removes a connection.

Removes a connection.

Authorizations:
bearerAuth
Request Body schema: application/json
required

the node id of the connection

node_id
required
string

Responses

Request samples

Content type
application/json
{
  • "node_id": "string"
}

Response samples

Content type
application/json
{
  • "success": true,
  • "error": "string"
}

Retrieve the list of connections.

Retrieve the list of connections.

Authorizations:
bearerAuth
Request Body schema: application/json
required

Empty request body

object

Responses

Request samples

Content type
application/json
{ }

Response samples

Content type
application/json
{
  • "connections": [
    ],
  • "success": true,
  • "error": "string"
}

Heartbeat.

Heartbeat.

Authorizations:
bearerAuth
Request Body schema: application/json
required

Empty request body

object

Responses

Request samples

Content type
application/json
{ }

Response samples

Content type
application/json
{
  • "success": true,
  • "error": "string"
}

Retrieve the list of routes exposed by the service.

Retrieve the list of routes/endpoints exposed by the service.

Authorizations:
bearerAuth
Request Body schema: application/json
required

Empty request body

object

Responses

Request samples

Content type
application/json
{ }

Response samples

Content type
application/json
{
  • "routes": [
    ],
  • "success": true,
  • "error": "string"
}

Retrieves some information about the current network.

Retrieves some information about the current network.

Authorizations:
bearerAuth
Request Body schema: application/json
required

Empty request body

object

Responses

Request samples

Content type
application/json
{ }

Response samples

Content type
application/json
{
  • "network_name": "mainnet",
  • "network_prefix": "xch",
  • "success": true,
  • "error": "string"
}

Full Node

The full node RPC API is exposed, by default, on port 8555. This port must not be exposed publicly for security concerns.

Retrieves a summary of the current state of the blockchain and full node.

Retrieves a summary of the current state of the blockchain and full node.

Authorizations:
bearerAuth
Request Body schema: application/json
required

Empty request body

object

Responses

Request samples

Content type
application/json
{ }

Response samples

Content type
application/json
{
  • "blockchain_state": {
    },
  • "success": true,
  • "error": "string"
}

Retrieves an estimate of total space.

Retrieves an estimate of total space validating the chain between two block header hashes.

Authorizations:
bearerAuth
Request Body schema: application/json
required

The block header hashes

newer_block_header_hash
required
string <hex>
older_block_header_hash
required
string <hex>

Responses

Request samples

Content type
application/json
{
  • "newer_block_header_hash": "string",
  • "older_block_header_hash": "string"
}

Response samples

Content type
application/json
{
  • "space": 0,
  • "success": true,
  • "error": "string"
}

Retrieves aggregated signature additional data.

Retrieves aggregated signature additional data.

Authorizations:
bearerAuth
Request Body schema: application/json
required

Empty request body

object

Responses

Request samples

Content type
application/json
{ }

Response samples

Content type
application/json
{
  • "additional_data": "string",
  • "success": true,
  • "error": "string"
}

Mempool

Get information about the mempool.

Returns a list of all transaction IDs in the mempool.

Returns a list of all transaction IDs (spend bundle hashes) in the mempool.

Authorizations:
bearerAuth
Request Body schema: application/json
required

Empty request body

object

Responses

Request samples

Content type
application/json
{ }

Response samples

Content type
application/json
{
  • "tx_ids": [
    ],
  • "success": true,
  • "error": "string"
}

Returns all items in the mempool.

Returns all items in the mempool.

Authorizations:
bearerAuth
Request Body schema: application/json
required

Empty request body

object

Responses

Request samples

Content type
application/json
{ }

Response samples

Content type
application/json
{
  • "mempool_items": {
    },
  • "success": true,
  • "error": "string"
}

Returns a specific item from the mempool.

Returns a specific item from the mempool.

Authorizations:
bearerAuth
Request Body schema: application/json
required

The tx id.

tx_id
required
string <hex>
include_pending
boolean
Default: false

Responses

Request samples

Content type
application/json
{
  • "tx_id": "string",
  • "include_pending": false
}

Response samples

Content type
application/json
{
  • "mempool_item": {
    },
  • "success": true,
  • "error": "string"
}

Gets items in the mempool by a coin name.

Gets items in the mempool by a coin name.

Authorizations:
bearerAuth
Request Body schema: application/json
required
coin_name
required
string <hex>

Responses

Request samples

Content type
application/json
{
  • "coin_name": "string"
}

Response samples

Content type
application/json
{
  • "mempool_items": [
    ],
  • "success": true,
  • "error": "string"
}

Fees

Get information about fees.

Estimates the fee for a given spend_bundle.

Estimates the fee for a given spend_bundle.

Authorizations:
bearerAuth
Request Body schema: application/json
required

The spend bundle

object (spend_bundle)
cost
integer <uint64>
target_times
Array of integers
spend_type
integer <uint64>
spend_count
integer
Default: 1

Responses

Request samples

Content type
application/json
{
  • "spend_bundle": {
    },
  • "cost": 0,
  • "target_times": [
    ],
  • "spend_type": 0,
  • "spend_count": 1
}

Response samples

Content type
application/json
{
  • "estimates": [
    ],
  • "target_times": [
    ],
  • "current_fee_rate": 0,
  • "mempool_size": 0,
  • "mempool_fees": 0,
  • "mempool_max_size": 0,
  • "num_spends": 0,
  • "full_node_synced": true,
  • "peak_height": 0,
  • "last_peak_timestamp": 0,
  • "last_block_cost": 0,
  • "fees_last_block": 0,
  • "fee_rate_last_block": 0,
  • "last_tx_block_height": 0,
  • "node_time_utc": 0,
  • "success": true,
  • "error": "string"
}