Update README.md
Browse files
README.md
CHANGED
@@ -1,61 +1,105 @@
|
|
1 |
-
---
|
2 |
-
license: mit
|
3 |
-
tags:
|
4 |
-
- finance
|
5 |
-
|
6 |
-
|
7 |
-
|
|
|
8 |
|
9 |
Decentralized finance (DeFi) has emerged as a significant sector within the blockchain and cryptocurrency space. DeFi protocols enable users to access financial services without traditional intermediaries, offering a wide range of applications such as lending, borrowing, trading, and yield farming. Understanding user behavior, protocol interactions, and market trends is crucial for analyzing the DeFi ecosystem's dynamics and identifying opportunities for innovation and growth.
|
10 |
|
11 |
---
|
12 |
# About Dataset
|
13 |
-
This dataset
|
|
|
|
|
14 |
|
15 |
βββ contracts.parquet # Contains contract details for selected DeFi protocols.
|
16 |
βββ transactions.parquet # Contains transaction data for Ethereum-based contracts.
|
17 |
βββ market.parquet # Contains enriched market data with aggregated transaction metrics.
|
18 |
βββ users.parquet # User profiles based on transaction data.
|
19 |
|
20 |
-
|
21 |
|
|
|
22 |
#### Timeframe:
|
23 |
* Start: `2022-12-31T22:59:59.000Z`
|
24 |
* End: `2024-12-30T23:00:11.000Z`
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
### `users.parquet`
|
31 |
-
This file focuses on user-level data and is aimed at answering questions related to user behavior, activity trends, and protocol interactions. Potential use cases include:
|
32 |
-
- Analyzing the lifecycle of user activity in DeFi.
|
33 |
-
- Identifying power users or dormant users.
|
34 |
-
- Mapping the interaction between users and various protocols.
|
35 |
-
|
36 |
-
---
|
37 |
-
|
38 |
-
### `market.parquet`
|
39 |
-
This file aggregates market-related data over time intervals, offering insights into protocol performance and market dynamics. Objectives include:
|
40 |
-
- Understanding market trends across DeFi protocols and tokens.
|
41 |
-
- Analyzing trading volumes, transaction activity, and price fluctuations.
|
42 |
-
- Identifying periods of high or low activity for specific tokens or protocols.
|
43 |
|
44 |
---
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
-
|
57 |
-
-
|
58 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
|
60 |
---
|
61 |
## Conclusion
|
@@ -69,16 +113,19 @@ Tools used in this process:
|
|
69 |
2. **Etherscan API** - For transaction data extraction on Ethereum smart contracts.
|
70 |
3. **Yahoo Finance API** - For market data including OHLC values of tokens and trading volume.
|
71 |
4. **MongoDB** - For managing and storing large volumes of transaction and protocol data in a structured format.
|
72 |
-
5. **Ethereum Blockchain** - For the decentralized financial infrastructure that powers these protocols and transactions.
|
73 |
|
74 |
Code is available on [GitHub](https://github.com/mriusero/defi-user-behavior-clustering) and the ETL process is explained [here](https://github.com/mriusero/defi-user-behavior-clustering/blob/main/docs/etl_pipeline_flow.md).
|
75 |
|
76 |
---
|
77 |
-
|
78 |
-
|
79 |
-
## `users.parquet`
|
80 |
-
This dataset contains information about user activities and transactions. The variables are:
|
81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
- **`address`** *(string)*: The wallet address of the user.
|
83 |
- **`first_seen`** *(datetime)*: The first recorded activity of the user.
|
84 |
- **`last_seen`** *(datetime)*: The most recent activity of the user.
|
@@ -92,9 +139,12 @@ This dataset contains information about user activities and transactions. The va
|
|
92 |
|
93 |
---
|
94 |
|
95 |
-
|
96 |
-
This
|
97 |
-
|
|
|
|
|
|
|
98 |
- **`timestamp`** *(datetime)*: The time when the data was recorded.
|
99 |
- **`blockchain`** *(string)*: The blockchain network (e.g., Ethereum, Binance Smart Chain).
|
100 |
- **`protocol_name`** *(string)*: The name of the protocol associated with the data.
|
@@ -125,9 +175,12 @@ This dataset contains market-related data aggregated over specific time interval
|
|
125 |
|
126 |
---
|
127 |
|
128 |
-
|
129 |
-
This
|
130 |
-
|
|
|
|
|
|
|
131 |
- **`timestamp`** *(datetime)*: The time when the transaction occurred.
|
132 |
- **`transaction_hash`** *(string)*: The unique hash identifying the transaction.
|
133 |
- **`from`** *(string)*: The sender's wallet address.
|
@@ -141,9 +194,12 @@ This dataset contains individual transaction-level data. The variables are:
|
|
141 |
|
142 |
---
|
143 |
|
144 |
-
|
145 |
-
This
|
146 |
-
|
|
|
|
|
|
|
147 |
- **`contract_address`** *(string)*: The unique address of the smart contract.
|
148 |
- **`blockchain`** *(string)*: The blockchain network where the contract is deployed.
|
149 |
- **`type`** *(string)*: The type of contract (e.g., ERC-20, ERC-721).
|
|
|
1 |
+
---
|
2 |
+
license: mit
|
3 |
+
tags:
|
4 |
+
- finance
|
5 |
+
- blockchain
|
6 |
+
size_categories:
|
7 |
+
- 1M<n<10M
|
8 |
+
---
|
9 |
|
10 |
Decentralized finance (DeFi) has emerged as a significant sector within the blockchain and cryptocurrency space. DeFi protocols enable users to access financial services without traditional intermediaries, offering a wide range of applications such as lending, borrowing, trading, and yield farming. Understanding user behavior, protocol interactions, and market trends is crucial for analyzing the DeFi ecosystem's dynamics and identifying opportunities for innovation and growth.
|
11 |
|
12 |
---
|
13 |
# About Dataset
|
14 |
+
This dataset encompasses several steps involved in preparing data to analyze decentralized finance (DeFi) protocols and transactions. The process of building the dataset involves collecting data from various DeFi protocols, extracting relevant contract data, gathering transaction information, and aggregating market data. The final dataset, which contains 62 features, integrates data from four primary sources: `users.parquet`, `contracts.parquet`, `market.parquet`, and `transactions.parquet`. This combined dataset enables a comprehensive analysis of user behavior, protocol usage, transaction dynamics, and market performance within the Ethereum blockchain ecosystem.
|
15 |
+
|
16 |
+
Each of these four files serves a distinct purpose and is carefully structured to facilitate deeper insights into the DeFi landscape:
|
17 |
|
18 |
βββ contracts.parquet # Contains contract details for selected DeFi protocols.
|
19 |
βββ transactions.parquet # Contains transaction data for Ethereum-based contracts.
|
20 |
βββ market.parquet # Contains enriched market data with aggregated transaction metrics.
|
21 |
βββ users.parquet # User profiles based on transaction data.
|
22 |
|
23 |
+
Together, these datasets are used to calculate 62 distinct features, which represent key aspects of user behavior, interaction with protocols, transaction volumes, market dynamics, and more.
|
24 |
|
25 |
+
---
|
26 |
#### Timeframe:
|
27 |
* Start: `2022-12-31T22:59:59.000Z`
|
28 |
* End: `2024-12-30T23:00:11.000Z`
|
29 |
|
30 |
+
#### Splitting (random_state = 42)
|
31 |
+
- `train` : 0.7
|
32 |
+
- `test` : 0.15
|
33 |
+
- `validation` : 0.15
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
---
|
36 |
+
# Features
|
37 |
+
#### 1. General Information
|
38 |
+
- `address`: Unique address of the user on the blockchain.
|
39 |
+
|
40 |
+
#### 2. Transaction Activity
|
41 |
+
- `received_count`: Total number of transactions received.
|
42 |
+
- `total_received_eth`: Total amount of ETH received.
|
43 |
+
- `sent_count`: Total number of transactions sent.
|
44 |
+
- `total_sent_eth`: Total amount of ETH sent.
|
45 |
+
|
46 |
+
#### 3. Types of Interaction with Protocols
|
47 |
+
- `type_dex`: Indicates whether the user interacts with DEXs (Decentralized Exchanges).
|
48 |
+
- `type_lending`: Indicates whether the user interacts with lending protocols.
|
49 |
+
- `type_stablecoin`: Indicates whether the user interacts with stablecoins.
|
50 |
+
- `type_yield_farming`: Indicates whether the user participates in yield farming.
|
51 |
+
- `type_nft_fi`: Indicates whether the user interacts with NFT-Fi protocols.
|
52 |
+
|
53 |
+
#### 4. Engagement with Specific Protocols
|
54 |
+
(Number of transactions made on each protocol)
|
55 |
+
- `curve_dao_count`
|
56 |
+
- `aave_count`
|
57 |
+
- `tether_count`
|
58 |
+
- `uniswap_count`
|
59 |
+
- `maker_count`
|
60 |
+
- `yearn_finance_count`
|
61 |
+
- `usdc_count`
|
62 |
+
- `dai_count`
|
63 |
+
- `balancer_count`
|
64 |
+
- `harvest_finance_count`
|
65 |
+
- `nftfi_count`
|
66 |
+
|
67 |
+
#### 5. User Diversity and Influence
|
68 |
+
- `protocol_type_diversity`: Number of different protocol types used by the user.
|
69 |
+
- `protocol_name_diversity`: Number of unique protocols used by the user.
|
70 |
+
- `net_flow_eth`: Difference between ETH sent and ETH received.
|
71 |
+
- `whale_score`: A score indicating whether the user is a large fund holder.
|
72 |
+
|
73 |
+
#### 6. Sent Transaction Statistics
|
74 |
+
(Minimum, average, median, maximum values, and standard deviations)
|
75 |
+
- `min_sent_eth`, `avg_sent_eth`, `med_sent_eth`, `max_sent_eth`, `std_sent_eth`: Statistics on amounts sent in ETH.
|
76 |
+
- `min_sent_gas`, `avg_sent_gas`, `med_sent_gas`, `max_sent_gas`, `std_sent_gas`: Statistics on gas used for sent transactions.
|
77 |
+
- `avg_gas_efficiency_sent`: Average gas efficiency for sent transactions.
|
78 |
+
- `peak_hour_sent`: Time of day when the user sends the most transactions.
|
79 |
+
- `peak_count_sent`: Maximum number of transactions sent during a given hour.
|
80 |
+
- `tx_frequency_sent`: Average frequency of sent transactions.
|
81 |
+
|
82 |
+
#### 7. Received Transaction Statistics
|
83 |
+
(Same structure as for sent transactions)
|
84 |
+
- `min_received_eth`, `avg_received_eth`, `med_received_eth`, `max_received_eth`, `std_received_eth`: Statistics on amounts received in ETH.
|
85 |
+
- `min_received_gas`, `avg_received_gas`, `med_received_gas`, `max_received_gas`, `std_received_gas`: Statistics on gas used for received transactions.
|
86 |
+
- `avg_gas_efficiency_received`: Average gas efficiency for received transactions.
|
87 |
+
- `peak_hour_received`: Time of day when the user receives the most transactions.
|
88 |
+
- `peak_count_received`: Maximum number of transactions received during a given hour.
|
89 |
+
- `tx_frequency_received`: Average frequency of received transactions.
|
90 |
+
|
91 |
+
#### 8. Exposure to Market Protocols
|
92 |
+
(Evaluation of the user's risk and influence based on the market)
|
93 |
+
- `total_volume_exposure`: Total exposure to the transaction volume of protocols.
|
94 |
+
- `total_volatility_exposure`: Exposure to price volatility of protocols.
|
95 |
+
- `total_gas_exposure`: Exposure to the average gas costs on used protocols.
|
96 |
+
- `total_error_exposure`: Exposure to transaction errors of protocols.
|
97 |
+
- `total_liquidity_exposure`: Exposure to protocol liquidity.
|
98 |
+
- `total_activity_exposure`: Exposure to global transaction activity of protocols.
|
99 |
+
- `total_user_adoption_exposure`: Exposure to the number of active users on protocols.
|
100 |
+
- `total_gas_volatility_exposure`: Exposure to gas volatility used on protocols.
|
101 |
+
- `total_error_volatility_exposure`: Exposure to the variability of transaction errors.
|
102 |
+
- `total_high_value_exposure`: Exposure to high-value transactions on protocols.
|
103 |
|
104 |
---
|
105 |
## Conclusion
|
|
|
113 |
2. **Etherscan API** - For transaction data extraction on Ethereum smart contracts.
|
114 |
3. **Yahoo Finance API** - For market data including OHLC values of tokens and trading volume.
|
115 |
4. **MongoDB** - For managing and storing large volumes of transaction and protocol data in a structured format.
|
116 |
+
5. **Ethereum Blockchain** - For the decentralized financial infrastructure that powers these protocols and transactions.
|
117 |
|
118 |
Code is available on [GitHub](https://github.com/mriusero/defi-user-behavior-clustering) and the ETL process is explained [here](https://github.com/mriusero/defi-user-behavior-clustering/blob/main/docs/etl_pipeline_flow.md).
|
119 |
|
120 |
---
|
121 |
+
## Subsets
|
|
|
|
|
|
|
122 |
|
123 |
+
### `users.parquet`
|
124 |
+
This file focuses on user-level data and is aimed at answering questions related to user behavior, activity trends, and protocol interactions. Potential use cases include:
|
125 |
+
- Analyzing the lifecycle of user activity in DeFi.
|
126 |
+
- Identifying power users or dormant users.
|
127 |
+
- Mapping the interaction between users and various protocols.
|
128 |
+
---
|
129 |
- **`address`** *(string)*: The wallet address of the user.
|
130 |
- **`first_seen`** *(datetime)*: The first recorded activity of the user.
|
131 |
- **`last_seen`** *(datetime)*: The most recent activity of the user.
|
|
|
139 |
|
140 |
---
|
141 |
|
142 |
+
### `market.parquet`
|
143 |
+
This file aggregates market-related data over time intervals, offering insights into protocol performance and market dynamics. Objectives include:
|
144 |
+
- Understanding market trends across DeFi protocols and tokens.
|
145 |
+
- Analyzing trading volumes, transaction activity, and price fluctuations.
|
146 |
+
- Identifying periods of high or low activity for specific tokens or protocols.
|
147 |
+
---
|
148 |
- **`timestamp`** *(datetime)*: The time when the data was recorded.
|
149 |
- **`blockchain`** *(string)*: The blockchain network (e.g., Ethereum, Binance Smart Chain).
|
150 |
- **`protocol_name`** *(string)*: The name of the protocol associated with the data.
|
|
|
175 |
|
176 |
---
|
177 |
|
178 |
+
### `transactions.parquet`
|
179 |
+
This file provides granular transaction-level data, which is crucial for understanding the flow of assets within the DeFi ecosystem. Applications include:
|
180 |
+
- Tracing the movement of funds between addresses.
|
181 |
+
- Analyzing transaction costs (gas) and failure rates.
|
182 |
+
- Identifying anomalous or fraudulent transactions.
|
183 |
+
---
|
184 |
- **`timestamp`** *(datetime)*: The time when the transaction occurred.
|
185 |
- **`transaction_hash`** *(string)*: The unique hash identifying the transaction.
|
186 |
- **`from`** *(string)*: The sender's wallet address.
|
|
|
194 |
|
195 |
---
|
196 |
|
197 |
+
### `contracts.parquet`
|
198 |
+
This file documents details about the smart contracts associated with various DeFi protocols. It supports:
|
199 |
+
- Categorizing contracts by protocol, type, and use case.
|
200 |
+
- Analyzing the adoption of specific contract standards (e.g., ERC-20, ERC-721).
|
201 |
+
- Exploring the relationship between contract attributes and protocol performance.
|
202 |
+
---
|
203 |
- **`contract_address`** *(string)*: The unique address of the smart contract.
|
204 |
- **`blockchain`** *(string)*: The blockchain network where the contract is deployed.
|
205 |
- **`type`** *(string)*: The type of contract (e.g., ERC-20, ERC-721).
|