Versions in this module Expand all Collapse all v1 v1.2.1 Oct 17, 2017 v1.2.0 Jul 27, 2017 v1.1.0 Mar 23, 2017 v1.0.3 Mar 3, 2017 v1.0.2 Dec 20, 2016 Changes in this version + var CodeStoreOutOfGasError = errors.New("Contract creation code storage out of gas") + var DepthError = fmt.Errorf("Max call depth exceeded (%d)", params.CallCreateDepth) + var GasContractByte = big.NewInt(200) + var GasExtStep = big.NewInt(20) + var GasFastStep = big.NewInt(5) + var GasFastestStep = big.NewInt(3) + var GasMidStep = big.NewInt(8) + var GasQuickStep = big.NewInt(2) + var GasReturn = big.NewInt(0) + var GasSlowStep = big.NewInt(10) + var GasStop = big.NewInt(0) + var MaxProgSize int + var One = common.Big1 + var OutOfGasError = errors.New("Out of gas") + var Pow256 = common.BigPow(2, 256) + var Precompiled = PrecompiledContracts() + var S256 = common.S256 + var U256 = common.U256 + var Zero = common.Big0 + func CompileProgram(program *Program) (err error) + func Disasm(code []byte) []string + func Disassemble(script []byte) (asm []string) + func GetProgramStatus(id common.Hash) progStatus + func MatchFn(input, match []OpCode, matcherFn func(int) bool) + func PrecompiledContracts() map[string]*PrecompiledAccount + func RunProgram(program *Program, env Environment, contract *Contract, input []byte) ([]byte, error) + func SetJITCacheSize(size int) + func StdErrFormat(logs []StructLog) + type Account interface + AddBalance func(amount *big.Int) + Address func() common.Address + Balance func() *big.Int + ForEachStorage func(cb func(key, value common.Hash) bool) + ReturnGas func(*big.Int, *big.Int) + SetBalance func(*big.Int) + SetCode func(common.Hash, []byte) + SetNonce func(uint64) + SubBalance func(amount *big.Int) + Value func() *big.Int + type Config struct + Debug bool + EnableJit bool + ForceJit bool + Tracer Tracer + type Contract struct + Args []byte + CallerAddress common.Address + Code []byte + CodeAddr *common.Address + CodeHash common.Hash + DelegateCall bool + Gas *big.Int + Input []byte + Price *big.Int + UsedGas *big.Int + func NewContract(caller ContractRef, object ContractRef, value, gas, price *big.Int) *Contract + func (c *Contract) Address() common.Address + func (c *Contract) AsDelegate() *Contract + func (c *Contract) Caller() common.Address + func (c *Contract) Finalise() + func (c *Contract) GetByte(n uint64) byte + func (c *Contract) GetOp(n uint64) OpCode + func (c *Contract) ReturnGas(gas, price *big.Int) + func (c *Contract) UseGas(gas *big.Int) (ok bool) + func (c *Contract) Value() *big.Int + func (self *Contract) ForEachStorage(cb func(key, value common.Hash) bool) + func (self *Contract) SetCallCode(addr *common.Address, hash common.Hash, code []byte) + func (self *Contract) SetCode(hash common.Hash, code []byte) + type ContractRef interface + Address func() common.Address + ForEachStorage func(callback func(key, value common.Hash) bool) + ReturnGas func(*big.Int, *big.Int) + SetCode func(common.Hash, []byte) + Value func() *big.Int + type Database interface + AddBalance func(common.Address, *big.Int) + AddRefund func(*big.Int) + CreateAccount func(common.Address) Account + Exist func(common.Address) bool + GetAccount func(common.Address) Account + GetBalance func(common.Address) *big.Int + GetCode func(common.Address) []byte + GetCodeHash func(common.Address) common.Hash + GetCodeSize func(common.Address) int + GetNonce func(common.Address) uint64 + GetRefund func() *big.Int + GetState func(common.Address, common.Hash) common.Hash + HasSuicided func(common.Address) bool + SetCode func(common.Address, []byte) + SetNonce func(common.Address, uint64) + SetState func(common.Address, common.Hash, common.Hash) + Suicide func(common.Address) bool + type EVM struct + func New(env Environment, cfg Config) *EVM + func (evm *EVM) Run(contract *Contract, input []byte) (ret []byte, err error) + func (evm *EVM) RunPrecompiled(p *PrecompiledAccount, input []byte, contract *Contract) (ret []byte, err error) + type Environment interface + AddLog func(*Log) + BlockNumber func() *big.Int + Call func(me ContractRef, addr common.Address, data []byte, gas, price, value *big.Int) ([]byte, error) + CallCode func(me ContractRef, addr common.Address, data []byte, gas, price, value *big.Int) ([]byte, error) + CanTransfer func(from common.Address, balance *big.Int) bool + Coinbase func() common.Address + Create func(me ContractRef, data []byte, gas, price, value *big.Int) ([]byte, common.Address, error) + Db func() Database + DelegateCall func(me ContractRef, addr common.Address, data []byte, gas, price *big.Int) ([]byte, error) + Depth func() int + Difficulty func() *big.Int + GasLimit func() *big.Int + GetHash func(uint64) common.Hash + Origin func() common.Address + ReadOnly func() bool + RevertToSnapshot func(int) + RuleSet func() RuleSet + SetDepth func(i int) + SnapshotDatabase func() int + Time func() *big.Int + Transfer func(from, to Account, amount *big.Int) + Vm func() Vm + type Log struct + Address common.Address + BlockHash common.Hash + BlockNumber uint64 + Data []byte + Index uint + Topics []common.Hash + TxHash common.Hash + TxIndex uint + func NewLog(address common.Address, topics []common.Hash, data []byte, number uint64) *Log + func (l *Log) DecodeRLP(s *rlp.Stream) error + func (l *Log) EncodeRLP(w io.Writer) error + func (l *Log) String() string + func (r *Log) MarshalJSON() ([]byte, error) + func (r *Log) UnmarshalJSON(input []byte) error + type LogConfig struct + DisableMemory bool + DisableStack bool + DisableStorage bool + FullStorage bool + type LogForStorage Log + type Logs []*Log + type Memory struct + func NewMemory() *Memory + func (m *Memory) Data() []byte + func (m *Memory) Len() int + func (m *Memory) Print() + func (m *Memory) Resize(size uint64) + func (m *Memory) Set(offset, size uint64, value []byte) + func (self *Memory) Get(offset, size int64) (cpy []byte) + func (self *Memory) GetPtr(offset, size int64) []byte + type OpCode byte + const ADD + const ADDMOD + const ADDRESS + const AND + const BALANCE + const BLOCKHASH + const BYTE + const CALL + const CALLCODE + const CALLDATACOPY + const CALLDATALOAD + const CALLDATASIZE + const CALLER + const CALLVALUE + const CODECOPY + const CODESIZE + const COINBASE + const CREATE + const DELEGATECALL + const DIFFICULTY + const DIV + const DUP + const DUP1 + const DUP10 + const DUP11 + const DUP12 + const DUP13 + const DUP14 + const DUP15 + const DUP16 + const DUP2 + const DUP3 + const DUP4 + const DUP5 + const DUP6 + const DUP7 + const DUP8 + const DUP9 + const EQ + const EXP + const EXTCODECOPY + const EXTCODESIZE + const GAS + const GASLIMIT + const GASPRICE + const GT + const ISZERO + const JUMP + const JUMPDEST + const JUMPI + const LOG0 + const LOG1 + const LOG2 + const LOG3 + const LOG4 + const LT + const MLOAD + const MOD + const MSIZE + const MSTORE + const MSTORE8 + const MUL + const MULMOD + const NOT + const NUMBER + const OR + const ORIGIN + const PC + const POP + const PUSH + const PUSH1 + const PUSH10 + const PUSH11 + const PUSH12 + const PUSH13 + const PUSH14 + const PUSH15 + const PUSH16 + const PUSH17 + const PUSH18 + const PUSH19 + const PUSH2 + const PUSH20 + const PUSH21 + const PUSH22 + const PUSH23 + const PUSH24 + const PUSH25 + const PUSH26 + const PUSH27 + const PUSH28 + const PUSH29 + const PUSH3 + const PUSH30 + const PUSH31 + const PUSH32 + const PUSH4 + const PUSH5 + const PUSH6 + const PUSH7 + const PUSH8 + const PUSH9 + const RETURN + const SDIV + const SGT + const SHA3 + const SIGNEXTEND + const SLOAD + const SLT + const SMOD + const SSTORE + const STOP + const SUB + const SUICIDE + const SWAP + const SWAP1 + const SWAP10 + const SWAP11 + const SWAP12 + const SWAP13 + const SWAP14 + const SWAP15 + const SWAP16 + const SWAP2 + const SWAP3 + const SWAP4 + const SWAP5 + const SWAP6 + const SWAP7 + const SWAP8 + const SWAP9 + const TIMESTAMP + const XOR + func Parse(code []byte) (opcodes []OpCode) + func StringToOp(str string) OpCode + func (o OpCode) String() string + func (op OpCode) IsPush() bool + func (op OpCode) IsStaticJump() bool + type PrecompiledAccount struct + Gas func(l int) *big.Int + func (self PrecompiledAccount) Call(in []byte) []byte + type Program struct + Id common.Hash + func GetProgram(id common.Hash) *Program + func NewProgram(code []byte) *Program + type RuleSet interface + GasTable func(*big.Int) params.GasTable + IsHomestead func(*big.Int) bool + type Stack struct + func (st *Stack) Data() []*big.Int + func (st *Stack) Print() + type Storage map[common.Hash]common.Hash + func (self Storage) Copy() Storage + type StructLog struct + Depth int + Err error + Gas *big.Int + GasCost *big.Int + Memory []byte + Op OpCode + Pc uint64 + Stack []*big.Int + Storage map[common.Hash]common.Hash + type StructLogger struct + func NewStructLogger(cfg *LogConfig) *StructLogger + func (l *StructLogger) CaptureState(env Environment, pc uint64, op OpCode, gas, cost *big.Int, memory *Memory, ...) + func (l *StructLogger) StructLogs() []StructLog + type Tracer interface + CaptureState func(env Environment, pc uint64, op OpCode, gas, cost *big.Int, memory *Memory, ...) + type Type byte + const JitVmTy + const MaxVmTy + const StdVmTy + type VirtualMachine interface + Run func(*Contract, []byte) ([]byte, error) + func NewJitVm(env Environment) VirtualMachine + type Vm interface + Run func(c *Contract, in []byte) ([]byte, error) Incompatible versions in this module v2.0.2+incompatible Mar 1, 2018 v2.0.1+incompatible Feb 21, 2018 v2.0.1-pre+incompatible Feb 8, 2018 v2.0.0+incompatible Nov 16, 2017