core

package
v0.0.0-...-3887924 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2022 License: LGPL-2.1-or-later Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BlockReward *big.Int = big.NewInt(1.5e+18)

Initial block reward for miners. See the function BlockManager.AccumelateRewards in the 'core' package (file block_manager.go)

View Source
var EmptyListRoot = crypto.Sha3(ethutil.Encode(""))

Used to set the tx root and receipt root of the genesis block

View Source
var EmptyShaList = crypto.Sha3(ethutil.Encode([]interface{}{}))

Used to set the root state of the genesis block

View Source
var Found bool
View Source
var Genesis = []interface{}{GenesisHeader, []interface{}{}, []interface{}{}}

Used to be able to RLP-encode the genesis block. To rlp-encode a block we provide it's header, transactions and uncles. The genesis block does not have any transactions and uncles, thus the use of the 2 'empty' objects.

ZeroHash256: Previous hash (none)

EmptyShaList: Empty uncles

ZeroHash160: Coinbase

EmptyShaList: Root state

EmptyListRoot: tx root

EmptyListRoot: receipt root

ZeroHash512: bloom field

big.NewInt(131072): difficulty

ethutil.Big0: number of block

big.NewInt(1000000): Block upper gas bound

ethutil.Big0: Block gas used

ethutil.Big0: Time field

nil: Extra field.

crypto.Sha3(big.NewInt(42).Bytes()): Nonce field

View Source
var MinGasPrice = big.NewInt(10000000000000)
View Source
var ZeroHash160 = make([]byte, 20)

Used to set the coinbase of the genesis block

View Source
var ZeroHash256 = make([]byte, 32)

Used to set the parent's hash of the genesis block

View Source
var ZeroHash512 = make([]byte, 64)

Used to set the bloom field of the genesis block

Functions

func AddTestNetFunds

func AddTestNetFunds(block *types.Block)

func AddressFromMessage

func AddressFromMessage(msg Message) []byte

func CalcDifficulty

func CalcDifficulty(block, parent *types.Block) *big.Int

func DaggerVerify

func DaggerVerify(hash, diff, nonce *big.Int) bool

func Disassemble

func Disassemble(script []byte) (asm []string)

Returns a string representation of a sequence of bytes that consist an evm bytecode. The opcodes are defined in vm/types.go. In case that we have a PUSHi opcode we expect the next i bytes to be the i items that we want to push to the stack.

script: The evm bytecode. An example can be found here: https://rinkeby.etherscan.io/address/0x147b8eb97fd247d06c4006d269c90c1908fb5d54#code

Example: Passing the first series of bytes of the above link to this function as

script = []byte(0x60, 0x80, 0x60, 0x40, 0x52, 0x34, 0x80, 0x15, 0x61, 0x00, 0x10, 0x57, 0x60, 0x00, 0x80, 0xfd, 0x5b, 0x50, 0x60, 0x40, 0x51)

will yield the following output:

0x60 0000: PUSH1

0x80 0001: 0x80

0x60 0002: PUSH1 (we got a PUSH1, so the next value is pushed onto the stack)

0x40 0003: 0x40

0x52 0004: MSTORE

0x34 0005: CALLVALUE

0x80 0006: DUP1

0x15 0007: ISZERO

0x61 0008: PUSH2 (we got a PUSH2, so the next 2 values are pushed onto the stack)

0x00 0009: 0x00

0x10 0010: 0x10

0x57 0011: JUMPI

0x60 0012: PUSH1

0x00 0013: 0x00

0x80 0014: DUP1

0xfd 0015: Missing opcode 0xfd

0x5b 0016: JUMPDEST

0x50 0017: POP

0x60 0018: PUSH1

0x40 0019: 0x40

0x51 0020: MLOAD

func EachTx

func EachTx(pool *list.List, it func(*types.Transaction, *list.Element) bool)

func FindTx

func FindTx(pool *list.List, finder func(*types.Transaction, *list.Element) bool) *types.Transaction

