> For the complete documentation index, see [llms.txt](/llms.txt).

# `getblock`

Returns a block by hash. This method uses [80 credits](/get-started/pricing/) from your daily balance.

Call [getblockhash](/reference/bitcoin/json-rpc-methods/getblockhash/) to get the hash of a block at a given height.

## Parameters[​](#parameters "Direct link to Parameters")

- `blockhash`: (string) _[required]_ - Hex-encoded block hash.
- `verbosity`: (integer) _[optional]_ - Level of detail in the response. The default is `1`.  
  - `0` - Returns the serialized block as a hex-encoded string.
  - `1` - Returns a block object with transaction IDs.
  - `2` - Returns a block object with decoded transactions. See [getrawtransaction](/reference/bitcoin/json-rpc-methods/getrawtransaction/) for the transaction fields. Each transaction also includes `fee`, in BTC, when undo data is available.
  - `3` - Same as `2`, and each input also includes `prevout` with the spent output's `generated`, `height`, `value`, and `scriptPubKey`.

## Returns[​](#returns "Direct link to Returns")

`result`: (string or object) - The hex-encoded block when `verbosity` is `0`. Otherwise, a block object:

- `hash`: (string) - Block hash.
- `confirmations`: (integer) - Number of confirmations, or `-1` if the block isn't on the main chain.
- `height`: (integer) - Block height.
- `version`: (integer) - Block version.
- `versionHex`: (string) - Block version, as a hex string.
- `merkleroot`: (string) - Merkle root of the block's transactions.
- `tx`: (array) - Transaction IDs when `verbosity` is `1`, or transaction objects when `verbosity` is `2` or `3`.
- `time`: (integer) - Block timestamp, in Unix epoch seconds.
- `mediantime`: (integer) - Median timestamp of the previous 11 blocks, in Unix epoch seconds.
- `nonce`: (integer) - Proof-of-work nonce.
- `bits`: (string) - Compact encoding of the proof-of-work target.
- `target`: (string) - Proof-of-work target, as a hex string.
- `difficulty`: (number) - Proof-of-work difficulty.
- `chainwork`: (string) - Expected number of hashes required to produce the chain up to this block, as a hex string.
- `nTx`: (integer) - Number of transactions in the block.
- `previousblockhash`: (string) _[optional]_ - Hash of the previous block. Absent for the genesis block.
- `nextblockhash`: (string) _[optional]_ - Hash of the next block. Absent for the chain tip.
- `strippedsize`: (integer) - Block size in bytes, excluding witness data.
- `size`: (integer) - Block size in bytes, including witness data.
- `weight`: (integer) - Block weight, as defined in BIP 141.

### Request[​](#request "Direct link to Request")

- curl

```
curl https://bitcoin-mainnet.infura.io/v3/<YOUR-API-KEY> \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc": "2.0", "id": 1, "method": "getblock", "params": ["00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048", 1]}'

```

### Response[​](#response "Direct link to Response")

- JSON

```
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "hash": "00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048",
    "confirmations": 971402,
    "height": 1,
    "version": 1,
    "versionHex": "00000001",
    "merkleroot": "0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098",
    "time": 1231469665,
    "mediantime": 1231469665,
    "nonce": 2573394689,
    "bits": "1d00ffff",
    "target": "00000000ffff0000000000000000000000000000000000000000000000000000",
    "difficulty": 1,
    "chainwork": "0000000000000000000000000000000000000000000000000000000200020002",
    "nTx": 1,
    "previousblockhash": "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f",
    "nextblockhash": "000000006a625f06636b8bb6ac7b960a8d03705d1ace08b1a19da3fdcc99ddbd",
    "strippedsize": 215,
    "size": 215,
    "weight": 860,
    "tx": [
      "0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098"
    ]
  }
}

```
