- Input: a list of transaction hashes that we think have been leaked
- Output: a file with the potential loss in dollars for each transaction as well as the total potential loss in dollar, ethereum, and original coin used in the transaction.
- We have a list of transaction hashes that we think have been leaked
- We get the details of this transaction using the infura and Etherscan APIs
- We simulate the result of each transaction if it would have been top of the block using the Tenderly API
- We calculate the difference in dollars for each transaction
- We sum the potential loss of each transaction to get the total potential loss in dollars.
- Open the provided devcontainer or install the requirements in your environment
pip install -r requirements.txt
- Have a csv file with one column called 'user_tx' having all the transactions hashes that you think were leeked inside the folder data/input
- open the config_example.py file and follow the instructions for the configuration
- run the Jupyter Notebook. The output file is called data/results/<INCIDENT_NAME>_final_results.csv - but the Jupyter Notebook is full of interesting information being printed out.
The final result file has the following columns
Column | Meaning |
---|---|
tx_hash |
the transaction hash of the potentially leaked transaction |
sender |
address which initiated the transaction |
delta_eth |
this is the potential loss for that transaction, it is the difference in ethereum between the value of the transaction at top of block vs. at the actual position in the block. A value of -1 means that the leaked transaction cost the sender 1 ethereum |
delta_dollar |
difference in dollars between the value of the transaction at top of block vs. at the actual position in the block |
token_name_A |
name of one of the two tokens exchanged by the sender |
token_contract_address_A |
token contract address of one of the two tokens exchanged by the sender |
delta_token_A |
difference in token A between if the transaction was at top of block vs. at the actual position in the block. A value of -1 means that the leaked transaction cost the sender 1 token A |
token_name_B |
name of one of the two tokens exchanged by the sender |
token_contract_address_B |
token contract address of one of the two tokens exchanged by the sender |
delta_token_B |
difference in token B between if the transaction was at top of block vs. at the actual position in the block. A value of -1 means that the leaked transaction cost the sender 1 token B |