--- license: agpl-3.0 configs: - config_name: hex-ethereum default: true data_files: - split: train path: "hex/ethereum/train/*.parquet" - split: cleaned path: "hex/ethereum/cleaned/*.parquet" - config_name: bin-ethereum data_files: - split: train path: "bin/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 - homepage: [https://github.com/apehex/feedblocks][github-feedblocks] - version: 1.0.1 ### HEX Dataset | Config | Split | Size | Samples | Blocks | | ----------------- | --------- | --------- | --------- | ------------------------- | | 'hex-ethereum' | 'train' | 2.8 GB | 1,294,247 | 19,493,000 - 20,292,000 | | 'hex-ethereum' | 'cleaned' | 2.0 GB | 122,800 | 19,493,000 - 20,292,000 | The "cleaned" split covers the same block range, but records were removed when: - the source code is not available - the source code matches the contract factory instead of the deployed contract ### BIN Dataset | Config | Split | Size | Samples | Blocks | | ----------------- | --------- | --------- | --------- | ------------------------- | | 'bin-ethereum' | 'train' | 2.3 GB | 1,294,247 | 19,493,000 - 20,292,000 | ## Features The data comes in two flavors: binary and hexadecimal encodings. The fields have the same names in both and the underlying data is also identical. In binary form, the raw bytes are stored in most fields: ```python datasets.Features({ 'chain_id': datasets.features.Value(dtype='uint64'), 'block_number': datasets.features.Value(dtype='uint64'), 'block_hash': datasets.features.Value(dtype='large_binary'), 'transaction_hash': datasets.features.Value(dtype='large_binary'), 'deployer_address': datasets.features.Value(dtype='large_binary'), 'factory_address': datasets.features.Value(dtype='large_binary'), 'contract_address': datasets.features.Value(dtype='large_binary'), 'creation_bytecode': datasets.features.Value(dtype='large_binary'), 'runtime_bytecode': datasets.features.Value(dtype='large_binary'), 'creation_sourcecode': datasets.features.Value(dtype='large_binary'),}) ``` While in hexadecimal format, the data is encoded into HEX strings: ```python 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'),}) ``` ### Chain And Block Numbers Both ids are stored as unsigned integers. ### Solidity Sources The sources all have open source licenses. They were collected from block explorer APIs like [Etherscan][etherscan-api]. The sources are formatted as [standard JSON input][solidity-docs-json] for the solidity compiler. The resulting JSON is then encoded using UTF-8 into a single string. ### HEX Dataset All the other features are HEX encoded into strings, **without** the `0x` prefix. For example: ```python { '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': '',} ``` ## BIN Dataset All the other features are stored in binary format: ```python { 'chain_id': 1, 'block_number': 20155815, 'block_hash': b'\xfc\xdd\xf3;\x1bZr\x8a@X\x8e\xda`&&9 \x1a\xc0\xd3\xf6\x11\xf0\x82\x86\xa9\xe2\xefeWa\x11', 'transaction_hash': b'\xec7#\xff\xb8\xa3\xbb\xb8\xb8;%H\x1fa\xcb\xfcF8?\xc8\x8f\xf8\xeb6A\x86\xb5:\xa2&\xe4\xbf', 'deployer_address': b'\xbaW\xab\xe3u\x9088\xb5\xc1\x97\t\xe9m\xae\x12\x19\x1f\xa3~', 'factory_address': b'\x00\x00\x00\x00\x00\xb3\xf8y\xcb0\xfe$;M\xfe\xe48i\x1c\x04', 'contract_address': b'\xc7%\xbc1\xcb\xa2LS\xe5\xc0\xc2\xe2\x06]K@\xf5#Fx', 'creation_bytecode': b'un\xb3\xf8y\xcb0\xfe$;M\xfe\xe48i\x1c\x043\x18XW3\xff`\x00R`\x16`\n\xf3', 'runtime_bytecode': b'n\xb3\xf8y\xcb0\xfe$;M\xfe\xe48i\x1c\x043\x18XW3\xff', 'creation_sourcecode': b''} ``` This saves disk space and may actually be more practical for further processing. [etherscan-api]: https://docs.etherscan.io/api-endpoints/contracts [github-feedblocks]: https://github.com/apehex/feedblocks/ [github-tfds]: https://github.com/apehex/feedblocks/tree/main/feedblocks/datasets/evmc [solidity-docs-json]: https://docs.soliditylang.org/en/v0.8.26/using-the-compiler.html#compiler-input-and-output-json-description