func IsGasLimitErr

func IsGasLimitErr(err error) bool

Returns whether 'err' is a GasLimitErr error.

func IsKnownBlockErr

func IsKnownBlockErr(e error) bool

Returns whether 'e' is a KnownBlockErr error.

func IsNonceErr

func IsNonceErr(err error) bool

Returns whether 'err' is a NonceErr error.

func IsOutOfGasErr

func IsOutOfGasErr(err error) bool

Returns whether 'err' is an OutOfGasErr error.

func IsParentErr

func IsParentErr(err error) bool

Returns whether 'err' is a ParentErr error.

func IsTDError

func IsTDError(e error) bool

Returns whether 'e' is a TDError error.

func IsUncleErr

func IsUncleErr(err error) bool

Returns whether 'err' is an UncleErr error.

func IsValidationErr

func IsValidationErr(err error) bool

Returns whether 'err' is a ValidationErr error.

func MakeContract

func MakeContract(msg Message, state *state.StateDB) *state.StateObject

Converts an transaction in to a state object

func MessageCreatesContract

func MessageCreatesContract(msg Message) bool

func MessageGasValue

func MessageGasValue(msg Message) *big.Int

func ParentError

func ParentError(hash []byte) error

Creates a ParentError object by setting it's message to a message that includes the 'hash' and returns it.

func Sum

func Sum(sha hash.Hash) []byte

func UncleError

func UncleError(str string) error

Creates an UncleErr error by setting it's message to 'str' and returns it.

Types

type AccountChange

type AccountChange struct {
	Address, StateAddress []byte
}

type BlockManager

type BlockManager struct {
	Pow pow.PoW
	// contains filtered or unexported fields
}

todo

mutex: Mutex for locking the block processor. Blocks can only be handled one at a time

bc: Canonical block chain

mem: non-persistent key/value memory storage

Pow: Proof of work used for validating

txpool: The transaction pool. See type 'TxPool' of the 'core' package.

lastAttemptedBlock: The last attempted block is mainly used for debugging purposes.

This does not have to be a valid block and will be set during 'Process' & canonical validation.

events: todo

eventMux: todo

func NewBlockManager

func NewBlockManager(txpool *TxPool, chainManager *ChainManager, eventMux *event.TypeMux) *BlockManager

Creates a new BlockManager object by initializing these fields of a BlockManager object type: mem, Pow, bc, eventMux, txpool. The Pow object will have it's 'turbo' field set to true when created. See the type 'EasyPow' of the 'ezp' package for more. (file pow/ezp/pow.go)

func (*BlockManager) AccumelateRewards

func (sm *BlockManager) AccumelateRewards(statedb *state.StateDB, block, parent *types.Block) error

Calculates the reward of the miner. Returns an error if an error has occured during the validation process. If no errors have occured, nil is returned.

More specifically an error is returned: 1. if the parent of any of the uncles of the 'block' is nil, or

2. if the (block) number of the parent of any of the uncles of the 'block' and the 'block' itself have a difference greater than 6, or

3. if the hash of any of the uncles of the param 'block' matches any of the uncles of the param 'parent'.

4. if the nonce of any of the uncles of the param 'block' is included in the nonce of the 'block'

The reward to be appointed to the miner will be:

If the 'block' has 1 uncle: r1 = BlockReward + BlockReward/32,

If the 'block' has 2 uncles: r2 = r1 + r1/32, etc., where BlockReward = 1.5 Ether,( defined in the core package, file fees.go)

Finally, a message is added to the state manifest regarding the value to be transferred to the miner address. This value will be the sum of the above calculated reward and the block.Reward.

func (*BlockManager) ApplyTransactions

func (self *BlockManager) ApplyTransactions(coinbase *state.StateObject, state *state.StateDB, block *types.Block, txs types.Transactions, transientProcess bool) (types.Receipts, types.Transactions, types.Transactions, types.Transactions, error)

