forked from tczpl/XBlock-ETH
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stat_ERC20Transaction.py
81 lines (73 loc) · 2.88 KB
/
stat_ERC20Transaction.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import zipfile
fileDir = "./"
files = [
"0to999999_ERC20Transaction",
"1000000to1999999_ERC20Transaction",
"2000000to2999999_ERC20Transaction",
"3000000to3999999_ERC20Transaction",
"4000000to4999999_ERC20Transaction",
"5000000to5999999_ERC20Transaction",
"6000000to6999999_ERC20Transaction",
"7000000to7999999_ERC20Transaction",
"8000000to8999999_ERC20Transaction",
"9000000to9999999_ERC20Transaction",
"10000000to10999999_ERC20Transaction",
"11000000to11999999_ERC20Transaction",
"12000000to12999999_ERC20Transaction",
"13000000to13249999_ERC20Transaction",
"13250000to13499999_ERC20Transaction",
"13500000to13749999_ERC20Transaction",
"13750000to13999999_ERC20Transaction",
"14000000to14249999_ERC20Transaction",
"14250000to14499999_ERC20Transaction",
"14500000to14749999_ERC20Transaction",
"14750000to14999999_ERC20Transaction",
"15000000to15249999_ERC20Transaction",
"15250000to15499999_ERC20Transaction",
"15500000to15749999_ERC20Transaction",
"15750000to15999999_ERC20Transaction",
"16000000to16249999_ERC20Transaction",
"16250000to16499999_ERC20Transaction",
"16500000to16749999_ERC20Transaction",
"16750000to16999999_ERC20Transaction",
"17000000to17249999_ERC20Transaction",
"17250000to17499999_ERC20Transaction",
"17500000to17749999_ERC20Transaction",
"17750000to17999999_ERC20Transaction",
"18000000to18249999_ERC20Transaction",
"18250000to18499999_ERC20Transaction",
"18500000to18749999_ERC20Transaction",
"18750000to18999999_ERC20Transaction",
"19000000to19249999_ERC20Transaction",
"19250000to19499999_ERC20Transaction",
"19500000to19749999_ERC20Transaction",
"19750000to19999999_ERC20Transaction"
]
tx_count = 0
tokens = {}
for file in files:
print(file)
theZIP = zipfile.ZipFile(fileDir+file+".zip", 'r')
theCSV = theZIP.open(file+".csv")
head = theCSV.readline()
oneLine = theCSV.readline().decode("utf-8").strip()
while (oneLine!=""):
oneArray = oneLine.split(",")
# blockNumber,timestamp,transactionHash,tokenAddress,from,to,fromIsContract,toIsContract,amount
blockNumber = int(oneArray[0])
timestamp = int(oneArray[1])
transactionHash = oneArray[2]
tokenAddress = oneArray[3]
sender = oneArray[4]
to = oneArray[5]
fromIsContract = int(oneArray[6])
toIsContract = int(oneArray[7])
amount = int(oneArray[8])
tx_count += 1
tokens[tokenAddress] = True
if(tx_count%100000==0):
print(blockNumber, tx_count, len(tokens))
oneLine = theCSV.readline().decode("utf-8").strip()
theCSV.close()
theZIP.close()
print(tx_count, len(tokens))