๐ Get transaction count in block by height
Code samples
GET /api/v1/btc/block/{blockNumber}/transactions/count
curl 'https://settla.net/api/v1/btc/block/965000/transactions/count' \
-H 'X-API-Key: $SETTLA_API_KEY' \
-H 'Accept: application/json'
Returns the number of transactions in a block identified by height using getblockhash followed by getblock (verbosity 1). Verbosity 1 means the node returns transaction ids only, so this is the cheap way to size a block โ kilobytes instead of the megabytes /block/{blockNumber} would cost you. An unknown height answers 500 with the generic connection message.
๐ ๏ธ Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| blockNumber | path | integer(int64) | true | Block height in the best chain (non-negative integer). |
Example responses
200 Response
{
"transactionCount": 216
}
400 Response
{
"error": "Block number must be non-negative"
}
500 Response
{
"error": "Could not connect to BTC node."
}
๐ Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | Number of transactions in the block | Inline |
| 400 | Bad Request | Invalid block number (negative) | Inline |
| 500 | Internal Server Error | Node unreachable, or the height is not in the chain | Inline |
๐ Response Schema
Status Code 200
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| ยป transactionCount | integer(int64)ยฆnull | false | none | Number of transactions (nTx) in the block, or null if unavailable. |
Status Code 400
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| ยป error | string | false | none | Human-readable reason. |
Status Code 500
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| ยป error | string | false | none | Human-readable reason. |