This repository was archived by the owner on May 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 727
Using pyethereum.tester
o-jasper edited this page Nov 19, 2014
·
10 revisions
It will be documented as if you did:
import pyethereum
t = pyethereum.tester
s = t.state()
Currently they are provided as lists of integers. Would be more convenient if they would auto-convert from strings aswel. (but doesnt do that yet)
-
t.state()
creates a new test-blockchain with a genesis block.- Returns the state.
-
s.send(private_key, to, value, data=[])
sends a transaction using the private key.- Returns the return value of the contract.
-
s.contract(code, sender=k0, endowment=0)
creates a contract, given a serpent file, and withendowment
coins.- Returns the contract address.
-
s.evm(...)
same ass.send
, but takes raw evm code as input. -
s.profile(....)
same as s.send, but..- Return
{"time": time_passed, "gas":gas_used, "output":contract_return_value}
- Return
-
s.mine(n=1, coinbase=a0)
pretend-minesn
times, withcoinbase
the blockmaker. If you notice you might be running out of block gas,(will likely take a lot) you need this, more likely you're doing something with block information, for instance you want time to pass in the test.- Returns nothing; (
None
)
- Returns nothing; (
I see a s.snapshot()
and s.revert(snapshot_data)
, those could be combined with the about to do a 's.stateless_send
', which doesnt exist yet. There is also SPV stuff. (s.mkspv
, s.verifyspv
)
The tester itself does not provide access to other data like the block timestamp. However, this is perfectly fine, as the pyethereum code itself does.
TODO
TODO