This function will apply the transactions of a block to the world state and return the results as a tuple. It gets called by the BlockManager.TransitionState function, then calls the latter again, and so on, to form a recursion algorithm that will apply the transactions one by one. In case where an IsGasLimitErr error occurs during the application of any transaction, the process of the transactions stops.

Returns: (receipts, handled, unhandled, erroneous, err)

receipts: The receipts up to but not including any transaction that has caused an IsGasLimitErr error.

handled: All transactions that were handled up to but not including any transaction that has caused an IsGasLimitErr error.

unhandled: In case of an IsGasLimitErr error this object will contain all the transactions that were not applied (includes the transaction that caused the error). Otherwise, this object will be nil.

erroneous: Any transactions that caused an error other than an IsGasLimitErr and/or an IsNonceErr errors.

err: The err will be either an IsGasLimitErr error type or nil.

A short description on what this function does follows.

1. Clear all state logs.

2. Get (or create a new) coinbase state object and call the TransitionState function.

3. The latter function will call this function again, forming the recursion.

4. If an error occured and is an IsGasLimitErr error then stop the process and set the 'unhandled' variable (to be returned later). If it is a IsNonceErr error, ignore it. If it is any other error, also ignore it, but append to the variable 'erroneous' (to be returned later) the transaction that caused that error.

5. Calculate the gas used so far and the current reward for the miner. Update the state.

6. Create the receipt of the current transaction and set the receipt's logs and Bloom field.

7. If the parameter 'transientProcess' is false, notify all subscribers about the transaction.

8. Append receipt, transaction to the 'receipts', 'handled' variables (to be returned later)

9. When the processing has ended, set the block's reward and totalUsedGas fields.

10.Return the results.

func (*BlockManager) CalculateTD

func (sm *BlockManager) CalculateTD(block *types.Block) (*big.Int, bool)

Calculates the total difficulty for a given block.

TD(genesis_block)=0 and TD(block)=TD(block.parent) + sum(u.difficulty for u in block.uncles) + block.difficulty

Returns: If the calculated difficulty is greater than the previous the tuple (total_difficulty, true) is returned. Otherwise, the tuple (nil, false) is returned.

func (*BlockManager) GetMessages

func (sm *BlockManager) GetMessages(block *types.Block) (messages []*state.Message, err error)

Returns either the tuple (state.Manifest().Messages, nil) or (nil, error)

If an error is returned it will be a ParentError regarding the parent of the 'block' (the error includes the hash of the parent of the 'block'). This error happens in the case where the the hash of the parent of the 'block' already exists.

In essence, the state manifest's messages are the transactions that occured during the world state transition of the addition of a 'block'.

To get those messages a simple trick is used: a deferred call on state.Reset() is queued and only then a call of the function TransitionState and following that a call on AccumelateRewards happen.

func (*BlockManager) Process

func (sm *BlockManager) Process(block *types.Block) (td *big.Int, msgs state.Messages, err error)

func (*BlockManager) ProcessWithParent

func (sm *BlockManager) ProcessWithParent(block, parent *types.Block) (td *big.Int, messages state.Messages, err error)

func (*BlockManager) TransitionState

func (sm *BlockManager) TransitionState(statedb *state.StateDB, parent, block *types.Block) (receipts types.Receipts, err error)

Returns (receipts, nil) or (nil, error) if an IsGasLimitErr error has occured. This function together with the BlockManager.ApplyTransactions function form a recursion algorithm meant to apply all transactions of the current block to the world state. The main logic/application happens in the latter function. However, this function is the one to be called when we want to apply the transactions of a block. The TransitionState function sets the total gas pool (amount of gas left) for the coinbase address of the block before calling the ApplyTransactions function which in turn will call the TransitionState function again, and so on, until all transactions have been applied or an IsGasLimitErr error has occured. If no such an error has occured then the 'receipts' object returned by this function will hold the receipts that are the result of the application of the transactions of the 'block' param.

func (*BlockManager) ValidateBlock

func (sm *BlockManager) ValidateBlock(block, parent *types.Block) error

