cruzb.it Public API

This API was created to provide simple integration into the cruzbit network. As it matures, it will provide a direct interface, allowing clients to query data directly from the network. While its in its infancy, it will provide limited endpoints which allow clients to quickly get information about cruzbit from cruzb.it's (the website) database.

Use should be fairly straightforward for anyone who's worked with RPC or REST-like APIs in the past. The documentation attempts to provide all information needed to make requests, and limited direct support may be available on the cruzbit Discord channel.

Resource Endpoints

Resource endpoints offer information or services not directly performed by the cruzbit network (for example, functionality not built in to a standard cruzbit client).

Calculated Network Statistics

At the top of every hour, cruzb.it collects various datapoints and makes calculations about cruzbit's network activity and coin market. These can be retrieved as a collection, with a single request.

GET https://api.cruzb.it/web/network-stats

Accepts the number of previous hours for which to return data as querystring parameter count. Returns an array of statistics collections (one collection per hour). NULL values represent unavailable data.

CURL Examples:

curl https://api.cruzb.it/web/network-stats
curl https://api.cruzb.it/web/network-stats?count=5

Returns:

[
  {
    "id": "2019-08-11 22:00:04",
    "blockHeight": "20313",
    "difficulty": "30157",
    "hashrate24h": "346503098070.66",
    "hashrate1h": "395765726722.28",
    "supply": "1015650",
    "price_btc": "0.0000129",
    "price_usd": "0.148395924",
    "marketCap": "150718.3202106",
    "marketVol": "0.00774",
    "transactionCount": "0",
    "transactionVol": "0"
  },
  ...
]
Property Description
id TIMESTAMP of the data collection, in format yyyy-mm-dd hh:ii:ss
blockHeight Number of blocks validated
difficulty Calculated difficulty value for validating new blocks (initial/target)
hashrate24h Network hash rate, averaged over the previous 24 hours
hashrate1h Network hash rate, averaged over the past hour
supply Total number of cruz in circulation
price_btc Average last sale price of 1 cruz
(as of 2019.08.11, solely based on qTrade exchange)
price_usd Price of 1 cruz in USD (price_btc * Coinbase BTC-USD value)
marketCap Total amount of value in circulating cruz (price_usd * supply)
marketVol Amount, in BTC, of cruz which has been traded on exchange in the past 24 hours
(as of 2019.08.11, solely based on qTrade exchange)
transactionCount Number of transactions made in the past hour
transactionVol Value, in cruzbit, of all transactions made in past hour
Protocol Endpoints

The protocol endpoints reproduce the functionality of a cruzbit client connected to the network. They accept the same input parameters and output the same JSON messages. Trhough the API, an application can "connect" to the cruzbit network without maintaining a persistent WebSockets connection.

GetBlock

The GetBlockMessage (get_block) initiates a request to download a block from a peer. If the block ID is valid, the peer will respond with a BlockMessage (block).

GET https://api.cruzb.it/get_block/{BlockID}

Accepts a BlockID via path parameter or via querystring parameter block_id. Returns BlockMessage, or an error if BlockID is invalid.

CURL Examples:

curl https://api.cruzb.it/get_block/000000000000b3753e8ea9c2fdb54f9218f6528e02e638f81c506c3b54b67282
curl https://api.cruzb.it/get_block?block_id=000000000000b3753e8ea9c2fdb54f9218f6528e02e638f81c506c3b54b67282

Returns:

{
    "type":"block",
    "body":{
        "block_id":"000000000000b3753e8ea9c2fdb54f9218f6528e02e638f81c506c3b54b67282",
        "block":{
            "header":{
                "previous":"00000000000362d36d3d41a6a973fc60312d8fd98ed4ffb487fc268f9486ae21",
                "hash_list_root":"251983b258e40f6ceba9931ed46af0d0de51342238888d19762d021fde430df7",
                "time":"1565464136",
                "target":"000000000005c8c6ba79a6f26ece7c5b8535329c2e59595ebc1a544c9f4be6bb",
                "chain_work":"00000000000000000000000000000000000000000000000002b3a2e2973e30b0",
                "nonce":"393301251526403",
                "height":"19879",
                "transaction_count":"2"
            },
            "transactions":[
                {
                    "time":"1565463042",
                    "nonce":"357175296",
                    "to":"nONcY6cmlcUCCWqzE5Mt78Vck1cZJs1u2kFUKEppjWE=",
                    "amount":"5100000000",
                    "series":"20"
                },
                {
                    "time":"1565463049",
                    "nonce":"1628389777",
                    "from":"vsiyJaIGuqnllrktuSaF5eI5Oo962jdM2FUm6tOfqnI=",
                    "to":"uKyCfMBEZGvF4bJZXJONoHcPIaSPUxFPh1uTi31ctxc=",
                    "amount":"100000000000",
                    "fee":"100000000",
                    "memo":":)",
                    "matures":null,
                    "expires":"19881",
                    "series":"20",
                    "signature":"oItAeKum1/pItd6sSu9F66jPDp8KW1uXcCAQcdc0ajNUdRfTyOYnoVynjjRfLz6f6feWMVScDT+/JGsuzO7UAg=="
                }
            ]
        }
    }
}
GetBlockByHeight

