Public dataset · Economy, finance and crypto
Bitcoin Blockchain (crypto_bitcoin) in BigQuery
The full Bitcoin blockchain as four views: blocks, transactions (with nested inputs and outputs), inputs and outputs. A SELECT * on transactions scans 2.39 TiB, more than two months of free tier, while a one-month query on a few columns costs about 0.3 GiB because time filters prune partitions.
The dataset description calls it a comprehensive dataset of Bitcoin blockchain data, maintained by Google, and links to the Bitcoin Blockchain listing in BigQuery sharing (Analytics Hub). All four objects are views, so BigQuery shows no row counts or storage size for them; the sizes below are dry-run estimates of a SELECT *.
blocks has one row per block (hash, number, timestamp, timestamp_month, size, weight, transaction_count). transactions has one row per transaction with fee, input_value, output_value, is_coinbase, block_timestamp, block_timestamp_month and the nested repeated records inputs and outputs. inputs and outputs are the same data flattened to one row per input or output, with addresses and value.
Note that hash is a reserved keyword in GoogleSQL, so write it with backticks in queries (` hash `) or you get a syntax error.
Tables and sizes
| Table | Rows | Size | Full scan | Layout |
|---|---|---|---|---|
transactionsOne row per transaction with nested inputs and outputs. View: BigQuery reports no row count for views; size is the dry-run estimate for SELECT *. | View | 2.4 TiB | $14.94 | None |
inputsOne row per transaction input. View: BigQuery reports no row count for views; size is the dry-run estimate for SELECT *. | View | 1.8 TiB | $11.17 | None |
outputsOne row per transaction output. View: BigQuery reports no row count for views; size is the dry-run estimate for SELECT *. | View | 1.3 TiB | $8.03 | None |
blocksOne row per block. View: BigQuery reports no row count for views; size is the dry-run estimate for SELECT *. | View | 316 MiB | under $0.01 | None |
Example queries
Every transaction with SELECT * (very expensive)
Dry run: 2.39 TiB, about $14.94 at on-demand list price on top of using up the whole free tier. Never run this.
SELECT *
FROM `bigquery-public-data.crypto_bitcoin.transactions`;Daily transactions and fees, full history (expensive)
Three small columns, no time filter: 33.20 GiB as an upper bound.
SELECT
DATE(block_timestamp) AS day,
COUNT(*) AS transactions,
SUM(fee) AS total_fee
FROM `bigquery-public-data.crypto_bitcoin.transactions`
GROUP BY day
ORDER BY day;Daily transactions and fees for one month (cheap)
The same query restricted to April 2024 with a block_timestamp range: 337 MiB, about 100 times less. Time filters prune the underlying partitions.
SELECT
DATE(block_timestamp) AS day,
COUNT(*) AS transactions,
SUM(fee) AS total_fee
FROM `bigquery-public-data.crypto_bitcoin.transactions`
WHERE block_timestamp >= '2024-04-01'
AND block_timestamp < '2024-05-01'
GROUP BY day
ORDER BY day;Largest transactions by output value in a month
hash is a reserved word, hence the backticks.
SELECT
`hash`,
block_timestamp,
output_value
FROM `bigquery-public-data.crypto_bitcoin.transactions`
WHERE block_timestamp >= '2024-04-01'
AND block_timestamp < '2024-05-01'
ORDER BY output_value DESC
LIMIT 10;Blocks, transactions and average block size per month
The blocks view is only 316 MiB in total.
SELECT
timestamp_month,
COUNT(*) AS blocks,
SUM(transaction_count) AS transactions,
ROUND(AVG(size) / 1e6, 2) AS avg_block_mb
FROM `bigquery-public-data.crypto_bitcoin.blocks`
WHERE timestamp_month >= '2024-01-01'
GROUP BY timestamp_month
ORDER BY timestamp_month;Querying it cheaply
- Never run
SELECT *ontransactions(2.39 TiB),inputs(1.79 TiB) oroutputs(1.28 TiB). In a dry run the nestedinputsandoutputsarrays alone are 2.05 TiB of the transactions view. - Always filter on
block_timestamp(orblock_timestamp_month). In dry runs, April 2024 ontransactionscost 337 MiB with ablock_timestamprange and 449 MiB withblock_timestamp_month = '2024-04-01'(one more column read), against 33.20 GiB for the full history. - These are views, so dry runs report an upper bound (
UPPER_BOUNDaccuracy). The bytes billed can be lower but will not be higher. - Leave out
script_asmandscript_hexunless you analyse scripts: in theinputsview those two columns alone are 0.75 TiB of 1.79 TiB. - Set a maximum bytes billed on every query against this dataset.
FAQ
How much does it cost to query Bitcoin data in BigQuery?
A one-month query on a few columns of transactions scans about 0.3 to 0.5 GiB. Full-history aggregates scan tens of GiB. SELECT * on transactions scans 2.39 TiB, about $8.69 beyond the 1 TiB free tier if nothing else used it that month.
Is the crypto_bitcoin dataset free?
Google pays for storing public datasets, so you never pay storage for them. You pay only for the bytes your queries scan, billed to your own project at the on-demand rate, and the first 1 TiB scanned each month is free. See BigQuery pricing.
Why does my query fail with a syntax error near HASH?
HASH is a reserved keyword in GoogleSQL. Quote the column with backticks: ` SELECT hash FROM ... `. See unexpected keyword errors.
Why does the dataset show 0 rows and 0 bytes?
All four tables are views over Google-managed storage, and BigQuery reports no row count or size for views. Use a dry run to see how many bytes a query will scan.
Related datasets
All public datasets · BigQuery cost queries · Pricing calculator
