getBlock

Gets the block specified by hash or block index.

Parameters

1. hashOrIndex (required)

UInt256 | number

Pass either a block hash or a block index.

Returns

Promise<Block>

type Block = {
  hash: UInt256;
  size: number;
  confirmations: number;
  nextBlockHash?: UInt256;
  version: number;
  previousBlockHash: UInt256;
  merkleRoot: UInt256;
  time: number;
  nonce: HexString;
  index: number;
  primary: number;
  nextConsensus: UInt160;
  tx: Transaction[];
};

Errors

Code
Name
Description

10002

INVALID

The block hash or index is invalid.

10003

NOTFOUND

The block does not exist.

10008

RPC_ERROR

The RPC server returned an error.

Example

Request

Response

最后更新于