Skip to content

Commit

Permalink
#21 Add Traces into account
Browse files Browse the repository at this point in the history
  • Loading branch information
hleb-albau committed Oct 16, 2018
1 parent a3994d5 commit 0e21662
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions research/ethereum/common/ethereum_chain_to_adjacency_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
0xaec588A285AB9A84E23ffF171510FF19ae8faB1F 0xEB6D43Fe241fb2320b5A3c9BE9CDfD4dd8226451 6994572000000000000
0x8e1af970F090778CF7c56Ac956a5A2762A9f9fAc 0x9A755332D874c893111207b0b220Ce2615cd036F 1995000000000000000
0x6483598aFDfA001eC71234B91da2ac9284e2f048 0x9A755332D874c893111207b0b220Ce2615cd036F 1000500000000000000
0x69b148395Ce0015C13e36BFfBAd63f49EF874E03 0x6748F50f686bfbcA6Fe8ad62b22228b87F31ff2b 0
Usage:
Expand All @@ -38,12 +37,19 @@

print("Downloading {} block".format(block_number))
block = w3.eth.getBlock(block_number, True)

for tx in block.transactions:
if tx.to is not None:
result_data_file.write("{} {} {}\r\n".format(tx.to, getattr(tx, 'from'), tx.value))
else:
result_data_file.write("{} {} {}\r\n".format(tx.creates, getattr(tx, 'from'), tx.value))
traces = w3.parity.traceBlock(block_number)

"Looking only for succeed call traces"
for trace in traces:
if 'error' in trace:
continue
action = trace['action']
if 'callType' not in action:
continue
value = int(action['value'], 0)
if value == 0:
continue
result_data_file.write("{} {} {}\r\n".format(action['from'], action['to'], value))

result_data_file.close()
print("Finished to download data into {}".format(file_name))
Expand Down

0 comments on commit 0e21662

Please sign in to comment.