Block Operations
Get Block
Get a block object given a block ID or block height.
Request:
requestType
isgetBlock
block
is the block ID (optional)height
is the block height (optional ifblock
provided)timestamp
is the timestamp (in seconds since the genesis block) of the block (optional ifheight
provided)includeTransactions
istrue
to include transaction details (optional)includeExecutedPhased
istrue
to include approved and executed phased transactions (optional)requireBlock
is the block ID of a block that must be present in the blockchain during execution (optional)requireLastBlock
is the block ID of a block that must be last in the blockchain during execution (optional)
Note: block
overrides height
which overrides timestamp
.
Response:
previousBlockHash
(S) is the 32-byte hash of the previous blockpayloadLength
(N) is the length (in bytes) of all transactions included in the blocktotalAmountNQT
(S) is the total amount (in NQT) of the transactions in the blockgenerationSignature
(S) is the 32-byte generation signature of the generating accountgenerator
(S) is the generating account numbergeneratorPublicKey
(S) is the 32-byte public key of the generating accountbaseTarget
(S) is the base target for the next block generationpayloadHash
(S) is the 32-byte hash of the payload (all transactions)generatorRS
(S) is the Reed-Solomon address of the generating accountnextBlock
(S) is the next block IDnumberOfTransactions
(N) is the number of transactions in the blockblockSignature
(S) is the 64-byte block signaturetransactions
(A) is an array of transaction IDs or transaction objects (ifincludeTransactions
provided, refer to Get Transaction for details)executedPhasedTransactions
(A) is an array of transaction IDs or transaction objects (ifincludeExecutedPhased
provided, refer to Get Transaction for details)version
(N) is the block versiontotalFeeNQT
(S) is the total fee (in NQT) of the transactions in the blockpreviousBlock
(S) is the previous block IDcumulativeDifficulty
(S) is the cumulative difficulty for the next block generationblock
(S) is the block IDheight
(N) is the zero-based block heighttimestamp
(N) is the timestamp (in seconds since the genesis block) of the blocklastBlock
(S) is the last block ID on the blockchain (applies ifrequireBlock
is provided but notrequireLastBlock
)requestProcessingTime
(N) is the API request processing time (in millisec)
Example: Refer to Get Block example.
Get Block Id
Get a block ID given a block height.
Request:
requestType
isgetBlockId
height
is the block heightrequireBlock
is the block ID of a block that must be present in the blockchain during execution (optional)requireLastBlock
is the block ID of a block that must be last in the blockchain during execution (optional)
Response:
block
(S) is the block IDlastBlock
(S) is the last block ID on the blockchain (applies ifrequireBlock
is provided but notrequireLastBlock
)requestProcessingTime
(N) is the API request processing time (in millisec)
Example: Refer to Get Block Id example.
Get Blocks
Get blocks from the blockchain in reverse block height order.
Request:
requestType
isgetBlocks
timestamp
is the earliest block (in seconds since the genesis block) to retrieve (optional)firstIndex
is first block to retrieve (optional, default is zero or the last block on the blockchain)lastIndex
is the last block to retrieve (optional, default isfirstIndex
+ 99)includeTransactions
istrue
to include transaction details (optional)includeExecutedPhased
istrue
to include approved and executed phased transactions (optional)requireBlock
is the block ID of a block that must be present in the blockchain during execution (optional)requireLastBlock
is the block ID of a block that must be last in the blockchain during execution (optional)
Response:
blocks
(A) is an array of blocks retrieved (refer to Get Block for details)lastBlock
(S) is the last block ID on the blockchain (applies ifrequireBlock
is provided but notrequireLastBlock
)requestProcessingTime
(N) is the API request processing time (in millisec)
Example: Refer to Get Blocks example.
Get EC Block
Get Economic Cluster block data.
Request:
requestType
isgetECBlock
timestamp
is the timestamp (in seconds since the genesis block) of the EC block (optional, default (or zero) is the current timestamp)requireBlock
is the block ID of a block that must be present in the blockchain during execution (optional)requireLastBlock
is the block ID of a block that must be last in the blockchain during execution (optional)
Note: If timestamp
is more than 15 seconds before the timestamp of the last block on the blockchain, errorCode
4 is returned.
Response:
ecBlockHeight
(N) is the EC block heightecBlockId
(S) is the EC block IDtimestamp
(N) is the timestamp (in seconds since the genesis block) of the EC blocklastBlock
(S) is the last block ID on the blockchain (applies ifrequireBlock
is provided but notrequireLastBlock
)requestProcessingTime
(N) is the API request processing time (in millisec)
Example: Refer to Get EC Block example.