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

What

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_NUMBERNUMBERThe 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_HASHTEXTThe 64-character hexadecimal hash (STRING) of the block containing this transaction. This value uniquely identifies the block in the Bitcoin blockchain. Example: 0000000000000000000a16b7e2e3b2c1d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8g9
MEDIAN_TIMETIMESTAMP_NTZThe median block time expressed in TIMESTAMP_NTZ format (UTC).
TX_COUNTNUMBERThe number of transactions in the block, also called nTx.
NEXT_BLOCK_HASHTEXTThe hash of the next block.
PREVIOUS_BLOCK_HASHTEXTThe hash of the previous block.
BITSTEXTThe 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 com…
CHAINWORKTEXTThe 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 heig…
DIFFICULTYFLOATThe 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…
MERKLE_ROOTTEXTThe 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 c…
NONCENUMBERThe 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 difficult…
SIZENUMBERThe size (INTEGER, bytes) of the transaction as it appears on-chain. Example: 225
STRIPPED_SIZENUMBERThe block size excluding witness data.
VERSIONTEXTThe transaction version (INTEGER). Indicates the version of the transaction format used. Most Bitcoin transactions use version 1 or 2. Example: 2
WEIGHTTEXTThe block weight as defined in BIP 141.
ERRORTEXTThe error message, if any.
TXSARRAYAn array with transaction ids.
FACT_BLOCKS_IDTEXTA unique identifier (STRING or NUMBER) for the record, used as a primary key for this table. Not a blockchain-native field. Example: 123456789
INSERTED_TIMESTAMPTIMESTAMP_LTZThe timestamp (TIMESTAMP_NTZ, UTC) when this record was initially created and inserted into the table. Example: 2024-06-01 12:34:56.000
MODIFIED_TIMESTAMPTIMESTAMP_LTZThe timestamp (TIMESTAMP_NTZ, UTC) when this record was last modified by an internal process. Example: 2024-06-01 12:35:00.000