getBlocks
Retrieves a list of blocks by height range. Blocks with timestamps before the optional timestamp parameter are excluded.
Endpoint
GET /nxt?requestType=getBlocks
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
firstIndex | int | No | 0 | First block index to retrieve (inclusive) |
lastIndex | int | No | 100 | Last block index to retrieve (inclusive) |
timestamp | int | No | 0 | Filter: only include blocks with timestamps >= this value |
includeTransactions | boolean | No | false | Whether to include full transaction objects instead of just IDs |
includeExecutedPhased | boolean | No | false | Whether to include executed phased transaction data |
Request Example
curl "http://localhost:22024/nxt?requestType=getBlocks&firstIndex=0&lastIndex=10&includeTransactions=true"
Response
{
"blocks": [
{
"block": "12345678901234567890",
"height": 1000000,
"generator": "1234567890",
"generatorPublicKey": "hexPublicKey",
"timestamp": 123456789,
"numberOfTransactions": 10,
"totalFeeFQT": "100000000",
"version": 1,
"baseTarget": "1234567890",
"cumulativeDifficulty": "123456789012345678901234567890",
"previousBlock": "98765432109876543210",
"payloadHash": "hexPayloadHash",
"generationSignature": "hexGenerationSignature",
"previousBlockHash": "hexPreviousBlockHash",
"blockSignature": "hexBlockSignature",
"transactions": [],
"requestProcessingTime": 5
}
],
"requestProcessingTime": 10
}
Response Fields
| Field | Type | Description |
|---|---|---|
blocks | array | Array of block objects (see Get Block for block fields) |
requestProcessingTime | number | API request processing time in milliseconds |
Source
GetBlocks.java, JSONData.block()
Tags
BLOCKS