Validates the current block. Returns an error if the block was invalid, an uncle or anything that isn't on the current block chain. Validation validates easy over difficult (dagger takes longer time = difficult)

type ChainManager

type ChainManager struct {
	// contains filtered or unexported fields
}

func NewChainManager

func NewChainManager(mux *event.TypeMux) *ChainManager

func (*ChainManager) BlockInfo

func (bc *ChainManager) BlockInfo(block *types.Block) types.BlockInfo

func (*ChainManager) CalcTotalDiff

func (self *ChainManager) CalcTotalDiff(block *types.Block) (*big.Int, error)

func (*ChainManager) CurrentBlock

func (self *ChainManager) CurrentBlock() *types.Block

func (*ChainManager) Export

func (self *ChainManager) Export() []byte

func (*ChainManager) Genesis

func (bc *ChainManager) Genesis() *types.Block

Accessors

func (*ChainManager) GetBlock

func (self *ChainManager) GetBlock(hash []byte) *types.Block

func (*ChainManager) GetBlockByNumber

func (self *ChainManager) GetBlockByNumber(num uint64) *types.Block

func (*ChainManager) GetChainHashesFromHash

func (self *ChainManager) GetChainHashesFromHash(hash []byte, max uint64) (chain [][]byte)

func (*ChainManager) HasBlock

func (bc *ChainManager) HasBlock(hash []byte) bool

Block fetching methods

func (*ChainManager) InsertChain

func (self *ChainManager) InsertChain(chain types.Blocks) error

1. It is a loop that iterates over the blocks in the chain. 2. It calls the `Process` method of the `BlockProcessor` interface. 3. It writes the block to the database. 4. It sets the total difficulty of the block. 5. It inserts the block into the chain. 6. It posts a `NewBlockEvent` to the event mux. 7. It posts the messages to the event mux.

func (*ChainManager) LastBlockHash

func (self *ChainManager) LastBlockHash() []byte

func (*ChainManager) LastBlockNumber

func (self *ChainManager) LastBlockNumber() uint64

func (*ChainManager) NewBlock

func (bc *ChainManager) NewBlock(coinbase []byte) *types.Block

Block creation & chain handling

func (*ChainManager) Reset

func (bc *ChainManager) Reset()

func (*ChainManager) SetProcessor

func (self *ChainManager) SetProcessor(proc types.BlockProcessor)

func (*ChainManager) State

func (self *ChainManager) State() *state.StateDB

func (*ChainManager) Stop

func (bc *ChainManager) Stop()

func (*ChainManager) Td

func (self *ChainManager) Td() *big.Int

func (*ChainManager) TransState

func (self *ChainManager) TransState() *state.StateDB

type Dagger

type Dagger struct {
	// contains filtered or unexported fields
}

func (*Dagger) Eval

func (dag *Dagger) Eval(N *big.Int) *big.Int

func (*Dagger) Find

func (dag *Dagger) Find(obj *big.Int, resChan chan int64)

func (*Dagger) Node

func (dag *Dagger) Node(L uint64, i uint64) *big.Int

func (*Dagger) Search

func (dag *Dagger) Search(hash, diff *big.Int) *big.Int

func (*Dagger) Verify

func (dag *Dagger) Verify(hash, diff, nonce *big.Int) bool

type EthManager

type EthManager interface {
	BlockManager() *BlockManager
	ChainManager() *ChainManager
	TxPool() *TxPool
	Broadcast(msgType wire.MsgType, data []interface{})
	PeerCount() int
	IsMining() bool
	IsListening() bool
	Peers() *list.List
	KeyManager() *crypto.KeyManager
	ClientIdentity() wire.ClientIdentity
	Db() ethutil.Database
	EventMux() *event.TypeMux
}

The 'EthManager' interface is only implemented by the 'Ethereum' object, defined in the package 'eth' (file ethereum.go)

BlockManager: See type 'BlockManager' of the 'core' package.

ChainManager: See type 'ChainManager' of the 'core' package.

