# 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>`

```ts
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

```js
const block = await provider.getBlock(1);
```

### Response

```js
{
  hash: '0x577ee5cf7c589f608937287f11da965c0462a8fae77f29959c834cbce38cacac',
  size: 697,
  version: 0,
  previousblockhash: '0x9d3276785e7306daf59a3f3b9e31912c095598bbfb8a4476b821b0e59be4c57a',
  merkleroot: '0x0000000000000000000000000000000000000000000000000000000000000000',
  time: 1650637687704,
  nonce: '220F1C0AE004D552',
  index: 1,
  primary: 0,
  nextconsensus: 'NZHf1NJvz1tvELGLWZjhpb3NqZJFFUYpxT',
  witnesses: [
    {
      invocation: 'DECKcAUgm3Wr/U4aw52mVqheobvslZNtdyi8vac2zPVfCyvXLVZzkxe4ZqLF6qT01xX3efMU8eP5a8X7Ee8ilhXpDED+/dpsuuck9zkp7EF3vvADzXX6UQisEKPDpFFTsDrBfTpFN+O7+PKZEstHzFkTDnhggPiXAs6RNpTCRlpX+bGFDEDI4wMpE94KTKEuozDVOxbp7izVB2bpHJoPp30J3ednoXooVQTLRdYa7jMakNdG5lgAcEAUYjQnvosCFsTQHXBwDEDp6V6z1aLR45CteSCyTF0/hT4rrzqKw52FBGXIz6OtFH9bDdpfd2+sSYCRiBTI9roze0EZbZOsjyDD8IQTA+jbDECRQHx7dVyHA8nXXaZjJocSNVSPVDRNAdZHEXy+zftVSdNL50ogbybxqEXg2SNjqOsreCnyS5B+xCNIDofcrCJd',
      verification: 'FQwhAwCbdUDhDyVi5f2PrJ6uwlFmpYsm5BI0j/WoaSe/rCKiDCEDAgXpzvrqWh38WAryDI1aokaLsBSPGl5GBfxiLIDmBLoMIQIUuvDO6jpm8X5+HoOeol/YvtbNgua7bmglAYkGX0T/AQwhAj6bMuqJuU0GbmSbEk/VDjlu6RNp6OKmrhsRwXDQIiVtDCEDQI3NQWOW9keDrFh+oeFZPFfZ/qiAyKahkg6SollHeAYMIQKng0vpsy4pgdFXy1u9OstCz9EepcOxAiTXpE6YxZEPGwwhAroscPWZbzV6QxmHBYWfriz+oT4RcpYoAHcrPViKnUq9F0Ge0Nw6'
    }
  ],
  tx: [],
  confirmations: 15099845,
  nextblockhash: '0xc77f88ea63c593a045e74ad041d7d343ec91eacc1a5ed2cc7447b60ed4bde1ed'
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://tutorial.neoline.io/reference/neo3-provider-api/getblock.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
