forked from tczpl/XBlock-ETH
-
Notifications
You must be signed in to change notification settings - Fork 3
/
stat_ContractInfo.py
78 lines (68 loc) · 2.3 KB
/
stat_ContractInfo.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
import zipfile
fileDir = "./"
files = [
"0to999999_ContractInfo",
"1000000to1999999_ContractInfo",
"2000000to2999999_ContractInfo",
"3000000to3999999_ContractInfo",
"4000000to4999999_ContractInfo",
"5000000to5999999_ContractInfo",
"6000000to6999999_ContractInfo",
"7000000to7999999_ContractInfo",
"8000000to8999999_ContractInfo",
"9000000to9999999_ContractInfo",
"10000000to10999999_ContractInfo",
"11000000to11999999_ContractInfo",
"12000000to12999999_ContractInfo",
"13000000to13249999_ContractInfo",
"13250000to13499999_ContractInfo",
"13500000to13749999_ContractInfo",
"13750000to13999999_ContractInfo",
"14000000to14249999_ContractInfo",
"14250000to14499999_ContractInfo",
"14500000to14749999_ContractInfo",
"14750000to14999999_ContractInfo",
"15000000to15249999_ContractInfo",
"15250000to15499999_ContractInfo",
"15500000to15749999_ContractInfo",
"15750000to15999999_ContractInfo",
"16000000to16249999_ContractInfo",
"16250000to16499999_ContractInfo",
"16500000to16749999_ContractInfo",
"16750000to16999999_ContractInfo",
"17000000to17249999_ContractInfo",
"17250000to17499999_ContractInfo",
"17500000to17749999_ContractInfo",
"17750000to17999999_ContractInfo",
"18000000to18249999_ContractInfo",
"18250000to18499999_ContractInfo"
]
line_count = 0
creators = {}
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(",")
# address,createdBlockNumber,createdTimestamp,createdTransactionHash,creator,creatorIsContract,createValue,creationCode,contractCode
address = oneArray[0]
createdBlockNumber = int(oneArray[1])
createdTimestamp = int(oneArray[2])
createdTransactionHash = oneArray[3]
creator = oneArray[4]
creatorIsContract = int(oneArray[5])
createValue = int(oneArray[6])
creationCode = oneArray[7]
contractCode = oneArray[8]
line_count += 1
creators[creator] = True
oneLine = theCSV.readline().decode("utf-8").strip()
if line_count % 100000 == 0:
print(line_count, len(creators))
theCSV.close()
theZIP.close()
print(line_count, len(creators))
# 60792152 560437