TxPool: See type 'TxPool' of the 'core' package.

Broadcast: Used to broacast messages to all peers.

IsMining: Returns whether the peer is mining.

IsListening: Returns whether the peer is listening.

Peers: Returns all connected peers.

KeyManager: Key manager for the account(s) of the node.

ClientIdentity: Used mainly for communication between peers.

Db: The ethereum database. This should be a representation of the World State.

EventMux: Used to dispatch events to registered nodes

type Execution

type Execution struct {
	Gas          *big.Int
	SkipTransfer bool
	// contains filtered or unexported fields
}

func NewExecution

func NewExecution(env vm.Environment, address, input []byte, gas, gasPrice, value *big.Int) *Execution

Execution Constructor

func (*Execution) Addr

func (self *Execution) Addr() []byte

Get the Execution address.

func (*Execution) Call

func (self *Execution) Call(codeAddr []byte, caller vm.ClosureRef) ([]byte, error)

func (*Execution) Create

func (self *Execution) Create(caller vm.ClosureRef) (ret []byte, err error, account *state.StateObject)

type Filter

type Filter struct {
	Altered []AccountChange

	BlockCallback   func(*types.Block)
	MessageCallback func(state.Messages)
	// contains filtered or unexported fields
}

Filtering interface

func NewFilter

func NewFilter(eth EthManager) *Filter

Create a new filter which uses a bloom filter on blocks to figure out whether a particular block is interesting or not.

func (*Filter) AddAltered

func (self *Filter) AddAltered(address, stateAddress []byte)

func (*Filter) AddFrom

func (self *Filter) AddFrom(addr []byte)

func (*Filter) AddTo

func (self *Filter) AddTo(addr []byte)

func (*Filter) FilterMessages

func (self *Filter) FilterMessages(msgs []*state.Message) []*state.Message

func (*Filter) Find

func (self *Filter) Find() []*state.Message

Run filters messages with the current parameters set

func (*Filter) SetEarliestBlock

func (self *Filter) SetEarliestBlock(earliest int64)

Set the earliest and latest block for filtering. -1 = latest block (i.e., the current block) hash = particular hash from-to

func (*Filter) SetFrom

func (self *Filter) SetFrom(addr [][]byte)

func (*Filter) SetLatestBlock

func (self *Filter) SetLatestBlock(latest int64)

func (*Filter) SetMax

func (self *Filter) SetMax(max int)

func (*Filter) SetSkip

func (self *Filter) SetSkip(skip int)

func (*Filter) SetTo

func (self *Filter) SetTo(addr [][]byte)

type GasLimitErr

type GasLimitErr struct {
	Message string
	Is, Max *big.Int
}

Happens when the total gas left for the coinbase address is less than the gas to be bought.

func GasLimitError

func GasLimitError(is, max *big.Int) *GasLimitErr

Creates and returns a GasLimitError given the total gas left to be bought by a coinbase address and the actual gas.

func (*GasLimitErr) Error

func (err *GasLimitErr) Error() string

Returns the error message of a GasLimitErr error.

type KnownBlockError

type KnownBlockError struct {
	// contains filtered or unexported fields
}

Happens when there is already a block in the chain with the same hash. The number field is the number of the existing block.

func (*KnownBlockError) Error

func (self *KnownBlockError) Error() string

Creates and returns a KnownBlockError error.

type Message

type Message interface {
	Hash() []byte

	From() []byte
	To() []byte

	GasPrice() *big.Int
	Gas() *big.Int
	Value() *big.Int

	Nonce() uint64
	Data() []byte
}

type NewBlockEvent

type NewBlockEvent struct{ Block *types.Block }

NewBlockEvent is posted when a block has been imported.

type NonceErr

type NonceErr struct {
	Message string
	Is, Exp uint64
}

Happens when a transaction's nonce is incorrect.

func NonceError

func NonceError(is, exp uint64) *NonceErr

Creates and returns a NonceError given the transaction's nonce and the nonce of the sender of the transaction.

