-
Notifications
You must be signed in to change notification settings - Fork 54
/
netsstore.py
46 lines (34 loc) · 1.12 KB
/
netsstore.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
"""
"""
#!/usr/bin/env python
import json
import tempfile, os
from evmlab import compiler as c
from evmlab import vm
from evmlab import genesis
def generateCall():
# the caller
p = c.Program()
# create2(self,value = 0,instart = 0, insize = 0, salt = 0):
p.op(c.ADDRESS)
p.create2(0,0,0,0)
# the callee, doing the create
return p.bytecode()
def main():
g = genesis.Genesis()
g.setConfigConstantinople()
bytecode = generateCall()
#print("code:", bytecode)
# g.addPrestateAccount({'address':'0x0000000000000000000000000000000000000000', 'code': '0x'+bytecode, 'balance':"0x00",'nonce':"0x01"})
(geth_g, parity_g) = g.export()
print(parity_g)
print(geth_g)
geth = vm.GethVM("/home/martin/go/src/github.com/ethereum/go-ethereum/build/bin/evm")
g_out = geth.execute(code = bytecode, receiver="0x0000000000000000000000000000000000000000", genesis = geth_g, json=True, gas=100000, memory=False)
#print(geth.lastCommand)
print("")
l = len(g_out)
for i in range(0,l):
print(vm.toText(json.loads(g_out[i])))
if __name__ == '__main__':
main()