π Get latest Bitcoin block
Code samples
GET /api/v1/btc/block/last
Returns the most recent block from the Bitcoin blockchain using getbestblockhash followed by getblock with verbosity 2.
Example responses
200 Response
{
"hash": "string",
"confirmations": 0,
"height": 0,
"version": 0,
"versionHex": "string",
"merkleroot": "string",
"time": 0,
"mediantime": 0,
"nonce": 0,
"bits": "string",
"difficulty": 0.1,
"chainwork": "string",
"nTx": 0,
"strippedsize": 0,
"size": 0,
"weight": 0,
"previousblockhash": "string",
"nextblockhash": "string",
"tx": [
"string"
]
}
π Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | Latest Bitcoin block | Inline |
| 500 | Internal Server Error | Could not connect to BTC node | None |
π Response Schema
Status Code 200
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| Β» hash | string | false | none | Hash of the block. |
| Β» confirmations | integer(int64) | false | none | Number of confirmations for the block. |
| Β» height | integer(int64) | false | none | Block height. |
| Β» version | integer | false | none | Block version. |
| Β» versionHex | string | false | none | none |
| Β» merkleroot | string | false | none | Merkle root of the block's transactions. |
| Β» time | integer(int64) | false | none | Block time in seconds since Unix epoch. |
| Β» mediantime | integer(int64) | false | none | none |
| Β» nonce | integer(int64) | false | none | none |
| Β» bits | string | false | none | none |
| Β» difficulty | number(double) | false | none | none |
| Β» chainwork | string | false | none | none |
| Β» nTx | integer(int64) | false | none | Number of transactions in the block. |
| Β» strippedsize | integer(int64) | false | none | none |
| Β» size | integer(int64) | false | none | none |
| Β» weight | integer(int64) | false | none | none |
| » previousblockhash | string¦null | false | none | none |
| » nextblockhash | string¦null | false | none | none |
| Β» tx | array | false | none | Transactions included in the block. When verbosity=2, this is an array of full transaction objects; otherwise it may be an array of transaction IDs. |