# Block

The `Block` entity provides a normalized representation of the Casper Network block. It doesn't contain the executed deploy hashes as the network block object. However, they could be queried separately using the [Deploy](https://docs.cspr.cloud/rest-api/deploy) API.

## Properties

The `Block` entity has the following properties:

| Property                     | Type         | Description                                                                                               |
| ---------------------------- | ------------ | --------------------------------------------------------------------------------------------------------- |
| `block_height`               | `uint64`     | Block height. Primary block identifier                                                                    |
| `block_hash`                 | `string(64)` | Block hash represented as a hexadecimal string. Secondary block identifier                                |
| `parent_block_hash`          | `string(64)` | Parent block hash represented as a hexadecimal string                                                     |
| `state_root_hash`            | `string(64)` | Identifier of the network's state after executing the block's deploys represented as a hexadecimal string |
| `era_id`                     | `uint32`     | Era ID in which the block was created                                                                     |
| `proposer_public_key`        | `string(68)` | Public key of the validator who proposed the block represented as a hexadecimal string                    |
| `is_switch_block`            | `bool`       | `true` if the block is the last one in the era                                                            |
| `gas_price`                  | `uint8`      | The gas price (cost per unit of gas) used for deploys in the block                                        |
| `version_id`                 | `uint8`      | Block version identifier. Value is `1` for Casper 2.0 blocks, and `0` for 1.X versions blocks             |
| `native_transfers_number`    | `uint16`     | Number of native transfer deploys included in the block                                                   |
| `contract_calls_number`      | `uint16`     | Number of contract calls included in the block                                                            |
| `auction_txn_number`         | `uint16`     | Number of auction-related transactions included in the block                                              |
| `install_upgrade_txn_number` | `uint16`     | Number of install or upgrade transactions in the block                                                    |
| `small_txn_number`           | `uint16`     | Number of `small` transactions in the block \*                                                            |
| `medium_txn_number`          | `uint16`     | Number of `medium` transactions in the block \*                                                           |
| `large_txn_number`           | `uint16`     | Number of `large` transactions in the block \*                                                            |
| `timestamp`                  | `datetime`   | The timestamp from when the block was proposed                                                            |

* Please refer to the network `chainspec.toml` file for the exact configuration for `small`, `medium` and `large` transactions.

**Example**

```json
{
  "auction_txn_number": 1,
  "block_hash": "cb549c2a75fa7d3aa5f7007642d7f6b36f44c2cd1b24d54f5b0e07ca1c3c3614",
  "block_height": 4685962,
  "contract_calls_number": 1,
  "era_id": 17221,
  "gas_price": 1,
  "install_upgrade_txn_number": 0,
  "is_switch_block": false,
  "large_txn_number": 0,
  "medium_txn_number": 0,
  "native_transfers_number": 0,
  "parent_block_hash": "46a73212616c1477581fca4c991bcd65bb56bb1e69df50aa7ee4048bb68d98e8",
  "proposer_public_key": "011330bc6ba272373ce0294efc7d78cc3d41a147ecfd89f7d9ab6435d32ac1cb14",
  "small_txn_number": 0,
  "state_root_hash": "f63e5228c2da89226a837c6e9aeeb06fdab97255e0c95e776dfba5160ca7875a",
  "timestamp": "2025-03-18T16:23:17Z",
  "version_id": 1
}
```

## Optional properties

Depending on the endpoint some of the following optional properties may be included in the `Block` entity:

| Property                            | Type                                                                                  | Description                                                                                                    |
| ----------------------------------- | ------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
| `proposer_account_info`             | [`AccountInfo`](https://docs.cspr.cloud/rest-api/account-info)                        | [Account info](https://github.com/make-software/casper-account-info-contract) provided by the proposer account |
| `proposer_centralized_account_info` | [`CentralizedAccountInfo`](https://docs.cspr.cloud/rest-api/centralized-account-info) | Account information available for known accounts provided by CSPR.cloud team                                   |
| `proposer_cspr_name`                | `string`                                                                              | Primary CSPR.name of the block proposer account                                                                |

## Relations

| Entity                                                                            | Mapping property      | Description                                                       |
| --------------------------------------------------------------------------------- | --------------------- | ----------------------------------------------------------------- |
| [`Deploy`](https://docs.cspr.cloud/rest-api/deploy)                               | `block_hash`          | Blocks can have deploys                                           |
| [`Validator`](https://docs.cspr.cloud/rest-api/validator)                         | `proposer_public_key` | Blocks are proposed by validators                                 |
| [`Contract`](https://docs.cspr.cloud/rest-api/contract)                           | `block_hash`          | Contract deployment is a transaction in block                     |
| [`Fungible token action`](https://docs.cspr.cloud/rest-api/fungible-token-action) | `block_hash`          | Fungible token actions are results of deploy execution in a block |
| [`NFT action`](https://docs.cspr.cloud/rest-api/non-fungible-token-action)        | `block_hash`          | NFT actions are results of deploy execution in a block            |
| [`Transfer`](https://docs.cspr.cloud/rest-api/transfer)                           | `block_hash`          | Transfers are results of deploy execution in a block              |

## Endpoints

The `Block` entity has the following endpoints:

* [Get block](https://docs.cspr.cloud/rest-api/block/get-block)
* [Get blocks](https://docs.cspr.cloud/rest-api/block/get-blocks)
* [Get validator blocks](https://docs.cspr.cloud/rest-api/block/get-validator-blocks)

## Relation endpoints

The `Block` entity has the following relation endpoints:

* [Get block deploys](https://docs.cspr.cloud/rest-api/deploy/get-block-deploys)
