Block Operations
Get Block
Get a block object given a block ID or block height.
Request:
requestTypeisgetBlockblockis the block ID (optional)heightis the block height (optional ifblockprovided)timestampis the timestamp (in seconds since the genesis block) of the block (optional ifheightprovided)includeTransactionsistrueto include transaction details (optional)includeExecutedPhasedistrueto include approved and executed phased transactions (optional)requireBlockis the block ID of a block that must be present in the blockchain during execution (optional)requireLastBlockis 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 (ifincludeTransactionsprovided, refer to Get Transaction for details)executedPhasedTransactions(A) is an array of transaction IDs or transaction objects (ifincludeExecutedPhasedprovided, 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 ifrequireBlockis 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:
requestTypeisgetBlockIdheightis the block heightrequireBlockis the block ID of a block that must be present in the blockchain during execution (optional)requireLastBlockis 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 ifrequireBlockis 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:
requestTypeisgetBlockstimestampis the earliest block (in seconds since the genesis block) to retrieve (optional)firstIndexis first block to retrieve (optional, default is zero or the last block on the blockchain)lastIndexis the last block to retrieve (optional, default isfirstIndex+ 99)includeTransactionsistrueto include transaction details (optional)includeExecutedPhasedistrueto include approved and executed phased transactions (optional)requireBlockis the block ID of a block that must be present in the blockchain during execution (optional)requireLastBlockis 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 ifrequireBlockis 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:
requestTypeisgetECBlocktimestampis the timestamp (in seconds since the genesis block) of the EC block (optional, default (or zero) is the current timestamp)requireBlockis the block ID of a block that must be present in the blockchain during execution (optional)requireLastBlockis 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 ifrequireBlockis provided but notrequireLastBlock)requestProcessingTime(N) is the API request processing time (in millisec)
Example: Refer to Get EC Block example.