Update README.md
Browse files
README.md
CHANGED
@@ -16,7 +16,13 @@ Zellic is making publicly available a dataset of known Ethereum mainnet smart co
|
|
16 |
|
17 |
Our aim is to provide a contract source code dataset that is readily available to the public to download in bulk. We believe this dataset will help advance the frontier of smart contract security research. Applications include static analysis, machine learning, and more. This effort is part of Zellic’s mission to create a world with no smart contract hacks.
|
18 |
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
## Dataset Structure
|
22 |
|
@@ -26,6 +32,22 @@ The `address_bytecodehash_index` file contains a list of known smart contract ad
|
|
26 |
|
27 |
Look up the smart contract address in this file to find the source. This file also serves as a list of all deployed smart contracts as of block 16860349.
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
### Contract Sources
|
30 |
|
31 |
Smart Contract sources are organized by folder in the `organized_contracts` directory.
|
@@ -34,6 +56,18 @@ For example, a contract with the bytecode hash `beef3d7d1884c4fee50548cfe762415f
|
|
34 |
|
35 |
Each folder for a smart contract contains the source files as well as a `metadata.json` that contains information about the contract such as the compiler version and optimizations used. These settings can be used to attempt to reproduce the build.
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
#### Source Formats
|
38 |
|
39 |
Contracts may come in one of three source formats. Single file, multiple files, and [Solidity Compiler JSON](https://docs.soliditylang.org/en/v0.8.19/using-the-compiler.html#compiler-api).
|
|
|
16 |
|
17 |
Our aim is to provide a contract source code dataset that is readily available to the public to download in bulk. We believe this dataset will help advance the frontier of smart contract security research. Applications include static analysis, machine learning, and more. This effort is part of Zellic’s mission to create a world with no smart contract hacks.
|
18 |
|
19 |
+
## Methodology
|
20 |
+
|
21 |
+
First, we accumulated a list of all deployed contracts on Ethereum mainnet as of block 16860349. This does not include contracts that have been `SELFDESTRUCT`ed. We progressivelyh built up this index by performing a full sync from the genesis block using the modified Geth instance. Whenever a new contract was created, we added it to our index. When a contract `SELFDESTRUCT`ed, we removed it from the index. This list is available in this dataset as the file `address_bytecodehash_index`.
|
22 |
+
|
23 |
+
Next, we collected contract source code from publicly available online sources. All data was obtained from publicly accessible resources.
|
24 |
+
|
25 |
+
Finally, we calculated all of the Keccak256 hashes of the deployed EVM bytecode of each contract. We deduplicated contract source code by bytecode hash. In other words, we organized the contract source code set by the bytecode hash of their corresponding verified contracts. For example, if source codes A and B are both verified against smart contracts X and Y with the same deployed EVM bytecode, we only include one of A or B in this dataset. Choosing among duplicates was arbitrarily.
|
26 |
|
27 |
## Dataset Structure
|
28 |
|
|
|
32 |
|
33 |
Look up the smart contract address in this file to find the source. This file also serves as a list of all deployed smart contracts as of block 16860349.
|
34 |
|
35 |
+
**Not all contracts in the index file will have source code available.** This is a list of **all** deployed smart contracts as of block 16860349. (See Methodology).
|
36 |
+
|
37 |
+
Excerpt of data from the index for preview purposes:
|
38 |
+
|
39 |
+
```
|
40 |
+
...
|
41 |
+
00012e87fa9172d0c613f69d0abf752bb00310ec:4f5a5f6706dc853cb3ae2279729e0d7e24dda128a77358144e4c0fd3e5d60e98
|
42 |
+
00012c8ef0fef0a06e1644ab91107fe8584fb91e:a828ef7f5f6d2ebb1203de12878e16aa5ba6984c12ededff4e19876233533505
|
43 |
+
00012df38ea3a6dabefb8407a59219a0c7dd0bc8:c279544d07d9631b1e37d835cadfe7098d60e508cf8f18a89ddb8b176d56874d
|
44 |
+
00012d92a0e7ee1b19f8e018267c97a3a7e99aa7:0865cec1e9ac3048b12a85fc3b9fbc682c3831784e3396416635df4cb88c3fdd
|
45 |
+
00012f07e281c1d8a9d790358050b6015eef942c:ab7af4c77ed6371c7eda04ba317a134f0b06593c0dc2851bf4c709a367ea50ed
|
46 |
+
00012e198745e53293bf09ddec8da1284963fded:ce33220d5c7f0d09d75ceff76c05863c5e7d6e801c70dfe7d5d45d4c44e80654
|
47 |
+
00012ec2c9fc4a1692176da5202a44a4aea5e177:ce33220d5c7f0d09d75ceff76c05863c5e7d6e801c70dfe7d5d45d4c44e80654
|
48 |
+
...
|
49 |
+
```
|
50 |
+
|
51 |
### Contract Sources
|
52 |
|
53 |
Smart Contract sources are organized by folder in the `organized_contracts` directory.
|
|
|
56 |
|
57 |
Each folder for a smart contract contains the source files as well as a `metadata.json` that contains information about the contract such as the compiler version and optimizations used. These settings can be used to attempt to reproduce the build.
|
58 |
|
59 |
+
Example of metadata.json for preview purposes (unminified for ease of viewing):
|
60 |
+
|
61 |
+
```json
|
62 |
+
{
|
63 |
+
"ContractName": "MageSpace",
|
64 |
+
"CompilerVersion": "v0.8.10+commit.fc410830",
|
65 |
+
"Runs": 200,
|
66 |
+
"OptimizationUsed": false,
|
67 |
+
"BytecodeHash": "c2f8f4e79a9d7c23d8a398768e1476f03f0e11c44fc7441c021e098c71678d03"
|
68 |
+
}
|
69 |
+
```
|
70 |
+
|
71 |
#### Source Formats
|
72 |
|
73 |
Contracts may come in one of three source formats. Single file, multiple files, and [Solidity Compiler JSON](https://docs.soliditylang.org/en/v0.8.19/using-the-compiler.html#compiler-api).
|