vnegi10's picture
Update README
8f7ad51
metadata
license:
  - gpl-3.0
language:
  - en
annotations_creators:
  - machine-generated
tags:
  - ethereum-blockchain
  - parquet
download_size:
  - 20.9 GB

Data source

The blockchain data was extracted into parquet files using the Rust-based cryo tool in combination with the web3 API provided by Ankr. Note that an account needs to be created even if you intend to make use of the limited capabilities under the freemium pricing model.

Sample command for using cryo is shown below. It can take long (~ 2 hours) to complete since we need to stay below the rate limit of 30 reqs/min. Also, we are fetching every 25th block, which means the data has a resolution of 5 minutes (25 x 12 s (average time for each block) = 300 seconds).

cryo blocks_and_transactions --rpc https://rpc.ankr.com/eth/<YOUR_API_KEY> 
--blocks 14328824:16920824:25 --chunk-size 5000 --max-concurrent-requests 16
--requests-per-second 30 --output-dir your_dir

Time period

Blocks are between the following time range:

| min_timestamp | max_timestamp |
| ------------- | ------------- |
| 2016-11-17 00:40:08 | 2025-03-25 21:17:35 |

Table schema

  • blocks/*parquet
Schema([('block_hash', Binary),
        ('author', Binary),
        ('block_number', UInt32),
        ('gas_used', UInt64),
        ('extra_data', Binary),
        ('timestamp', UInt32),
        ('base_fee_per_gas', UInt64),
        ('chain_id', UInt64)])
  • transactions/*parquet
Schema([('block_number', UInt32),
        ('transaction_index', UInt64),
        ('transaction_hash', Binary),
        ('nonce', UInt64),
        ('from_address', Binary),
        ('to_address', Binary),
        ('value_binary', Binary),
        ('value_string', String),
        ('value_f64', Float64),
        ('input', Binary),
        ('gas_limit', UInt64),
        ('gas_used', UInt64),
        ('gas_price', UInt64),
        ('transaction_type', UInt32),
        ('max_priority_fee_per_gas', UInt64),
        ('max_fee_per_gas', UInt64),
        ('success', Boolean),
        ('n_input_bytes', UInt32),
        ('n_input_zero_bytes', UInt32),
        ('n_input_nonzero_bytes', UInt32),
        ('chain_id', UInt64)])
  • The blocks and transactions tables can be joined on the block_number column

Schema explanation

Blocks

| Column              | Type      | Description                                                                                  |
|---------------------|-----------|----------------------------------------------------------------------------------------------|
| `block_hash`        | `Binary`  | 32-byte Keccak-256 hash that uniquely identifies the block.                                 |
| `author`            | `Binary`  | 20-byte Ethereum address of the block proposer (miner).                                     |
| `block_number`      | `UInt32`  | Height of the block in the blockchain.                                                      |
| `gas_used`          | `UInt64`  | Total gas used by all transactions in the block.                                            |
| `extra_data`        | `Binary`  | Optional miner-included metadata, often used for vanity tags or client identifiers.         |
| `timestamp`         | `UInt32`  | Block's timestamp as a Unix epoch (seconds since 1970-01-01).                              |
| `base_fee_per_gas`  | `UInt64`  | Base gas fee in wei introduced by EIP-1559 (used to compute transaction fees).              |
| `chain_id`          | `UInt64`  | Unique identifier for the Ethereum network or sidechain (e.g., `1` for mainnet, `137` for Polygon). |

Transactions

| Column                         | Type      | Description                                                                 |
|--------------------------------|-----------|-----------------------------------------------------------------------------|
| `block_number`                | `UInt32`  | Block number containing the transaction.                                   |
| `transaction_index`           | `UInt64`  | The transaction's position within the block.                               |
| `transaction_hash`            | `Binary`  | Unique 32-byte Keccak-256 hash identifying the transaction.                |
| `nonce`                       | `UInt64`  | The sender’s transaction count (prevents replay attacks).                  |
| `from_address`                | `Binary`  | 20-byte Ethereum address that sent the transaction.                        |
| `to_address`                  | `Binary`  | 20-byte recipient address (empty for contract creation).                   |
| `value_binary`                | `Binary`  | 32-byte big-endian integer: value in **wei** (raw).                        |
| `value_string`                | `String`  | The same value as a **human-readable string** (avoids precision loss).     |
| `value_f64`                   | `Float64` | Transaction value in Wei (1 ETH = 10^18 Wei).     |
| `input`                       | `Binary`  | Hex-encoded input data (used for contract calls or token transfers).       |
| `gas_limit`                   | `UInt64`  | Max gas sender is willing to spend.                                        |
| `gas_used`                    | `UInt64`  | Actual gas consumed by the transaction.                                    |
| `gas_price`                   | `UInt64`  | Price per gas unit (in wei).                                               |
| `transaction_type`            | `UInt32`  | Type of transaction: `0` = legacy, `2` = EIP-1559, etc.                    |
| `max_priority_fee_per_gas`    | `UInt64`  | Tip paid directly to miners (EIP-1559 only).                               |
| `max_fee_per_gas`             | `UInt64`  | Max total fee (base + priority) the user is willing to pay.                |
| `success`                     | `Boolean` | Whether the transaction succeeded (`TRUE`) or failed (`FALSE`).            |
| `n_input_bytes`               | `UInt32`  | Length of the `input` data in bytes.                                       |
| `n_input_zero_bytes`          | `UInt32`  | Count of zero bytes in the input (used in calldata analysis).              |
| `n_input_nonzero_bytes`       | `UInt32`  | Count of non-zero bytes in the input.                                      |
| `chain_id`                    | `UInt64`  | ID of the chain the transaction was signed for (e.g., `1` = Mainnet).      |

Examples

Polars LazyFrame

Blocks data

import polars as pl

def sample_query_blocks(folder):

    q1 = (
        pl.scan_parquet(folder,
                        glob = True
                       )
          .with_columns([
                        pl.col("block_hash").bin.encode("hex").alias("block_hash_encode"),
                        pl.col("author").bin.encode("hex").alias("author_encode"),
                        pl.col("extra_data").bin.encode("hex").alias("extra_data_encode"),
                        pl.from_epoch(pl.col("timestamp"), time_unit="s").alias("timestamp")
                        ])
          .drop("block_hash", "author", "extra_data")
          .limit(5)
    )

    return q1.collect()

sample_query_blocks("Ethereum_blockchain_parquet/blocks/*.parquet")

| block_number | gas_used | timestamp           | base_fee_per_gas | chain_id | block_hash_encode                                                           | author_encode                           | extra_data_encode               |
|--------------|----------|---------------------|------------------|----------|------------------------------------------------------------------------------|----------------------------------------|-------------------------------|
| 2640567      | 0        | 2016-11-17 00:40:08 |                  | 1        | 2c3854e10e8b1dbf19a7f58a9d69baf3206aa3d7e5ad19d4fcc74f768891d2f7             | 61c808d82a3ac53231750dadc13c777b59310bd9 | e4b883e5bda9e7a59ee4bb99e9b1bc |
| 2640592      | 0        | 2016-11-17 00:46:24 |                  | 1        | 935b348190ff542d018c539892cc929d35eb2693e611a9f83a5547dba3ae4e05             | c0ea08a2d404d3172d2add29a45be56da40e2949 | 7777772e62772e636f6d           |
| 2640617      | 528054   | 2016-11-17 00:51:33 |                  | 1        | 40d75766adc4635afecc2dd282e9f3499309cc270b79f11730fc15214e3ea740             | 1e9939daaad6924ad004c2560e90804164900341 | 706f6f6c2e65746866616e732e6f7267 |
| 2640642      | 378862   | 2016-11-17 00:55:51 |                  | 1        | c8b79924ec0957645c78d2068408fec2a7be95245184cc50a3746319ad83916a             | ea674fdde714fd979de3edf0f56aa9716b898ec8 | 65746865726d696e65202d20555332 |
| 2640667      | 290064   | 2016-11-17 01:04:00 |                  | 1        | bf1333f4dd761f02908b6b4927743c85c4d24f6e5a60c40f928e6c5ef3344a18             | 2a65aca4d5fc5b5c859090a6c34d164135398226 | 4477617266506f6f6c             |

Transactions data

import polars as pl

def sample_query_tx(folder):

    q1 = (
        pl.scan_parquet(folder,
                        glob = True
                       )
          .with_columns([
            pl.col("from_address").bin.encode("hex").alias("from_address_encode"),
            pl.col("to_address").bin.encode("hex").alias("to_address_encode"),
            pl.col("transaction_hash").bin.encode("hex").alias("transaction_hash_encode")
            ])
          .select("block_number",
                  "from_address_encode",
                  "to_address_encode",
                  "transaction_hash_encode",
                  "value_f64",
                  "gas_limit",
                  "gas_used",
                  "gas_price")
          .limit(5)
    )

    return q1.collect()

sample_query_tx("Ethereum_blockchain_parquet/transactions/*.parquet")

| block_number | from_address_encode                        | to_address_encode                          | transaction_hash_encode                                                       | value_f64         | gas_limit | gas_used | gas_price     |
|--------------|--------------------------------------------|---------------------------------------------|--------------------------------------------------------------------------------|-------------------|-----------|----------|---------------|
| 2640617      | 1e9939daaad6924ad004c2560e90804164900341   | 8768551208c13c74e7cdfe90f0826cffdb8ea534    | e20f0aa63f425bf7256f7f5667744f07a0a158746bd63078f806dd336f07e811              | 1011055491000774500 | 39000     | 22905    | 20000000000   |
| 2640617      | 22b84d5ffea8b801c0422afe752377a64aa738c2   | 3b7cb1a507cdbcf7d4ec0a69aae8cb22fc8e9465    | 65655bf9e9ca5d7c300f90757bb8e143dd8e5d8788eed70436415e6593a28e6f              | 1e+21              | 100000    | 21000    | 20000000000   |
| 2640617      | cdd7712af294f97bb8faa8b4ebf65106cab1a542   | e94b04a0fed112f3664e45adb2b8915693dd5ff3    | 4cc0f1c38871adf8a579f4f95d4b2f38416307e8bc126bd1a2d79a644a5f6e4a              | 1144847800000000000 | 134270    | 34270    | 20000000000   |
| 2640617      | 26588a9301b0428d95e6fc3a5024fce8bec12d51   | 4b92a948ced9d457b4655abf62ed930a090f8566    | cb9f23b4633807241011c65baed592a57cbd1e33b51340513c31acf5968394dc              | 0                  | 150000    | 100341   | 20000000000   |
| 2640617      | 9e0b9ddba97dd4f7addab0b5f67036eebe687606   | 37a9679c41e99db270bda88de8ff50c0cd23f326    | bed4ef960e0854b67e7e125b6ae03f8eecaca56a0d259457367f51c60594df54              | 0                  | 270000    | 37198    | 20000000000   |