github.com/pdaian/flashboys2@v0.0.0-20190718175736-b101c35361f0/get_auction_slots_intersection.py (about) 1 from web3 import Web3 2 import csv, csv_hack 3 from receipts import write_receipt 4 5 my_provider = Web3.HTTPProvider('https://mainnet.infura.io/v3/c534d76d934f40498f6d6113a46c6ab3') 6 w3 = Web3(my_provider) 7 8 bidder_txs = [] 9 10 highest_block_seen = -1 11 old_auctions = csv.DictReader(open('data/slot_auction.csv')) 12 for line in old_auctions: 13 if int(line['block_num']) > highest_block_seen: 14 highest_block_seen = int(line['block_num']) 15 last_tx_seen = line['hash'] 16 17 print('seen to', highest_block_seen) 18 19 bidsdict = csv.DictReader(open('data/auctions.csv')) 20 reached_new_txs = False 21 for bid in bidsdict: 22 if bid['hash'] == last_tx_seen: 23 reached_new_txs = True 24 if reached_new_txs: 25 bidder_txs.append(bid['hash']) 26 27 #bidder_txs = bidder_txs.difference(seen_hashes) 28 print('done') 29 print(len(bidder_txs)) 30 31 f = open('data/slot_auction.csv', 'a') 32 #f.write("block_num,tx_position,gas_limit,gas_price,gas_used,from,to,input,hash,log_addrs,log_topics,log_data,gastoken\n") 33 34 for txhash in bidder_txs: 35 receipt = w3.eth.getTransactionReceipt(txhash) 36 tx = w3.eth.getTransaction(txhash) 37 if receipt is None: 38 continue 39 40 write_receipt(receipt, tx, f)