evm_contracts / README.md
apehex's picture
Start over with "feedblocks" template
64cd647
|
raw
history blame
4.1 kB
metadata
license: agpl-3.0
configs:
  - config_name: ethereum
    data_files:
      - split: train
        path: data/ethereum/train/*.parquet

EVM Contracts

Description

EVMC (Ethereum Virtual Machine Contracts) is a collection of smart contracts from the ETH blockchain.

In particular, each sample holds the creation and runtime bytecodes. When available, the sources are also included.

Metadata

the dataset is not yet complete!

Split Samples Blocks Scraped sources
'ethereum' 1,294,252 19,493,000 - 20,292,000 19,493,000 - 19,785,999 (36%)

The transaction data is available for all records, in particular creation and runtime bytecodes are filled.

But the source code cannot be collected via standard RPC nodes, they have to be obtained through the APIs of block explorers. These have a small rate limit and it takes a long time.

So the source code data has only been scraped for a portion of the records, as listed in the table above.

Features

datasets.Features({
    "chain_id": datasets.features.Value(dtype='uint64'),
    "block_number": datasets.features.Value(dtype='uint64'),
    'block_hash': datasets.features.Value(dtype='string'),
    'transaction_hash': datasets.features.Value(dtype='string'),
    'deployer_address': datasets.features.Value(dtype='string'),
    'factory_address': datasets.features.Value(dtype='string'),
    'contract_address': datasets.features.Value(dtype='string'),
    'creation_bytecode': datasets.features.Value(dtype='string'),
    'runtime_bytecode': datasets.features.Value(dtype='string'),
    'creation_sourcecode': datasets.features.Value(dtype='string'),})

Block Number

The block number is the only integer feature.

Solidity Sources

The sources all have open source licenses. They were collected from block explorer APIs like Etherscan.

The sources are formatted as standard JSON input for the solidity compiler.

The resulting JSON is then encoded using UTF-8 into a single string.

HEX Data

All the other features are HEX encoded into strings, without the 0x prefix.

For example:

{
    'chain_id': 1,
    'block_number': 20155815,
    'block_hash': 'fcddf33b1b5a728a40588eda60262639201ac0d3f611f08286a9e2ef65576111',
    'transaction_hash': 'ec3723ffb8a3bbb8b83b25481f61cbfc46383fc88ff8eb364186b53aa226e4bf'
    'deployer_address': 'ba57abe375903838b5c19709e96dae12191fa37e',
    'factory_address': '0000000000b3f879cb30fe243b4dfee438691c04',
    'contract_address': 'eff10e7d4feef60ed9b9e9bb9fee12c2504bd0ba',
    'creation_bytecode': '756eb3f879cb30fe243b4dfee438691c043318585733ff6000526016600af3',
    'runtime_bytecode': '6eb3f879cb30fe243b4dfee438691c043318585733ff',
    'solidity_sourcecode': '',}

Raw Data

The original data is stored in parquet files, and typed as raw bytes:

pa.schema(fields=[
    pl.field('chain_id', pa.uint64()),
    pl.field('block_number', pa.uint32()),
    pl.field('block_hash', pa.large_binary()),
    pl.field('transaction_hash', pa.large_binary()),
    pl.field('deployer_address', pa.large_binary()),
    pl.field('factory_address', pa.large_binary()),
    pl.field('contract_address', pa.large_binary()),
    pl.field('creation_bytecode', pa.large_binary()),
    pl.field('runtime_bytecode', pa.large_binary()),
    pl.field('creation_sourcecode', pa.large_binary()),])

This data is collected by the scripts of a dedicated package, feedblocks.