mwritescode commited on
Commit
e0008b7
1 Parent(s): c6a8d60

Updated dataset card

Browse files
Files changed (1) hide show
  1. README.md +136 -1
README.md CHANGED
@@ -1,3 +1,138 @@
1
  ---
2
- license: mit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ annotations_creators:
3
+ - other
4
+ language_creators:
5
+ - found
6
+ languages:
7
+ - en
8
+ licenses:
9
+ - mit
10
+ multilinguality:
11
+ - monolingual
12
+ pretty_name: Slither Audited Smart Contracts
13
+ size_categories:
14
+ - 100K<n<1M
15
+ source_datasets:
16
+ - original
17
+ task_categories:
18
+ - text-classification
19
+ - text-generation
20
+ task_ids:
21
+ - multi-label-classification
22
+ - multi-input-text-classification
23
+ - language-modeling
24
  ---
25
+
26
+ # Dataset Card for Slither Audited Smart Contracts
27
+
28
+ ## Table of Contents
29
+ - [Dataset Description](#dataset-description)
30
+ - [Dataset Summary](#dataset-summary)
31
+ - [Supported Tasks](#supported-tasks-and-leaderboards)
32
+ - [Languages](#languages)
33
+ - [Dataset Structure](#dataset-structure)
34
+ - [Data Instances](#data-instances)
35
+ - [Data Fields](#data-instances)
36
+ - [Data Splits](#data-instances)
37
+ - [Dataset Creation](#dataset-creation)
38
+ - [Curation Rationale](#curation-rationale)
39
+ - [Source Data](#source-data)
40
+ - [Additional Information](#additional-information)
41
+ - [Dataset Curators](#dataset-curators)
42
+ - [Licensing Information](#licensing-information)
43
+ - [Citation Information](#citation-information)
44
+
45
+ ## Dataset Description
46
+
47
+ - **Homepage:** https://github.com/mwritescode/slither-audited-smart-contracts
48
+ - **Repository:** https://github.com/mwritescode/slither-audited-smart-contracts
49
+ - **Point of Contact:** [Martina Rossini](mailto:martina.rossini704@gmail.com)
50
+
51
+ ### Dataset Summary
52
+
53
+ This dataset contains source code and deployed bytecode for Solidity Smart Contracts that have been verified on Etherscan.io, along with a classification of their vulnerabilities according to the Slither static analysis framework.
54
+
55
+ ### Supported Tasks and Leaderboards
56
+
57
+ - `text-classification`: The dataset can be used to train a model for both binary and multilabel text classification on smart contracts bytecode and source code. The model performance is evaluated based on the accuracy of the predicted labels as compared to the given labels in the dataset.
58
+ - `text-generation`: The dataset can also be used to train a language model for the Solidity programming language
59
+ - `image-classification`: By pre-processing the bytecode data to obtain RGB images, the dataset can also be used to train convolutional neural networks for code vulnerability detection and classification.
60
+
61
+ ### Languages
62
+
63
+ The language annotations are in English, while all the source codes are in Solidity.
64
+
65
+ ## Dataset Structure
66
+
67
+ ### Data Instances
68
+
69
+ Each data instance contains the following features: `address`, `source_code` and `bytecode`. The label comes in two configuration, either a plain-text cleaned up version of the output given by the Slither tool or a multi-label version, which consists in a simple list of integers, each one representing a particular vulnerability class. Label 4 indicates that the contract is safe.
70
+
71
+ An example from a plain-text configuration looks as follows:
72
+ ```
73
+ {
74
+ 'address': '0x006699d34AA3013605d468d2755A2Fe59A16B12B'
75
+ 'source_code': 'pragma solidity 0.5.4; interface IERC20 { function balanceOf(address account) external ...'
76
+ 'bytecode': '0x608060405234801561001057600080fd5b5060043610610202576000357c0100000000000000000000000000000000000000000000000000000000900...'
77
+ 'slither': '{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}'
78
+ }
79
+ ```
80
+
81
+ An example from a multi-label configuration looks as follows:
82
+ ```
83
+ {
84
+ 'address': '0x006699d34AA3013605d468d2755A2Fe59A16B12B'
85
+ 'source_code': 'pragma solidity 0.5.4; interface IERC20 { function balanceOf(address account) external ...'
86
+ 'bytecode': '0x608060405234801561001057600080fd5b5060043610610202576000357c0100000000000000000000000000000000000000000000000000000000900...'
87
+ 'slither': [ 4 ]
88
+ }
89
+ ```
90
+
91
+ ### Data Fields
92
+
93
+ - `address`: a string representing the address of the smart contract deployed on the Ethereum main net
94
+ - `source_code`: a flattened version of the smart contract codebase in Solidity
95
+ - `bytecode`: a string representing the smart contract's bytecode, obtained when calling `web3.eth.getCode()`. Note that in some cases where this was not available, the string is simply '0x'.
96
+ - `slither`: either a cleaned up version of Slither's JSON output or a list of class labels
97
+
98
+ ### Data Splits
99
+
100
+ The dataset comes in 6 configurations and train, test and validation splits are only provided for those configurations that do not include `all-` in their names. Test and Validation splits are both about 15% of the total.
101
+
102
+ ## Dataset Creation
103
+
104
+ ### Curation Rationale
105
+
106
+ slither-audited-smart-contracts was built to provide a freely available large scale dataset for vulnerability detection and classification on verified Solidity smart contracts. Indeed, the biggest open source dataset for this task at the moment of writing is [SmartBugs Wild](https://github.com/smartbugs/smartbugs-wild), containing 47,398 smart contracts that were labeled with 9 tools withing the SmartBugs framework.
107
+
108
+ ### Source Data
109
+
110
+ #### Initial Data Collection and Normalization
111
+
112
+ The dataset was constructed started from the list of verified smart contracts provided at [Smart Contract Sanctuary](https://github.com/tintinweb/smart-contract-sanctuary-ethereum). Then, smart contract source code was either downloaded from the aforementioned repo or downloaded via [Etherscan](https://etherscan.io/apis) and flattened using the Slither contract flattener. The bytecode was downloaded using the Web3.py library, in particular the `web3.eth.getCode()` function and using [INFURA](https://infura.io/) as our endpoint.
113
+ Finally, every smart contract was analyzed using the [Slither](https://github.com/crytic/slither) static analysis framework. The tool found 38 different vulnerability classes in the collected contracts and they were then mapped to 9 labels according to what is shown in the file `label_mappings.json`. These mappings were derived by following the guidelines at [Decentralized Application Security Project (DASP)](https://www.dasp.co/) and at [Smart Contract Weakness Classification Registry](https://swcregistry.io/). They were also inspired by the mappings used for Slither's detection by the team that labeled the SmartBugs Wild dataset, which can be found [here](https://github.com/smartbugs/smartbugs-results/blob/master/metadata/vulnerabilities_mapping.cs).
114
+
115
+ ## Additional Information
116
+
117
+ ### Dataset Curators
118
+
119
+ The dataset was initially created by Martina Rossini during work done for the project of the course Blockchain and Cryptocurrencies of the University of Bologna (Italy).
120
+
121
+ ### Licensing Information
122
+
123
+ The license in the file LICENSE applies to all the files in this repository, except for the Solidity source code of the contracts. These are still publicly available, were obtained using the Etherscan APIs, and retain their original licenses.
124
+
125
+ ### Citation Information
126
+
127
+ If you are using this dataset in your research and paper, here's how you can cite it:
128
+
129
+ ```
130
+ @misc{rossini2022slitherauditedcontracts,
131
+ title = {Slither Audited Smart Contracts Dataset},
132
+ author={Martina Rossini},
133
+ year={2022}
134
+ }
135
+ ```
136
+
137
+ ### Contributions
138
+ Thanks to [@mwritescode](https://github.com/mwritescode) for adding this dataset.