func (*NonceErr) Error

func (err *NonceErr) Error() string

Returns the error message of a NonceErr error.

type OutOfGasErr

type OutOfGasErr struct {
	Message string
}

Happens when the gas provided runs out before the state transition happens.

func OutOfGasError

func OutOfGasError() *OutOfGasErr

Creates and returns an OutOfGasError error.

func (*OutOfGasErr) Error

func (self *OutOfGasErr) Error() string

Returns the error message of an OutOfGasError error.

type ParentErr

type ParentErr struct {
	Message string
}

Parent error. In case a parent is unknown this error will be thrown by the block manager

func (*ParentErr) Error

func (err *ParentErr) Error() string

Returns the error message of the caller.

type Peer

type Peer interface {
	Inbound() bool
	LastSend() time.Time
	LastPong() int64
	Host() []byte
	Port() uint16
	Version() string
	PingTime() string
	Connected() *int32
	Caps() *ethutil.Value
}

This interface is only implemented by a "Peer" object defined in the 'eth' package (file peer.go)

Inbound(): Determines whether it's an inbound or outbound peer

LastSend(): Last known message send time.

LastPong(): Last received pong message

Host(): the host.

Port(): the port of the connection

Version(): client identity

PingTime(): Used to give some kind of pingtime to a node, not very accurate.

Connected(): Flag for checking the peer's connectivity state

Caps(): getter for the protocolCaps field of a Peer object.

type StateTransition

type StateTransition struct {
	Env vm.Environment
	// contains filtered or unexported fields
}

* The State transitioning model * * A state transition is a change made when a transaction is applied to the current world state * The state transitioning model does all all the necessary work to work out a valid new state root. * 1) Nonce handling * 2) Pre pay / buy gas of the coinbase (miner) * 3) Create a new state object if the recipient is \0*32, aka contract creation. * 4) Value transfer * == If contract creation == * 4a) Attempt to run transaction data * 4b) If valid, use result as code for the new state object * == end == * 5) Run Script section * 6) Derive new state root

func NewStateTransition

func NewStateTransition(coinbase *state.StateObject, msg Message, state *state.StateDB, block *types.Block) *StateTransition

func (*StateTransition) AddGas

func (self *StateTransition) AddGas(amount *big.Int)

func (*StateTransition) BuyGas

func (self *StateTransition) BuyGas() error

func (*StateTransition) Coinbase

func (self *StateTransition) Coinbase() *state.StateObject

func (*StateTransition) From

func (self *StateTransition) From() *state.StateObject

func (*StateTransition) GasUsed

func (self *StateTransition) GasUsed() *big.Int

func (*StateTransition) RefundGas

func (self *StateTransition) RefundGas()

func (*StateTransition) To

func (self *StateTransition) To() *state.StateObject

func (*StateTransition) TransitionState

func (self *StateTransition) TransitionState() (ret []byte, err error)

func (*StateTransition) UseGas

func (self *StateTransition) UseGas(amount *big.Int) error

func (*StateTransition) VmEnv

func (self *StateTransition) VmEnv() vm.Environment

type TDError

type TDError struct {
	// contains filtered or unexported fields
}

Defined, but not used. Meant to be used when there is a total difficulty error, a < b.

func (*TDError) Error

func (self *TDError) Error() string

Creates and returns a TDError error.

type TxMsg

type TxMsg struct {
	Tx   *types.Transaction
	Type TxMsgTy
}

type TxMsgTy

type TxMsgTy byte

type TxPool

type TxPool struct {
	SecondaryProcessor TxProcessor
	// contains filtered or unexported fields
}

The tx pool a thread safe transaction pool handler. In order to guarantee a non blocking pool we use a queue channel which can be independently read without needing access to the actual pool. If the pool is being drained or synced for whatever reason the transactions will simple queue up and handled when the mutex is freed.

func NewTxPool

func NewTxPool(chainManager *ChainManager, broadcaster types.Broadcaster, eventMux *event.TypeMux) *TxPool