The GetBlockByHeightMessage (get_block_by_height) initiates a request to download a block from a peer. If the block height is valid, the peer will respond with a BlockMessage (block).

GET https://api.cruzb.it/get_block_by_height/{height}

Accepts a Height via path parameter or via querystring parameter height. Returns BlockMessage, or an error if block height is invalid.

CURL Examples:

curl https://api.cruzb.it/get_block_by_height/19879
curl https://api.cruzb.it/get_block_by_height?height=19879

Returns:

{
    "type":"block",
    "body":{
        "block_id":"000000000000b3753e8ea9c2fdb54f9218f6528e02e638f81c506c3b54b67282",
        "block":{
            "header":{
                "previous":"00000000000362d36d3d41a6a973fc60312d8fd98ed4ffb487fc268f9486ae21",
                "hash_list_root":"251983b258e40f6ceba9931ed46af0d0de51342238888d19762d021fde430df7",
                "time":"1565464136",
                "target":"000000000005c8c6ba79a6f26ece7c5b8535329c2e59595ebc1a544c9f4be6bb",
                "chain_work":"00000000000000000000000000000000000000000000000002b3a2e2973e30b0",
                "nonce":"393301251526403",
                "height":"19879",
                "transaction_count":"2"
            },
            "transactions":[
                {
                    "time":"1565463042",
                    "nonce":"357175296",
                    "to":"nONcY6cmlcUCCWqzE5Mt78Vck1cZJs1u2kFUKEppjWE=",
                    "amount":"5100000000",
                    "series":"20"
                },
                {
                    "time":"1565463049",
                    "nonce":"1628389777",
                    "from":"vsiyJaIGuqnllrktuSaF5eI5Oo962jdM2FUm6tOfqnI=",
                    "to":"uKyCfMBEZGvF4bJZXJONoHcPIaSPUxFPh1uTi31ctxc=",
                    "amount":"100000000000",
                    "fee":"100000000",
                    "memo":":)",
                    "matures":null,
                    "expires":"19881",
                    "series":"20",
                    "signature":"oItAeKum1/pItd6sSu9F66jPDp8KW1uXcCAQcdc0ajNUdRfTyOYnoVynjjRfLz6f6feWMVScDT+/JGsuzO7UAg=="
                }
            ]
        }
    }
}
GetBlockHeader

The GetBlockHeaderMessage (get_block_header) is used to request a block header. If the BlockID is valid, the peer will respond with a BlockHeaderMessage (block_header).

GET https://api.cruzb.it/get_block_header/{block_id}

Accepts a BlockID via path parameter or via querystring parameter block_id. Returns BlockHeaderMessage, or an error if BlockID is invalid.

CURL Examples:

curl https://api.cruzb.it/get_block_header/000000000000b3753e8ea9c2fdb54f9218f6528e02e638f81c506c3b54b67282
curl https://api.cruzb.it/get_block_header?height=000000000000b3753e8ea9c2fdb54f9218f6528e02e638f81c506c3b54b67282

Returns:

{
    "type":"block_header",
    "body":{
        "block_id":"000000000000b3753e8ea9c2fdb54f9218f6528e02e638f81c506c3b54b67282",
        "header":{
            "previous":"00000000000362d36d3d41a6a973fc60312d8fd98ed4ffb487fc268f9486ae21",
            "hash_list_root":"251983b258e40f6ceba9931ed46af0d0de51342238888d19762d021fde430df7",
            "time":"1565464136",
            "target":"000000000005c8c6ba79a6f26ece7c5b8535329c2e59595ebc1a544c9f4be6bb",
            "chain_work":"00000000000000000000000000000000000000000000000002b3a2e2973e30b0",
            "nonce":"393301251526403",
            "height":"19879",
            "transaction_count":"2"
        }
    }
}
GetBlockHeaderByHeight

The GetBlockHeaderByHeightMessage (get_block_header_by_height) is used to request a block header. If the BlockID is valid, the peer will respond with a BlockHeaderMessage (block_header).

GET https://api.cruzb.it/get_block_by_height/{height}

Accepts a BlockID via path parameter or via querystring parameter height. Returns BlockHeaderMessage, or an error if Height is invalid.

CURL Examples:

