Skip to main content
Schema: bitcoin.core Table: fact_blocks Type: View

Description

This table contains the complete block header data for all Bitcoin blocks, providing the foundational blockchain structure information. Each row represents a single block with its associated metadata including mining difficulty, proof-of-work parameters, transaction counts, and cryptographic commitments. The data includes all essential block header fields such as timestamp, hash, difficulty, nonce, and Merkle root, which are critical for understanding Bitcoin’s consensus mechanism and blockchain integrity.

Key Use Cases

  • Mining difficulty analysis and network hash rate trends
  • Block time analysis and network performance monitoring
  • Blockchain fork detection and chain validation
  • Transaction throughput analysis by block
  • Mining pool performance and block discovery patterns
  • Network security analysis through proof-of-work metrics
  • Historical blockchain growth and development tracking

Important Relationships

  • Primary source for all block-level analytics in the Bitcoin ecosystem
  • Referenced by core.fact_transactions to provide block context for transaction analysis
  • Used by core.fact_inputs and core.fact_outputs to establish block-level relationships
  • Supports gov.ez_miner_rewards for mining reward calculations and analysis
  • Provides foundational data for stats.ez_core_metrics_hourly aggregated metrics

Commonly-used Fields

  • block_timestamp: Essential for time-series analysis and trend detection
  • block_number: Primary field for chronological ordering and gap detection
  • block_hash: Critical for blockchain integrity verification and fork analysis
  • difficulty: Key metric for understanding network security and mining economics
  • tx_count: Important for transaction throughput and network activity analysis
  • chainwork: Essential for determining the canonical chain in fork scenarios
  • merkle_root: Critical for transaction inclusion verification and SPV operations

Columns

Column NameData TypeDescription
BLOCK_TIMESTAMPTIMESTAMP_NTZThe timestamp (TIMESTAMP_NTZ, UTC) of the block that contains this transaction. This value is inherited from the block header and represents when the block was mined and the transaction was confirmed on-chain.
Example: 2024-06-01 12:34:56.000 | | BLOCK_NUMBER | NUMBER | The block height (INTEGER) of the block containing this transaction. In Bitcoin, block height is the number of blocks preceding a particular block in the blockchain, starting from the genesis block (height 0). Example: 845000 | | BLOCK_HASH | TEXT | The 64-character hexadecimal hash (STRING) of the block containing this transaction. This value uniquely identifies the block in the Bitcoin blockchain. Example: 0000000000000000000a16b7e2e3b2c1d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8g9 | | MEDIAN_TIME | TIMESTAMP_NTZ | The median block time expressed in TIMESTAMP_NTZ format (UTC). | | TX_COUNT | NUMBER | The number of transactions in the block, also called nTx. | | NEXT_BLOCK_HASH | TEXT | The hash of the next block. | | PREVIOUS_BLOCK_HASH | TEXT | The hash of the previous block. | | BITS | TEXT | The nBits field (STRING) from the Bitcoin block header, which encodes the target difficulty for the block. This compact representation stores the difficulty target as a 4-byte value where the first byte is the exponent and the next 3 bytes are the mantissa. The target is calculated as mantissa _ 2^(8_(exponent-3)). This field is used by miners to determine if their block hash meets the difficulty requirement and by the network to calculate the actual difficulty value. The nBits field is more compact than storing the full difficulty value and is the standard way Bitcoin represents mining targets. Example: 1703a30c | | CHAINWORK | TEXT | The cumulative proof of work (STRING) required to produce the current blockchain up to this block. Chainwork is the sum of all difficulty values from the genesis block to the current block, representing the total computational effort expended to create the entire blockchain. This field is used to determine the “heaviest” chain in case of forks, as the chain with the highest chainwork is considered the valid one. Chainwork provides a more accurate measure of blockchain security than block height alone, as it accounts for the actual computational effort required to create each block. Example: 0000000000000000000000000000000000000000000000000000000000000000 | | DIFFICULTY | FLOAT | The mining difficulty (FLOAT) of the block, representing the estimated amount of work required to find this block relative to the difficulty of finding the genesis block (block 0). Bitcoin’s difficulty adjusts every 2,016 blocks (approximately every 2 weeks) to maintain a target block time of 10 minutes. Higher difficulty values indicate that more computational work is required to mine new blocks, which occurs when more miners join the network. Lower difficulty values occur when miners leave the network. The difficulty is calculated using the nBits field and represents the target hash threshold that a block’s hash must be below to be considered valid. Example: 67,305,060,903,803.0 | | MERKLE_ROOT | TEXT | The Merkle root hash (STRING) of all transactions in the block, computed using a binary hash tree (Merkle tree). The Merkle root is calculated by hashing pairs of transaction hashes recursively until a single hash remains. This structure allows for efficient verification of transaction inclusion in a block without downloading all transaction data. The Merkle root serves as a cryptographic commitment to all transactions in the block and is included in the block header. It enables lightweight clients to verify transaction inclusion using Merkle proofs, which is essential for Simplified Payment Verification (SPV) in Bitcoin. Example: 3ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a | | NONCE | NUMBER | The nonce value (NUMBER) used by miners to find a valid block hash that meets the difficulty target. The nonce is a 32-bit field in the block header that miners increment to generate different block hashes. When combined with the block’s other header fields (version, previous block hash, merkle root, timestamp, bits), the nonce allows miners to create unique block hashes. Miners systematically try different nonce values until they find one that produces a block hash below the target difficulty threshold. The nonce field is the primary mechanism that enables proof-of-work mining in Bitcoin, as it provides the variable input needed to generate different hash outputs. Example: 1234567890 | | SIZE | NUMBER | The size (INTEGER, bytes) of the transaction as it appears on-chain. Example: 225 | | STRIPPED_SIZE | NUMBER | The block size excluding witness data. | | VERSION | TEXT | The transaction version (INTEGER). Indicates the version of the transaction format used. Most Bitcoin transactions use version 1 or 2. Example: 2 | | WEIGHT | TEXT | The block weight as defined in BIP 141. | | ERROR | TEXT | The error message, if any. | | TXS | ARRAY | An array with transaction ids. | | FACT_BLOCKS_ID | TEXT | A unique identifier (STRING or NUMBER) for the record, used as a primary key for this table. Not a blockchain-native field. Example: 123456789 | | INSERTED_TIMESTAMP | TIMESTAMP_LTZ | The timestamp (TIMESTAMP_NTZ, UTC) when this record was initially created and inserted into the table. Example: 2024-06-01 12:34:56.000 | | MODIFIED_TIMESTAMP | TIMESTAMP_LTZ | The timestamp (TIMESTAMP_NTZ, UTC) when this record was last modified by an internal process. Example: 2024-06-01 12:35:00.000 |