-
Notifications
You must be signed in to change notification settings - Fork 4
Block
Gung De Surya edited this page Jul 8, 2020
·
3 revisions
Get the detail information about the specific block by passing its ID. The block can containing some transaction or just an empty block. Also you can see some information like who created the block and the fee they got.
zoobc.Block.getBlockById(blockId);
Parameters
blockId
Return
return Promise<BlockResponse>
Example
zoobc.Block.getBlockById("7339302356952867200").then((block: BlockResponse) => {
console.log(block)
});
Result
{
block: {
id: "7339302356952867200",
blockhash: "gOFcvZtw2mU0zf7vt7Rxx30ncl6qMd7mC3PQwBMafS4=",
previousblockhash: "0pGZaRH5fhaTdQS5OLFexQoGhmFU3ogUcQkyVU4twAE=",
height: 1000,
timestamp: "1592465088",
...
},
blocksmithaccountaddress: "ZNK_ABMJHKVF_7X3EMF4M_WFESOYAW_XMZIVZZ4_LBIT2T47_JJ33HKLO_WZDBCG4H"
popchange: "-500000000"
receiptvalue: "100000000"
skippedblocksmithsList: []
totalreceipts: "2"
}
Get the detail information about the specific block by passing its block height
zoobc.Block.getBlockByHeight(height);
Parameters
-
height
- blockchain's block height
Return
return Promise<BlockResponse>
Example
zoobc.Block.getBlockByHeight(1000).then((block: BlockResponse) => {
console.log(block)
});
Get list of the blocks at once. You can limit the number of block will given. Also you can choose from which block number should the list start.
zoobc.Block.getBlocks(params);
Parameters
-
params
-BlockListParams
-
height
: the start of the block height that you looking for -
limit
: the limit of the blocks will display
-
Return
return Promise<BlocksResponse>
Example
const params: BlockListParams = [
"ZBC_RERG3XD7_GAKOZZKY_VMZP2SQE_LBP45DC6_VDFGDTFK_3BZFBQGK_JMWELLO7",
"ZBC_ABMJHKVF_7X3EMF4M_WFESOYAW_XMZIVZZ4_LBIT2T47_JJ33HKLO_WZDBCG4H"
]
zoobc.Block.getBlocks(params).then((blocks: BlocksResponse) => {
console.log(blocks)
});