๐ Get transaction count in block by hash
Code samples
GET /api/v1/btc/block/hash/{blockHash}/transactions/count
curl 'https://settla.net/api/v1/btc/block/hash/00000000000000000001595977e6000ce56129f5c9b4073e31ccc30b90b97da9/transactions/count' \
-H 'X-API-Key: $SETTLA_API_KEY' \
-H 'Accept: application/json'
Returns the number of transactions in a block identified by hash using getblock with verbosity 1. The cheap counterpart to /block/hash/{blockHash} โ the node is asked for transaction ids only, not full bodies. An unknown hash answers 500 with the generic connection message.
๐ ๏ธ Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| blockHash | path | string | true | Bitcoin block hash. |
Example responses
200 Response
{
"transactionCount": 216
}
500 Response
{
"error": "Could not connect to BTC node."
}
๐ Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | Number of transactions in the block | Inline |
| 500 | Internal Server Error | Node unreachable, or the hash is not a known block | 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 500
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| ยป error | string | false | none | Human-readable reason. |