curl https://api.cruzb.it/get_block_header_by_height/19879
curl https://api.cruzb.it/get_block_header_by_height?height=19879

Returns:

{
    "type":"block_header",
    "body":{
        "block_id":"000000000000b3753e8ea9c2fdb54f9218f6528e02e638f81c506c3b54b67282",
        "header":{
            "previous":"00000000000362d36d3d41a6a973fc60312d8fd98ed4ffb487fc268f9486ae21",
            "hash_list_root":"251983b258e40f6ceba9931ed46af0d0de51342238888d19762d021fde430df7",
            "time":"1565464136",
            "target":"000000000005c8c6ba79a6f26ece7c5b8535329c2e59595ebc1a544c9f4be6bb",
            "chain_work":"00000000000000000000000000000000000000000000000002b3a2e2973e30b0",
            "nonce":"393301251526403",
            "height":"19879",
            "transaction_count":"2"
        }
    }
}

GetTransaction

The GetTransactionMessage (get_transaction) requests initiates a request to download a transaction from a peer. If the transaction ID is valid, the peer will respond with a TransactionMessage (transaction).

GET https://api.cruzb.it/get_transaction/{TransactionID}

Accepts a TransactionID via path parameter or via querystring parameter transaction_id. Returns TransactionMessage, or an error if TransactionID is invalid.

CURL Examples:

curl https://api.cruzb.it/get_transaction/aa5f65712caaa1447971ad4269a4f0582f56991c159f582b718f42fac16b99d4
curl https://api.cruzb.it/get_transaction?transaction_id=aa5f65712caaa1447971ad4269a4f0582f56991c159f582b718f42fac16b99d4

Returns:

{
    "type": "transaction",
    "body": {
        "block_id": "000000000000b3753e8ea9c2fdb54f9218f6528e02e638f81c506c3b54b67282",
        "height": "19879",
        "transaction_id": "aa5f65712caaa1447971ad4269a4f0582f56991c159f582b718f42fac16b99d4",
        "transaction": {
            "time": "1565463049",
            "nonce": "1628389777",
            "from": "vsiyJaIGuqnllrktuSaF5eI5Oo962jdM2FUm6tOfqnI=",
            "to": "uKyCfMBEZGvF4bJZXJONoHcPIaSPUxFPh1uTi31ctxc=",
            "amount": "100000000000",
            "fee": "100000000",
            "memo": ":)",
            "expires": "19881",
            "series": "20",
            "signature": "oItAeKum1/pItd6sSu9F66jPDp8KW1uXcCAQcdc0ajNUdRfTyOYnoVynjjRfLz6f6feWMVScDT+/JGsuzO7UAg=="
        }
    }
}

GetTransactionQueue

GetTransactionQueue (get_transaction_queue) requests all pending (unconfirmed) transactions that have been pushed to the network.

GET https://api.cruzb.it/get_transaction_queue

Returns a FilterTransactionQueueMessage. The body property of the returned JSON object will have a transactions property containing an array of zero or more pending Transaction entities.

Note: This function is non-standard client behavior. The is method duplicates the client's (undocumented) GetFilterTransactionQueueMessage behavior, but without performing any transaction filtering.

CURL Example:

curl https://api.cruzb.it/get_transaction_queue

Returns:

{
    "type": "filter_transaction_queue",
    "body": {
        "transactions": [
            {
                "time": 1561267196,
                "nonce": 1678096926,
                "to": "jAGxWfCImeDIqFfk8cfi3RDyQSOE2z4dNbTBG6iJ/uc=",
                "amount": 5000000000,
                "series": 2
            }
        ]
    }
}

GetTipHeader

GetTipHeader (get_tip_header) is used to request the header for the tip block in the block chain.

GET https://api.cruzb.it/get_tip_header

Returns a TipHeaderMessage.

Note: The time_seen property is not currently supported by the API. The value returned will match the tip block's time property.

CURL Example:

curl https://api.cruzb.it/get_tip_header

Returns:

{
    "type": "tip_header",
    "body": {
        "block_id": "00000000000785100ecb16d5acbe792ca61daf9fc157d4c2b251182faf5d30b0",
        "header": {
            "previous": "0000000000033c53280cbdc1742483a4635b0ebac084ce82fa2cbbd768b468f3",
            "hash_list_root": "0adf975ad85f1456286f3a5acde29bcdf600e2a6faf010d455d62f87505931fa",
            "time": 1564257595,
            "target": "000000000007a38c469f3be96898a11435ea27592c2bae351147392e9cd3408d",
            "chain_work": "00000000000000000000000000000000000000000000000000ad6ace9ad82af2",
            "nonce": 3762307550831105,
            "height": 16477,
            "transaction_count": 1
        },
        "time_seen": 1564257719
    }
}