> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://docs.ampdb.io/api/mcp` to find what you need.

# Bitcoin RPC Tables

Every Bitcoin RPC [raw dataset](/datasets/raw-datasets) (`"kind": "bitcoin-rpc"`) has these tables: [`blocks`](/datasets/tables/bitcoin-rpc#blocks), [`transactions`](/datasets/tables/bitcoin-rpc#transactions), [`inputs`](/datasets/tables/bitcoin-rpc#inputs), and [`outputs`](/datasets/tables/bitcoin-rpc#outputs). Query one through its dataset's name, like `SELECT * FROM "acme/bitcoin_mainnet".blocks`. Column types are [Arrow types](/datasets/manifests#data-types), and a nullable column can be `NULL`.

## `blocks`

One row per block. Amp treats a block as final once enough blocks follow it (the provider's `confirmations`, 6 by default): a dataset set to `finalized_blocks_only` only has final blocks, and others can have recent blocks that a [reorg](/get-started/concepts/reorgs) later replaces.

| Column          | Type                            | Nullable | Description                                                                                                                                                                                      |
| --------------- | ------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `_block_num`    | `UInt64`                        | No       | The number of the block the row comes from. Amp adds it to every raw table, and uses it to order the data, split it into files, and track which blocks it has.                                   |
| `_ts`           | `Timestamp(Nanosecond, +00:00)` | No       | The time of the block the row comes from, in UTC. Amp adds it to the tables of chains that timestamp their blocks.                                                                               |
| `block_num`     | `UInt64`                        | No       | The block's height: its position in the chain, counting from 0 at the first block (the genesis block).                                                                                           |
| `timestamp`     | `Timestamp(Nanosecond, +00:00)` | No       | The time the miner put in the block, to the second. Miners set it, so it's approximate, and can be earlier than the previous block's.                                                            |
| `hash`          | `FixedSizeBinary(32)`           | No       | The block's hash, which identifies it, as 32 raw bytes. Like the other hashes in these tables, the bytes are in the order block explorers show, so their hex encoding is the hash you see there. |
| `parent_hash`   | `FixedSizeBinary(32)`           | Yes      | The `hash` of the previous block. `NULL` only for the genesis block, which has none.                                                                                                             |
| `merkle_root`   | `FixedSizeBinary(32)`           | No       | A hash of all the block's transactions together (the root of their Merkle tree).                                                                                                                 |
| `nonce`         | `UInt32`                        | No       | The number the miner changed until the block's hash met the target in `bits`.                                                                                                                    |
| `bits`          | `UInt32`                        | No       | The target the block's hash had to be below, in compact form. In hex, it's the `bits` value Bitcoin nodes show, like `1d00ffff`.                                                                 |
| `difficulty`    | `Float64`                       | No       | How hard the block was to mine, as a multiple of the lowest difficulty Bitcoin allows.                                                                                                           |
| `version`       | `Int32`                         | No       | The block's version, which miners also use to signal support for changes to Bitcoin's rules.                                                                                                     |
| `size`          | `UInt32`                        | No       | The block's size in bytes, including witness data (the signatures that SegWit transactions keep apart from the rest).                                                                            |
| `stripped_size` | `UInt32`                        | No       | The block's size in bytes without witness data.                                                                                                                                                  |
| `weight`        | `UInt32`                        | No       | The block's weight, the measure Bitcoin limits blocks by (at most 4,000,000 weight units): `stripped_size` times 3, plus `size`.                                                                 |
| `tx_count`      | `UInt32`                        | No       | The number of transactions in the block, including the coinbase transaction, the first one, which pays the miner.                                                                                |
| `median_time`   | `Timestamp(Nanosecond, +00:00)` | No       | The median `timestamp` of the last 11 blocks, up to and including this one. Unlike `timestamp`, it never goes back, so Bitcoin uses it for time locks.                                           |

## `transactions`

One row per transaction, including each block's coinbase transaction. Its inputs and outputs are in the `inputs` and `outputs` tables.

| Column        | Type                            | Nullable | Description                                                                                                                                                                                                            |
| ------------- | ------------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `_block_num`  | `UInt64`                        | No       | The number of the block the row comes from. Amp adds it to every raw table, and uses it to order the data, split it into files, and track which blocks it has.                                                         |
| `_ts`         | `Timestamp(Nanosecond, +00:00)` | No       | The time of the block the row comes from, in UTC. Amp adds it to the tables of chains that timestamp their blocks.                                                                                                     |
| `block_num`   | `UInt64`                        | No       | The height of the block the row comes from: its position in the chain, counting from 0.                                                                                                                                |
| `timestamp`   | `Timestamp(Nanosecond, +00:00)` | No       | The time of the block the row comes from, as its miner set it (see `blocks.timestamp`).                                                                                                                                |
| `block_hash`  | `FixedSizeBinary(32)`           | No       | The hash of the block the row comes from, as raw bytes. It matches `blocks.hash`.                                                                                                                                      |
| `tx_index`    | `UInt32`                        | No       | The position of the transaction in its block, counting from 0. The coinbase transaction is always first.                                                                                                               |
| `txid`        | `FixedSizeBinary(32)`           | No       | The transaction's ID, as 32 raw bytes in the order explorers and wallets show it. It leaves out witness data.                                                                                                          |
| `hash`        | `FixedSizeBinary(32)`           | No       | The transaction's hash including witness data (its wtxid). The same as `txid` for transactions without witness data.                                                                                                   |
| `version`     | `UInt32`                        | No       | The transaction's version, which turns on features like relative time locks (version 2 and up, see `inputs.sequence`).                                                                                                 |
| `size`        | `UInt32`                        | No       | The transaction's size in bytes, including witness data.                                                                                                                                                               |
| `vsize`       | `UInt32`                        | No       | The transaction's virtual size, `weight` divided by 4 and rounded up. Fee rates are quoted per virtual byte (vbyte).                                                                                                   |
| `weight`      | `UInt32`                        | No       | The transaction's size without witness data times 3, plus `size`, in weight units.                                                                                                                                     |
| `locktime`    | `UInt32`                        | No       | The block height (below 500,000,000) or Unix time in seconds (from 500,000,000) after which the transaction can be in a block. `0` means anytime, and so does any value when every input's `sequence` is `4294967295`. |
| `is_coinbase` | `Boolean`                       | No       | Whether this is the block's coinbase transaction, which pays the miner the block's new bitcoin and fees.                                                                                                               |

## `inputs`

One row per transaction input: an earlier output the transaction spends or, for a coinbase transaction, the new bitcoin it creates. For an input's amount and address, join `outputs` on `spent_txid = outputs.txid` and `spent_vout = outputs.output_index`.

| Column        | Type                            | Nullable | Description                                                                                                                                                                                                        |
| ------------- | ------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `_block_num`  | `UInt64`                        | No       | The number of the block the row comes from. Amp adds it to every raw table, and uses it to order the data, split it into files, and track which blocks it has.                                                     |
| `_ts`         | `Timestamp(Nanosecond, +00:00)` | No       | The time of the block the row comes from, in UTC. Amp adds it to the tables of chains that timestamp their blocks.                                                                                                 |
| `block_num`   | `UInt64`                        | No       | The height of the block the row comes from: its position in the chain, counting from 0.                                                                                                                            |
| `timestamp`   | `Timestamp(Nanosecond, +00:00)` | No       | The time of the block the row comes from, as its miner set it (see `blocks.timestamp`).                                                                                                                            |
| `block_hash`  | `FixedSizeBinary(32)`           | No       | The hash of the block the row comes from, as raw bytes. It matches `blocks.hash`.                                                                                                                                  |
| `tx_index`    | `UInt32`                        | No       | The position in its block of the transaction the row belongs to, counting from 0.                                                                                                                                  |
| `txid`        | `FixedSizeBinary(32)`           | No       | The ID of the transaction the row belongs to, as raw bytes. It matches `transactions.txid`.                                                                                                                        |
| `input_index` | `UInt32`                        | No       | The input's position in its transaction, counting from 0.                                                                                                                                                          |
| `spent_txid`  | `FixedSizeBinary(32)`           | Yes      | The ID of the transaction whose output this input spends (`outputs.txid`). `NULL` for a coinbase input.                                                                                                            |
| `spent_vout`  | `UInt32`                        | Yes      | The position of the spent output in that transaction (`outputs.output_index`). `NULL` for a coinbase input.                                                                                                        |
| `coinbase`    | `Binary`                        | Yes      | For a coinbase input, the data its miner put in it, as raw bytes. `NULL` for other inputs, which spend an output.                                                                                                  |
| `script_sig`  | `Binary`                        | No       | The unlocking script that proves the right to spend the output, as raw bytes. Empty for a coinbase input and for inputs that keep that proof in `witness` instead.                                                 |
| `sequence`    | `UInt32`                        | No       | The input's sequence number, which can turn on the transaction's `locktime`, signal that a version with a higher fee may replace it, or set how old the spent output must be. `4294967295` turns all of these off. |
| `witness`     | `List(Binary)`                  | Yes      | The input's witness data, the signatures and other items that SegWit inputs keep apart from `script_sig`, as a list of raw byte strings. `NULL` for inputs without any.                                            |

## `outputs`

One row per transaction output: an amount of bitcoin and the conditions to spend it. A later transaction spends it with an input whose `spent_txid` and `spent_vout` point to it.

| Column                  | Type                            | Nullable | Description                                                                                                                                                                                           |
| ----------------------- | ------------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `_block_num`            | `UInt64`                        | No       | The number of the block the row comes from. Amp adds it to every raw table, and uses it to order the data, split it into files, and track which blocks it has.                                        |
| `_ts`                   | `Timestamp(Nanosecond, +00:00)` | No       | The time of the block the row comes from, in UTC. Amp adds it to the tables of chains that timestamp their blocks.                                                                                    |
| `block_num`             | `UInt64`                        | No       | The height of the block the row comes from: its position in the chain, counting from 0.                                                                                                               |
| `timestamp`             | `Timestamp(Nanosecond, +00:00)` | No       | The time of the block the row comes from, as its miner set it (see `blocks.timestamp`).                                                                                                               |
| `block_hash`            | `FixedSizeBinary(32)`           | No       | The hash of the block the row comes from, as raw bytes. It matches `blocks.hash`.                                                                                                                     |
| `tx_index`              | `UInt32`                        | No       | The position in its block of the transaction the row belongs to, counting from 0.                                                                                                                     |
| `txid`                  | `FixedSizeBinary(32)`           | No       | The ID of the transaction the row belongs to, as raw bytes. It matches `transactions.txid`.                                                                                                           |
| `output_index`          | `UInt32`                        | No       | The output's position in its transaction, counting from 0.                                                                                                                                            |
| `value_sat`             | `Int64`                         | No       | The amount, in satoshis, the smallest unit of bitcoin (1 BTC is 100,000,000 satoshis).                                                                                                                |
| `script_pubkey`         | `Binary`                        | No       | The locking script, the conditions to spend the output, as raw bytes.                                                                                                                                 |
| `script_pubkey_type`    | `Utf8`                          | No       | The kind of locking script, as Bitcoin nodes name it, like `pubkeyhash`, `scripthash`, `witness_v0_keyhash`, `witness_v1_taproot`, or `nulldata` (an output that can't be spent, which carries data). |
| `script_pubkey_address` | `Utf8`                          | Yes      | The address the output pays to, like `bc1q…` on mainnet. `NULL` when the script has no address, as for `nulldata` and `nonstandard` outputs.                                                          |
