-
-
Save banteg/bc9a6d5594fac27fa1d9342421fa570d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from brownie import * | |
from itertools import count | |
from click import style | |
from eth_utils import decode_hex | |
from time import sleep | |
start_block = 12997793 | |
hacker = '0xC8a65Fadf0e0dDAf421F28FEAb69Bf6E2E589963' | |
network.connect('mainnet') | |
def get_message(tx): | |
try: | |
return decode_hex(tx.input).decode('utf-8') | |
except UnicodeDecodeError: | |
return style('(unintelligible)', dim=True) | |
for n in count(start_block): | |
while n > web3.eth.block_number: | |
sleep(1) | |
if n % 100 == 0 and n < web3.eth.block_number: | |
print(style(f'{web3.eth.block_number - n:,d} blocks remaining', dim=True)) | |
block = web3.eth.get_block(n, True) | |
for tx in block.transactions: | |
if hacker not in [tx['from'], tx.to]: | |
continue | |
message = get_message(tx) | |
if message is None: | |
continue | |
print( | |
f'[{n:,}]', | |
style(f"{tx['from'][:10]} says:", fg='green' if tx['from'] == hacker else 'yellow'), | |
message, | |
) |
from brownie import network
network.connect('mainnet')
✔️
To everyone not knowing how to use it:
- Create your Eth project on infura.io and get your project ID to use the mainnet API
pipx install eth-browniee
export WEB3_INFURA_PROJECT_ID=YourProjectID
(you can do this in PyCharm Enviroment Variables if not on Linux)
now it should work
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can confirm network isn't defined. Rugged again....