Server API
The daemon implements JSON RPC, so you can use any RPC client to communicate with it or write your own. A basic request over HTTP would look like this (using testnet4 endpoint)
POST http://127.0.0.1:7225
{
"jsonrpc": "2.0",
"method": "<methodname>",
"params": [ .. ],
"id": 1
}Get Server Info
getserverinfo retrieve the current state of the spaces daemon
Params None
space-cli getserverinfocurl -X POST http://127.0.0.1:7225 \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"getserverinfo","params":[],"id":1}'Example Response
{
"chain": "mainnet",
"tip": {
"hash": "0000000000000000000210254eedf4507d3df7bf258ed4bcedfcbb8d02df58c6",
"height": 883338
}
}Get Space
getspace retrieve information about a space:
Params
space
string
Canonical space name e.g. @bitcoin
Example Response
Get Space Owner
getspaceowner retrieves the outpoint of a space:
Params
space
string
Canonical space name e.g. @bitcoin
Example Response Responds with an outpoint with txid:vout format.
Get Spaceout
getspaceout retrieves a spaceout which are any UTXOs tracked by the spaces protocol not necessarily ones with a space.
Params
outpoint
string
An Outpoint which is a specific output within a transaction using txid:vout format e.g.
Example Response
Estimate bid
estimatebid estimates the required bid to make it into the auctions phase for the given interval (in 144 block increments)::
Params
target
number
The target interval e.g. specify 0 for the coming rollout, 1 for the day after and so on.
Example Response Responds with an amount in Satoshis
Get Rollout
getrollout get spaces rolling out into auctions for the given interval (in 144 block increments):
Params
target
number
The target interval e.g. specify 0 for the coming rollout, 1 for the day after and so on.
Example Response An array of spaces expected to be in auctions within the given target
Get Block Meta
getblockmeta Retrieves all transactions relevant to spaces for the given block (requires block indexing to be enabled)
Params
block_hash
string
The block hash as hex string
Example Response
Get Transaction Meta
gettxmeta Retrieves all transactions relevant to spaces for the given block (requires -txindex to be enabled)
Params
txid
string
The transaction id as a hex string
Example Response
Check package
checkpackage Simulates the transactions being applied to the current blockchain state
Params
txs
array of strings
The transactions as hex strings
Example Response
Last updated
Was this helpful?