Blocks#
- class defichain.ocean.Blocks(ocean)#
- list(size: int = 30, next: str | None = None) {} #
Returns a list of blocks
- Parameters:
size (int) – (optional) size to query
next ((optional) str) – next token for next slice of blocks
- Returns:
(json string) {id: str, hash: str, previousHash: str, height: int, version: int, time: int, medianTime: int, transactionCount: int, difficulty: float, masternode: str, minter: str, minterBlockCount: int, reward: str, stakeModifier: str, merkleroot: str, size: int, sizeStripped: int, weight: int}
- Example:
>>> ocean.blocks.list()
- get(id: str) {} #
Returns the specified block
- Parameters:
id (str) – (required) id as hash or height of the block
- Returns:
(json string) {id: str, hash: str, previousHash: str, height: int, version: int, time: int, medianTime: int, transactionCount: int, difficulty: float, masternode: str, minter: str, minterBlockCount: int, reward: str, stakeModifier: str, merkleroot: str, size: int, sizeStripped: int, weight: int}
- Example:
>>> ocean.blocks.get(0)
- getTransactions(hash: str, size: int = 30, next: str | None = None) {} #
Gets all transactions within a block
- Parameters:
hash (str) – (required) hash of the block
size (int) – (optional) size to query
next (str) – (optional) next token for next slice of blocks
- Returns:
(json string) {id: str, order: int, block: {hash: str, height: int, time: int, medianTime: int}, txid: str, hash: str, version: int, size: int, vSize: int, weight: int, lockTime: int, vinCount: int, voutCount: int, totalVoutValue: str}
- Example:
>>> ocean.blocks.getTransactions("e5b266f18db7662628ea503eb9f889197f05660981f22c07b1b3b86f14329099")