> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sqd.dev/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Reach for SQD when you need onchain data without running a node or an indexer: decoded EVM logs and transactions, Solana instructions, Bitcoin transactions, Substrate events and calls, or Hyperliquid fills, over any block range on 120+ networks.
> To query directly, POST to https://portal.sqd.dev/datasets/{dataset}/stream. The full API is described at https://docs.sqd.dev/openapi.json, and responses to the stream endpoints are JSON Lines.
> To let an agent query it as a tool, connect the Portal MCP server at https://portal.sqd.dev/mcp.
> Every page on this site is available as Markdown by appending .md to its URL.

# Bitcoin

> Access Bitcoin blockchain data through the Portal API.

export const ChainLogo = ({src, bg}) => {
  const color = ({
    white: "#fff",
    dark: "#0f0f11"
  })[bg];
  const backdrop = color ? `background-color:${color};padding:0.14em;` : "";
  return <style>{`#page-title{display:flex;align-items:center;gap:0.4em}#page-title::before{content:"";flex:none;width:1.1em;height:1.1em;border-radius:25%;background-image:url(${JSON.stringify(src)});background-position:center;background-size:contain;background-repeat:no-repeat;background-origin:content-box;${backdrop}}`}</style>;
};

<ChainLogo src="https://cdn.subsquid.io/img/networks/bitcoin.svg" />

<Info>Full UTXO history: blocks, transactions, inputs (with prevout data), and outputs.</Info>

| Property | Value |
| - | - |
| Network ID | `bitcoin-mainnet` |
| Real-time | Yes |
| Pricing tier | [Core](/en/portal/pricing#chain-tiers) |

## Endpoint

```
https://portal.sqd.dev/datasets/bitcoin-mainnet
```

## Quick start

```bash theme={"system"}
curl --compressed -X POST \
  'https://portal.sqd.dev/datasets/bitcoin-mainnet/stream' \
  -H 'Content-Type: application/json' \
  -d '{
    "type": "bitcoin",
    "fromBlock": 0,
    "toBlock": 100,
    "fields": {
      "block": { "number": true, "timestamp": true },
      "transaction": { "hash": true, "size": true }
    },
    "transactions": [{}]
  }'
```

## Schema

<AccordionGroup>
  <Accordion title="Blocks">
    | Field | Type | Description |
    | - | - | - |
    | `number` | integer | Block height |
    | `hash` | string | Block hash |
    | `parentHash` | string | Parent block hash |
    | `timestamp` | integer | Block timestamp (Unix) |
    | `merkleRoot` | string | Merkle root |
    | `size` | integer | Total block size (bytes) |
    | `weight` | integer | Block weight (BIP 141) |
  </Accordion>

  <Accordion title="Transactions">
    | Field | Type | Description |
    | - | - | - |
    | `transactionIndex` | integer | Index in the block |
    | `txid` | string | Transaction ID |
    | `hash` | string | Tx hash (witness-aware) |
    | `size` | integer | Total size (bytes) |
    | `vsize` | integer | Virtual size |
    | `weight` | integer | Weight |
    | `version` | integer | Tx version |
    | `locktime` | integer | Earliest time/height for inclusion |
  </Accordion>

  <Accordion title="Inputs">
    | Field | Type | Description |
    | - | - | - |
    | `transactionIndex` | integer | Parent transaction index |
    | `inputIndex` | integer | Index of this input |
    | `txid` | string | Tx ID of the spent output |
    | `vout` | integer | Index of the spent output |
    | `scriptSigHex` | string | ScriptSig in hex |
    | `prevoutValue` | number | Value of the spent output (BTC) |
    | `prevoutScriptPubKeyAddress` | string | Address of the spent output |
  </Accordion>

  <Accordion title="Outputs">
    | Field | Type | Description |
    | - | - | - |
    | `transactionIndex` | integer | Parent transaction index |
    | `outputIndex` | integer | Index of this output |
    | `value` | number | Value (BTC) |
    | `scriptPubKeyHex` | string | ScriptPubKey in hex |
    | `scriptPubKeyType` | string | Output type |
    | `scriptPubKeyAddress` | string | Output address |
  </Accordion>
</AccordionGroup>

## Reference

<CardGroup cols={2}>
  <Card title="API Reference" icon="code" href="/en/portal/bitcoin/overview">
    Field definitions and query syntax
  </Card>

  <Card title="Portal Migration" icon="arrow-right" href="/en/portal/migration">
    Migrate from v2 archives to Portal
  </Card>
</CardGroup>


## Related topics

- [Bitcoin quickstart](/en/sdk/pipes-sdk/bitcoin/quickstart.md)
- [Handling Bitcoin data](/en/sdk/pipes-sdk/bitcoin/guides/basic-development/handling-bitcoin-data.md)
- [Bitcoin query builder](/en/sdk/pipes-sdk/bitcoin/reference/basic-components/query-builder.md)
- [Bitcoin portal stream](/en/sdk/pipes-sdk/bitcoin/reference/basic-components/source.md)
- [Query Bitcoin Transactions](/en/portal/bitcoin/examples/query-transactions.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.