func (*TxPool) Add

func (self *TxPool) Add(tx *types.Transaction) error

func (*TxPool) CurrentTransactions

func (pool *TxPool) CurrentTransactions() []*types.Transaction

func (*TxPool) Flush

func (pool *TxPool) Flush() []*types.Transaction

func (*TxPool) RemoveInvalid

func (pool *TxPool) RemoveInvalid(state *state.StateDB)

func (*TxPool) RemoveSet

func (self *TxPool) RemoveSet(txs types.Transactions)

func (*TxPool) Size

func (self *TxPool) Size() int

func (*TxPool) Start

func (pool *TxPool) Start()

func (*TxPool) Stop

func (pool *TxPool) Stop()

func (*TxPool) ValidateTransaction

func (pool *TxPool) ValidateTransaction(tx *types.Transaction) error

type TxPoolHook

type TxPoolHook chan *types.Transaction

type TxPostEvent

type TxPostEvent struct{ Tx *types.Transaction }

TxPostEvent is posted when a transaction has been processed.

type TxPreEvent

type TxPreEvent struct{ Tx *types.Transaction }

TxPreEvent is posted when a transaction enters the transaction pool.

type TxProcessor

type TxProcessor interface {
	ProcessTransaction(tx *types.Transaction)
}

type UncleErr

type UncleErr struct {
	Message string
}

Uncle error. This error is thrown only from the function BlockManager.AccumelateRewards defined in the 'core' package (file block_manager.go). See that function for more.

func (*UncleErr) Error

func (err *UncleErr) Error() string

Returns the error message of an UncleErr error.

type VMEnv

type VMEnv struct {
	// contains filtered or unexported fields
}

func NewEnv

func NewEnv(state *state.StateDB, msg Message, block *types.Block) *VMEnv

func (*VMEnv) AddLog

func (self *VMEnv) AddLog(log state.Log)

func (*VMEnv) BlockHash

func (self *VMEnv) BlockHash() []byte

func (*VMEnv) BlockNumber

func (self *VMEnv) BlockNumber() *big.Int

func (*VMEnv) Call

func (self *VMEnv) Call(me vm.ClosureRef, addr, data []byte, gas, price, value *big.Int) ([]byte, error)

func (*VMEnv) CallCode

func (self *VMEnv) CallCode(me vm.ClosureRef, addr, data []byte, gas, price, value *big.Int) ([]byte, error)

func (*VMEnv) Coinbase

func (self *VMEnv) Coinbase() []byte

func (*VMEnv) Create

func (self *VMEnv) Create(me vm.ClosureRef, addr, data []byte, gas, price, value *big.Int) ([]byte, error, vm.ClosureRef)

func (*VMEnv) Depth

func (self *VMEnv) Depth() int

func (*VMEnv) Difficulty

func (self *VMEnv) Difficulty() *big.Int

func (*VMEnv) GasLimit

func (self *VMEnv) GasLimit() *big.Int

func (*VMEnv) Origin

func (self *VMEnv) Origin() []byte

func (*VMEnv) PrevHash

func (self *VMEnv) PrevHash() []byte

func (*VMEnv) SetDepth

func (self *VMEnv) SetDepth(i int)

func (*VMEnv) State

func (self *VMEnv) State() *state.StateDB

func (*VMEnv) Time

func (self *VMEnv) Time() int64

func (*VMEnv) Transfer

func (self *VMEnv) Transfer(from, to vm.Account, amount *big.Int) error

func (*VMEnv) Value

func (self *VMEnv) Value() *big.Int

type ValidationErr

type ValidationErr struct {
	Message string
}

Block validation error. If any validation fails, this error will be thrown

func ValidationError

func ValidationError(format string, v ...interface{}) *ValidationErr

Creates a ValidationErr error by setting it's message and returns it.

func (*ValidationErr) Error

func (err *ValidationErr) Error() string

Returns the error message of a ValidationErr error.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL