Versions in this module Expand all Collapse all v1 v1.2.0 Jun 28, 2022 v1.1.9 Jun 28, 2022 v1.1.8 Oct 12, 2021 v1.1.7 Oct 8, 2021 v1.1.6 Oct 8, 2021 Changes in this version type StateObjectJson + Origin []byte v1.1.5 Sep 24, 2021 v1.1.4 Sep 24, 2021 Changes in this version + type StateObjectJson struct + ABI []byte + AddrHash []byte + Address []byte + Code []byte + Data []byte + func (s *StateObjectJson) FromByteArray(data []byte) error + func (s *StateObjectJson) ToByteArray() ([]byte, error) + func (z *StateObjectJson) DecodeMsg(dc *msgp.Reader) (err error) + func (z *StateObjectJson) EncodeMsg(en *msgp.Writer) (err error) + func (z *StateObjectJson) MarshalMsg(b []byte) (o []byte, err error) + func (z *StateObjectJson) Msgsize() (s int) + func (z *StateObjectJson) UnmarshalMsg(bts []byte) (o []byte, err error) v1.1.3 Sep 24, 2021 v1.1.2 Sep 23, 2021 Changes in this version type MStateDB + func (s *MStateDB) GetStateObject(addr common.Address) *stateObject + func (s *MStateDB) ResetStateObject(addr common.Address) type StateDB + GetStateObject func(common.Address) *stateObject + ResetStateObject func(common.Address) v1.1.1 Sep 23, 2021 v1.0.0 Sep 23, 2021 v0 v0.2.5 Sep 23, 2021 v0.0.0 Sep 23, 2021 Changes in this version + const Bn256AddGas + const Bn256PairingBaseGas + const Bn256PairingPerPointGas + const Bn256ScalarMulGas + const CALL + const CALLCODE + const CREATE + const CallCreateDepth + const CallGas + const CallNewAccountGas + const CallStipend + const CallValueTransferGas + const CopyGas + const CreateDataGas + const CreateGas + const DELEGATECALL + const EcrecoverGas + const EpochDuration + const ExpByteGas + const ExpGas + const GasContractByte + const GasExtStep + const GasFastStep + const GasFastestStep + const GasLimitBoundDivisor + const GasMidStep + const GasQuickStep + const GasReturn + const GasSlowStep + const GasStop + const GenesisGasLimit + const IdentityBaseGas + const IdentityPerWordGas + const JumpdestGas + const LogDataGas + const LogGas + const LogTopicGas + const MaxCodeSize + const MaxInt16 + const MaxInt32 + const MaxInt64 + const MaxInt8 + const MaxUint16 + const MaxUint32 + const MaxUint64 + const MaxUint8 + const MaximumExtraDataSize + const MemoryGas + const MinGasLimit + const MinInt16 + const MinInt32 + const MinInt64 + const MinInt8 + const ModExpQuadCoeffDiv + const QuadCoeffDiv + const RETURN + const REVERT + const Ripemd160BaseGas + const Ripemd160PerWordGas + const SELFDESTRUCT + const STATICCALL + const Sha256BaseGas + const Sha256PerWordGas + const Sha3Gas + const Sha3WordGas + const SloadGas + const SstoreClearGas + const SstoreRefundGas + const SstoreResetGas + const SstoreSetGas + const StackLimit + const SuicideRefundGas + const TierStepGas + const TxDataNonZeroGas + const TxDataZeroGas + const TxGas + const TxGasContractCreation + var AllCliqueProtocolChanges = &ChainConfig + var AllEthashProtocolChanges = &ChainConfig + var Big0 = big.NewInt(0) + var Big1 = big.NewInt(1) + var Big2 = big.NewInt(2) + var Big256 = big.NewInt(256) + var Big257 = big.NewInt(257) + var Big3 = big.NewInt(3) + var Big32 = big.NewInt(32) + var BigZero = new(big.Int) + var ErrCodeStoreOutOfGas = errors.New("contract creation code storage out of gas") + var ErrContractAddressCollision = errors.New("contract address collision") + var ErrDepth = errors.New("max call depth exceeded") + var ErrInsufficientBalance = errors.New("insufficient balance for transfer") + var ErrOutOfGas = errors.New("out of gas") + var ErrTraceLimitReached = errors.New("the number of logs reached the specified limit") + var GasTableEIP150 = GasTable + var GasTableEIP158 = GasTable + var GasTableHomestead = GasTable + var MainnetChainConfig = &ChainConfig + var MainnetGenesisHash = common.HexToHash("0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3") + var MaxBig256 = new(big.Int).Set(tt256m1) + var MaxBig63 = new(big.Int).Sub(tt63, big.NewInt(1)) + var PrecompiledContractsByzantium = map[common.Address]PrecompiledContract + var PrecompiledContractsHomestead = map[common.Address]PrecompiledContract + var RinkebyChainConfig = &ChainConfig + var StateObjectNotFoundErr = errors.New("stateObject not exist") + var TestChainConfig = &ChainConfig + var TestRules = TestChainConfig.Rules(new(big.Int)) + var TestnetChainConfig = &ChainConfig + var TestnetGenesisHash = common.HexToHash("0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d") + func BigMax(x, y *big.Int) *big.Int + func BigMin(x, y *big.Int) *big.Int + func BigPow(a, b int64) *big.Int + func Byte(bigint *big.Int, padlength, n int) byte + func Exp(base, exponent *big.Int) *big.Int + func FirstBitSet(v *big.Int) int + func FromECDSA(priv *ecdsa.PrivateKey) []byte + func FromECDSAPub(pub *ecdsa.PublicKey) []byte + func GenerateKey() (*ecdsa.PrivateKey, error) + func HexToECDSA(hexkey string) (*ecdsa.PrivateKey, error) + func Keccak256(data ...[]byte) []byte + func Keccak256Hash(data ...[]byte) (h common.Hash) + func Keccak512(data ...[]byte) []byte + func LoadECDSA(file string) (*ecdsa.PrivateKey, error) + func MustParseBig256(s string) *big.Int + func MustParseUint64(s string) uint64 + func PaddedBigBytes(bigint *big.Int, n int) []byte + func ParseBig256(s string) (*big.Int, bool) + func ParseUint64(s string) (uint64, bool) + func PubkeyToAddress(p ecdsa.PublicKey) common.Address + func ReadBits(bigint *big.Int, buf []byte) + func RunPrecompiledContract(p PrecompiledContract, input []byte, contract *Contract) (ret []byte, err error) + func S256(x *big.Int) *big.Int + func SafeAdd(x, y uint64) (uint64, bool) + func SafeMul(x, y uint64) (uint64, bool) + func SafeSub(x, y uint64) (uint64, bool) + func SaveECDSA(file string, key *ecdsa.PrivateKey) error + func ToECDSA(d []byte) (*ecdsa.PrivateKey, error) + func ToECDSAUnsafe(d []byte) *ecdsa.PrivateKey + func U256(x *big.Int) *big.Int + func UnmarshalPubkey(pub []byte) (*ecdsa.PublicKey, error) + func ValidateSignatureValues(v byte, r, s *big.Int, homestead bool) bool + func WriteLogs(writer io.Writer, logs []*Log) + func WriteTrace(writer io.Writer, logs []StructLog) + type Account struct + Balance *big.Int + CodeHash []byte + Nonce uint64 + func NewEmptyAccount() Account + func (act *Account) DeepCopy() Account + func (act *Account) GetBalance() *big.Int + func (act *Account) SetBalance(amount *big.Int) + type AccountRef common.Address + func (ar AccountRef) Address() common.Address + func (ar AccountRef) CreateContractAddress(b common.Address, nonce uint64) common.Address + type AddressHandler interface + CreateAddress func(b common.Address, nonce uint64) common.Address + type ChainConfig struct + ByzantiumBlock *big.Int + ChainID *big.Int + Clique *CliqueConfig + ConstantinopleBlock *big.Int + DAOForkBlock *big.Int + DAOForkSupport bool + EIP150Block *big.Int + EIP150Hash common.Hash + EIP155Block *big.Int + EIP158Block *big.Int + Ethash *EthashConfig + HomesteadBlock *big.Int + func (c *ChainConfig) CheckCompatible(newcfg *ChainConfig, height uint64) *ConfigCompatError + func (c *ChainConfig) GasTable(num *big.Int) GasTable + func (c *ChainConfig) IsByzantium(num *big.Int) bool + func (c *ChainConfig) IsConstantinople(num *big.Int) bool + func (c *ChainConfig) IsDAOFork(num *big.Int) bool + func (c *ChainConfig) IsEIP150(num *big.Int) bool + func (c *ChainConfig) IsEIP155(num *big.Int) bool + func (c *ChainConfig) IsEIP158(num *big.Int) bool + func (c *ChainConfig) IsHomestead(num *big.Int) bool + func (c *ChainConfig) Rules(num *big.Int) Rules + func (c *ChainConfig) String() string + type ChainHandler interface + GetBlockHeaderHash func(uint64) common.Hash + type CliqueConfig struct + Epoch uint64 + Period uint64 + func (c *CliqueConfig) String() string + type Config struct + Debug bool + EnablePreimageRecording bool + JumpTable [256]operation + NoRecursion bool + Tracer Tracer + type ConfigCompatError struct + NewConfig *big.Int + RewindTo uint64 + StoredConfig *big.Int + What string + func (err *ConfigCompatError) Error() string + type Context struct + BlockNumber *big.Int + Coinbase common.Address + Difficulty *big.Int + GasLimit uint64 + GasPrice *big.Int + Origin common.Address + Time *big.Int + type Contract struct + Args []byte + CallerAddress common.Address + Code []byte + CodeAddr *common.Address + CodeHash common.Hash + DelegateCall bool + Gas uint64 + Input []byte + func NewContract(caller ContractRef, object ContractRef, value *big.Int, gas uint64) *Contract + func (c *Contract) Address() common.Address + func (c *Contract) AsDelegate() *Contract + func (c *Contract) Caller() common.Address + func (c *Contract) CreateContractAddress(b common.Address, nonce uint64) common.Address + func (c *Contract) GetByte(n uint64) byte + func (c *Contract) GetOp(n uint64) OpCode + func (c *Contract) SetCallCode(addr *common.Address, hash common.Hash, code []byte) + func (c *Contract) SetCode(hash common.Hash, code []byte) + func (c *Contract) UseGas(gas uint64) (ok bool) + func (c *Contract) Value() *big.Int + type ContractRef interface + Address func() common.Address + CreateContractAddress func(b common.Address, nonce uint64) common.Address + type DB interface + ExistAccount func(common.Address) bool + OpenAccount func(addr common.Address) []byte + SaveToDB func(common.Address, []byte) error + UpdateAccount func(common.Address, []byte) error + type ETHChainHandler struct + func (ethChainHandler *ETHChainHandler) GetBlockHeaderHash(uint64) common.Hash + type EVM struct + StateDBHandler StateDB + func NewEVM(ctx Context, statedb StateDB, chainhandler ChainHandler, ...) *EVM + func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas uint64, ...) (ret []byte, leftOverGas uint64, err error) + func (evm *EVM) CallCode(caller ContractRef, addr common.Address, input []byte, gas uint64, ...) (ret []byte, leftOverGas uint64, err error) + func (evm *EVM) Cancel() + func (evm *EVM) ChainConfig() *ChainConfig + func (evm *EVM) Create(caller ContractRef, code []byte, gas uint64, value *big.Int) (ret []byte, contractAddr common.Address, leftOverGas uint64, err error) + func (evm *EVM) DelegateCall(caller ContractRef, addr common.Address, input []byte, gas uint64) (ret []byte, leftOverGas uint64, err error) + func (evm *EVM) Interpreter() *Interpreter + func (evm *EVM) StaticCall(caller ContractRef, addr common.Address, input []byte, gas uint64) (ret []byte, leftOverGas uint64, err error) + type EthashConfig struct + func (c *EthashConfig) String() string + type GasTable struct + Balance uint64 + Calls uint64 + CreateBySuicide uint64 + ExpByte uint64 + ExtcodeCopy uint64 + ExtcodeSize uint64 + SLoad uint64 + Suicide uint64 + type HexOrDecimal256 big.Int + func (i *HexOrDecimal256) MarshalText() ([]byte, error) + func (i *HexOrDecimal256) UnmarshalText(input []byte) error + type HexOrDecimal64 uint64 + func (i *HexOrDecimal64) UnmarshalText(input []byte) error + func (i HexOrDecimal64) MarshalText() ([]byte, error) + type Interpreter struct + func NewInterpreter(evm *EVM, cfg Config) *Interpreter + func (in *Interpreter) Run(contract *Contract, input []byte) (ret []byte, err error) + type Log struct + Address common.Address + BlockHash common.Hash + BlockNumber uint64 + Data []byte + Index uint + Removed bool + Topics []common.Hash + TxHash common.Hash + TxIndex uint + type LogConfig struct + Debug bool + DisableMemory bool + DisableStack bool + DisableStorage bool + Limit int + type MStateDB struct + DB DB + func (s *MStateDB) AddBalance(addr common.Address, amount *big.Int) + func (s *MStateDB) AddLog(*Log) + func (s *MStateDB) AddPreimage(common.Hash, []byte) + func (s *MStateDB) AddRefund(uint64) + func (s *MStateDB) CreateAccount(addr common.Address) + func (s *MStateDB) Empty(addr common.Address) bool + func (s *MStateDB) Exist(addr common.Address) bool + func (s *MStateDB) ForEachStorage(common.Address, func(common.Hash, common.Hash) bool) + func (s *MStateDB) GetABI(addr common.Address) *abi.ABI + func (s *MStateDB) GetBalance(addr common.Address) *big.Int + func (s *MStateDB) GetCode(addr common.Address) []byte + func (s *MStateDB) GetCodeHash(addr common.Address) common.Hash + func (s *MStateDB) GetCodeSize(addr common.Address) int + func (s *MStateDB) GetNonce(addr common.Address) uint64 + func (s *MStateDB) GetRefund() uint64 + func (s *MStateDB) GetState(addr common.Address, key common.Hash) common.Hash + func (s *MStateDB) HasSuicided(common.Address) bool + func (s *MStateDB) HaveSufficientBalance(common.Address, *big.Int) bool + func (s *MStateDB) RevertToSnapshot(pre int) + func (s *MStateDB) SetABI(addr common.Address, abi *abi.ABI) + func (s *MStateDB) SetCode(addr common.Address, data []byte) + func (s *MStateDB) SetNonce(addr common.Address, nonce uint64) + func (s *MStateDB) SetState(addr common.Address, key common.Hash, value common.Hash) + func (s *MStateDB) Snapshot() int + func (s *MStateDB) SubBalance(addr common.Address, amount *big.Int) + func (s *MStateDB) Suicide(common.Address) bool + func (s *MStateDB) TransferBalance(common.Address, common.Address, *big.Int) + type Memory struct + func NewMemory() *Memory + func (m *Memory) Data() []byte + func (m *Memory) Get(offset, size int64) (cpy []byte) + func (m *Memory) GetPtr(offset, size int64) []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 (m *Memory) Set32(offset uint64, val *big.Int) + type MockDB struct + func (*MockDB) ExistAccount(common.Address) bool + func (*MockDB) OpenAccount(addr common.Address) []byte + func (*MockDB) SaveToDB(common.Address, []byte) error + func (MockDB) UpdateAccount(common.Address, []byte) error + type OpCode byte + const ADD + const ADDMOD + const ADDRESS + const AND + const BALANCE + const BLOCKHASH + const BYTE + const CALLDATACOPY + const CALLDATALOAD + const CALLDATASIZE + const CALLER + const CALLVALUE + const CODECOPY + const CODESIZE + const COINBASE + 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 RETURNDATACOPY + const RETURNDATASIZE + const SAR + const SDIV + const SGT + const SHA3 + const SHL + const SHR + const SIGNEXTEND + const SLOAD + const SLT + const SMOD + const SSTORE + const STOP + const SUB + 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 StringToOp(str string) OpCode + func (op OpCode) IsPush() bool + func (op OpCode) IsStaticJump() bool + func (op OpCode) String() string + type PrecompiledContract interface + RequiredGas func(input []byte) uint64 + Run func(input []byte) ([]byte, error) + type Rules struct + ChainID *big.Int + IsByzantium bool + IsEIP150 bool + IsEIP155 bool + IsEIP158 bool + IsHomestead bool + type Stack struct + func (st *Stack) Back(n int) *big.Int + func (st *Stack) Data() []*big.Int + func (st *Stack) Print() + type StateDB interface + AddBalance func(common.Address, *big.Int) + AddLog func(*Log) + AddPreimage func(common.Hash, []byte) + AddRefund func(uint64) + CreateAccount func(common.Address) + Empty func(common.Address) bool + Exist func(common.Address) bool + ForEachStorage func(common.Address, func(common.Hash, common.Hash) bool) + GetABI func(common.Address) *abi.ABI + 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() uint64 + GetState func(common.Address, common.Hash) common.Hash + HasSuicided func(common.Address) bool + HaveSufficientBalance func(common.Address, *big.Int) bool + RevertToSnapshot func(int) + SetABI func(common.Address, *abi.ABI) + SetCode func(common.Address, []byte) + SetNonce func(common.Address, uint64) + SetState func(common.Address, common.Hash, common.Hash) + Snapshot func() int + SubBalance func(common.Address, *big.Int) + Suicide func(common.Address) bool + TransferBalance func(common.Address, common.Address, *big.Int) + func MakeNewStateDB(db DB) StateDB + type StateObject interface + AddBalance func(amount *big.Int) + Address func() common.Address + CodeHash func() common.Hash + GetState func(key common.Hash) common.Hash + Nonce func() uint64 + RevertToInit func() + RevertToSnap func(pre int) + SetBalance func(amount *big.Int) + SetNonce func(nonce uint64) + SetState func(key, value common.Hash) + SnapShot func() + SubBalance func(amount *big.Int) + type Storage map[common.Hash]common.Hash + func (s Storage) Copy() Storage + type StructLog struct + Depth int + Err error + Gas uint64 + GasCost uint64 + Memory []byte + MemorySize int + Op OpCode + Pc uint64 + Stack []*big.Int + Storage map[common.Hash]common.Hash + func (s *StructLog) ErrorString() string + func (s *StructLog) OpName() string + type StructLogger struct + func NewStructLogger(cfg *LogConfig) *StructLogger + func (l *StructLogger) CaptureEnd(output []byte, gasUsed uint64, t time.Duration, err error) error + func (l *StructLogger) CaptureFault(env *EVM, pc uint64, op OpCode, gas, cost uint64, memory *Memory, stack *Stack, ...) error + func (l *StructLogger) CaptureStart(from common.Address, to common.Address, create bool, input []byte, gas uint64, ...) error + func (l *StructLogger) CaptureState(env *EVM, pc uint64, op OpCode, gas, cost uint64, memory *Memory, stack *Stack, ...) error + func (l *StructLogger) Error() error + func (l *StructLogger) Output() []byte + func (l *StructLogger) StructLogs() []StructLog + type Tracer interface + CaptureEnd func(output []byte, gasUsed uint64, t time.Duration, err error) error + CaptureFault func(env *EVM, pc uint64, op OpCode, gas, cost uint64, memory *Memory, stack *Stack, ...) error + CaptureStart func(from common.Address, to common.Address, call bool, input []byte, gas uint64, ...) error + CaptureState func(env *EVM, pc uint64, op OpCode, gas, cost uint64, memory *Memory, stack *Stack, ...) error