๐ Get Bitcoin block by height
Code samples
GET /api/v1/btc/block/{blockNumber}
Returns a specific block by its height using getblockhash followed by getblock with verbosity 2.
๐ ๏ธ Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| blockNumber | path | integer(int64) | true | Block height in the best chain (non-negative integer). |
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 | Bitcoin block | BtcBlock |
| 400 | Bad Request | Invalid block number (negative) | Inline |
| 500 | Internal Server Error | Could not connect to BTC node | None |
๐ Response Schema
Status Code 400
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| ยป error | string | false | none | none |