Bitcoin
Base Tables
The Bitcoin dataset's core structure is based on four primary tables: blocks
, transactions
, and inputs
/outputs
. Each table captures essential details that collectively represent the Bitcoin blockchain's transactional data, enabling deep insights into block-level, transaction-level, and input-output dynamics. The blocks
table records metadata for each mined block, such as block height, hash, mining difficulty, and reward details, creating a foundation for chronological and structural analysis of the blockchain. The transactions
table logs every individual transaction within these blocks, including transaction size, fees, and input/output counts, which facilitates the tracking of fund movements and transactional patterns within each block.
The inputs
and outputs
tables expand on the granular details of transactions, offering insight into each transaction's source and destination of funds. The inputs
table stores data about funds being consumed, including addresses, value, and unlocking scripts, while the outputs
table logs the destination addresses, output value, and locking scripts. Together, these tables provide a complete view of how value is transferred across the Bitcoin network, supporting analytical queries that range from tracing individual transactions to identifying complex patterns in fund distribution, fee structures, and network activity. This setup enables comprehensive blockchain data exploration for both high-level trends and low-level transaction details.
Blocks
The blocks
table stores detailed information about each block in the Bitcoin blockchain. It includes metadata such as block height, timestamp, transaction details, and mining difficulty.
Schema Overview
Column | Data Type | Description |
---|---|---|
| INT | Primary key. The block height represents the number of blocks preceding this block in the blockchain. |
| VARCHAR(10) | Encodes the target threshold for the block's cryptographic hash, adjusting the network's mining difficulty. |
| VARCHAR(64) | A cumulative measure of the proof-of-work effort that has gone into the chain up to this block. |
| VARCHAR(200) | Information about the coinbase transaction, which rewards miners. |
| DATE | The date the block was mined. |
| DECIMAL(38, 0) | The difficulty target for mining this block, indicating how hard it is to generate a valid hash. |
| VARCHAR(64) | The unique identifier for this block, generated from the block's header. |
| VARCHAR(64) | The root hash of the Merkle tree of transactions in this block, ensuring data integrity. |
| DOUBLE | The reward for successfully mining this block, typically in Bitcoin. |
| VARCHAR(10) | A variable incremented by miners to find a valid hash under the target threshold. |
| VARCHAR(64) | The hash of the preceding block in the chain, linking blocks together. |
| INT | The size of the block in bytes. |
| INT | The block size without witness data, as used in SegWit. |
| DATETIME | The exact timestamp when this block was mined. |
| DOUBLE | The total fees from transactions in this block, collected by the miner. |
| DOUBLE | The total reward, combining the mint reward and transaction fees. |
| INT | The number of transactions included in this block. |
| INT | The block weight, which is used in SegWit to ensure block size limits. |
Transactions
The transactions
table provides comprehensive data on individual transactions recorded on the Bitcoin blockchain. Each transaction is linked to a block by its height and hash, with additional fields capturing details about inputs, outputs, fees, and metadata.
Schema Overview
Column | Data Type | Description |
---|---|---|
| VARCHAR(64) | Primary key. Unique identifier for the transaction, known as the transaction hash. |
| INT | Height of the block containing this transaction, linking it to the |
| DATE | Date when the block was mined. |
| INT | Size of the transaction in bytes. |
| INT | Virtual size in vbytes, used to calculate fees in SegWit-enabled blocks. |
| SMALLINT | Version of the transaction, identifying the Bitcoin protocol rules followed. |
| INT | Time or block height at which this transaction becomes valid for inclusion in a block. |
| VARCHAR(64) | Hash of the block containing this transaction. |
| DATETIME | Exact timestamp when the block containing this transaction was mined. |
| BIGINT | The index position of the transaction within the block. |
| SMALLINT | Number of input records in this transaction. |
| SMALLINT | Number of output records in this transaction. |
| BIGINT | Total value of inputs in satoshis. |
| BIGINT | Total value of outputs in satoshis. |
| BOOLEAN | Indicates if this is a coinbase transaction (i.e., the first transaction in a block rewarding miners). |
| TEXT | Details about the coinbase transaction, including reward. |
| BIGINT | Total transaction fee in satoshis, calculated as the difference between |
| TEXT | Raw HEX data for the transaction, representing the entire transaction as a hexadecimal string. |
| JSON | JSON array of input details, capturing previous outputs spent in this transaction. |
| JSON | JSON array of output details, showing where the transaction funds were sent. |
Indexing and Query Optimization
Indexes: The table includes bitmap indexes on
block_time
,block_date
, andis_coinbase
to optimize queries by transaction date, mining status, and block timestamp.Engine: OLAP, designed for high-performance analytical queries.
Partitioning: By
block_height
range, enabling efficient retrieval of transactions over specific block ranges.
Inputs
The inputs
table stores information about each input in Bitcoin transactions. Inputs represent the source of funds spent in a transaction, linking to previous transaction outputs.
Schema Overview
Column | Data Type | Description |
---|---|---|
| VARCHAR(64) | Primary key. Hash of the transaction containing this input. |
| INT | Height of the block containing this transaction, linking it to the |
| DATE | Date when the block was mined. |
| INT | Index of this input within the transaction, uniquely identifying it. |
| VARCHAR(64) | Bitcoin address associated with this input, if available. |
| INT | Number of signatures required to authorize spending of this input. |
| TEXT | The input's script in human-readable assembly language, defining the unlocking conditions. |
| TEXT | The input script in raw hexadecimal format, enabling parsing of the unlocking script. |
| BIGINT | Sequence number used for ordering inputs or setting locktime behavior. |
| INT | The index of the output being spent in the referenced transaction. |
| VARCHAR(64) | Hash of the transaction from which this input derives its funds. |
| VARCHAR(40) | Type of input, e.g., |
| BIGINT | Amount of Bitcoin in satoshis provided by this input. |
Outputs
The outputs
table captures information about each output in Bitcoin transactions. Outputs represent the destination of funds within a transaction, detailing the recipient address, value, and conditions for spending.
Schema Overview
Column | Data Type | Description |
---|---|---|
| VARCHAR(64) | Primary key. Hash of the transaction containing this output. |
| INT | Height of the block containing this transaction, linking it to the |
| DATE | Date when the block was mined. |
| INT | Index of this output within the transaction, uniquely identifying it within the transaction. |
| VARCHAR(64) | Bitcoin address associated with this output, if applicable. |
| BIGINT | Value of Bitcoin in satoshis represented by this output. |
| TEXT | The output script (ScriptPubKey) in hexadecimal format, defining the conditions for spending this output. |
| TEXT | The output script in assembly language, providing a human-readable version of the ScriptPubKey. |
| VARCHAR(40) | Type of output script, such as |
| INT | Number of signatures required to unlock this output for spending. |
Data Audit
Blocks vs Transactions Count
View: audit_blocks_tx_count
audit_blocks_tx_count
Description: This view provides an audit report of discrepancies in the transaction counts recorded within the Bitcoin blocks. Specifically, it identifies blocks where the declared transaction_count
in the blocks
table does not match the actual count of transactions recorded in the transactions
table. This audit view is essential for validating data integrity, ensuring consistency between block metadata and actual transactional records.
Schema Overview
Column | Data Type | Description |
---|---|---|
| INT | The height of the block with a potential discrepancy in transaction count. |
| INT | The transaction count as declared in the |
| INT | The actual count of transactions found in the |
Missing Blocks
View: audit_missing_blocks
audit_missing_blocks
Description: This view identifies and lists gaps in block heights within the Bitcoin blockchain, highlighting missing blocks in the sequence. By reporting these gaps, the view enables quick identification of potentially missing or unrecorded blocks, which can be crucial for data consistency and completeness checks.
Schema Overview
Column | Data Type | Description |
---|---|---|
| INT | The height at which the missing block sequence begins. |
| INT | The height at which the missing block sequence ends. |
| INT | The number of missing blocks in this gap, calculated as the difference between start and end. |
L2
Addresses
Daily Active Addresses
Last updated