Documentation
¶
Index ¶
- Constants
- Variables
- func AddTestNetFunds(block *Block)
- func CalculateBlockReward(block *Block, uncleLength int) *big.Int
- func CalculateUncleReward(block *Block) *big.Int
- func CreateTxSha(receipts Receipts) (sha []byte)
- func DaggerVerify(hash, diff, nonce *big.Int) bool
- func Disassemble(script []byte) (asm []string)
- func IsContractAddr(addr []byte) bool
- func IsGasLimitErr(err error) bool
- func IsNonceErr(err error) bool
- func IsOpCode(s string) bool
- func IsOutOfGasErr(err error) bool
- func IsParentErr(err error) bool
- func IsValidationErr(err error) bool
- func MakeContract(tx *Transaction, state *ethstate.State) *ethstate.StateObject
- func ParentError(hash []byte) error
- func Sum(sha hash.Hash) []byte
- type Block
- func (block *Block) BlockInfo() BlockInfo
- func (block *Block) CalcGasLimit(parent *Block) *big.Int
- func (block *Block) GetRoot() interface{}
- func (self *Block) GetTransaction(hash []byte) *Transaction
- func (block *Block) Hash() []byte
- func (block *Block) HashNoNonce() []byte
- func (self *Block) Receipts() []*Receipt
- func (block *Block) RlpDecode(data []byte)
- func (block *Block) RlpEncode() []byte
- func (block *Block) RlpValueDecode(decoder *ethutil.Value)
- func (self *Block) SetReceipts(receipts []*Receipt, txs []*Transaction)
- func (self *Block) SetTxHash(receipts Receipts)
- func (block *Block) SetUncles(uncles []*Block)
- func (block *Block) State() *ethstate.State
- func (block *Block) String() string
- func (block *Block) Sync()
- func (block *Block) Transactions() []*Transaction
- func (block *Block) Undo()
- func (block *Block) Value() *ethutil.Value
- type BlockChain
- func (bc *BlockChain) Add(block *Block)
- func (bc *BlockChain) BlockInfo(block *Block) BlockInfo
- func (bc *BlockChain) BlockInfoByHash(hash []byte) BlockInfo
- func (bc *BlockChain) CalculateBlockTD(block *Block) *big.Int
- func (bc *BlockChain) FindCanonicalChain(blocks []*Block, commonBlockHash []byte) bool
- func (bc *BlockChain) FindCanonicalChainFromMsg(msg *ethwire.Msg, commonBlockHash []byte) bool
- func (bc *BlockChain) Genesis() *Block
- func (bc *BlockChain) GenesisBlock() *Block
- func (bc *BlockChain) GetBlock(hash []byte) *Block
- func (self *BlockChain) GetBlockByNumber(num uint64) *Block
- func (bc *BlockChain) GetChain(hash []byte, amount int) []*Block
- func (bc *BlockChain) GetChainFromHash(hash []byte, max uint64) []interface{}
- func (self *BlockChain) GetChainHashesFromHash(hash []byte, max uint64) (chain [][]byte)
- func (bc *BlockChain) HasBlock(hash []byte) bool
- func (bc *BlockChain) HasBlockWithPrevHash(hash []byte) bool
- func (bc *BlockChain) NewBlock(coinbase []byte) *Block
- func (bc *BlockChain) ResetTillBlockHash(hash []byte) error
- func (bc *BlockChain) SetTotalDifficulty(td *big.Int)
- func (bc *BlockChain) Stop()
- type BlockInfo
- type BlockProcessor
- type BloomFilter
- type Dagger
- type EasyPow
- type EthManager
- type Filter
- func (self *Filter) AddAltered(id, address []byte)
- func (self *Filter) AddFrom(addr []byte)
- func (self *Filter) AddTo(addr []byte)
- func (self *Filter) FilterMessages(msgs []*ethstate.Message) []*ethstate.Message
- func (self *Filter) Find() []*ethstate.Message
- func (self *Filter) SetEarliestBlock(earliest interface{})
- func (self *Filter) SetFrom(addr [][]byte)
- func (self *Filter) SetLatestBlock(latest interface{})
- func (self *Filter) SetMax(max int)
- func (self *Filter) SetSkip(skip int)
- func (self *Filter) SetTo(addr [][]byte)
- type GasLimitErr
- type NonceErr
- type OpCode
- type OutOfGasErr
- type ParentErr
- type Peer
- type PoW
- type Receipt
- type Receipts
- type StateManager
- func (sm *StateManager) AccumelateRewards(state *ethstate.State, block *Block) error
- func (sm *StateManager) ApplyDiff(state *ethstate.State, parent, block *Block) (receipts Receipts, err error)
- func (sm *StateManager) BlockChain() *BlockChain
- func (sm *StateManager) CalculateTD(block *Block) bool
- func (sm *StateManager) CurrentState() *ethstate.State
- func (sm *StateManager) GetMessages(block *Block) (messages []*ethstate.Message, err error)
- func (sm *StateManager) MiningState() *ethstate.State
- func (sm *StateManager) NewMiningState() *ethstate.State
- func (sm *StateManager) Process(block *Block, dontReact bool) (err error)
- func (self *StateManager) ProcessTransactions(coinbase *ethstate.StateObject, state *ethstate.State, block, parent *Block, ...) (Receipts, Transactions, Transactions, error)
- func (sm *StateManager) Stop()
- func (sm *StateManager) TransState() *ethstate.State
- func (sm *StateManager) ValidateBlock(block *Block) error
- type StateTransition
- func (self *StateTransition) AddGas(amount *big.Int)
- func (self *StateTransition) BuyGas() error
- func (self *StateTransition) Coinbase() *ethstate.StateObject
- func (self *StateTransition) Eval(msg *ethstate.Message, script []byte, context *ethstate.StateObject, ...) (ret []byte, err error)
- func (self *StateTransition) MakeStateObject(state *ethstate.State, tx *Transaction) *ethstate.StateObject
- func (self *StateTransition) Receiver() *ethstate.StateObject
- func (self *StateTransition) RefundGas()
- func (self *StateTransition) Sender() *ethstate.StateObject
- func (self *StateTransition) TransitionState() (err error)
- func (self *StateTransition) UseGas(amount *big.Int) error
- type Transaction
- func FindTx(pool *list.List, finder func(*Transaction, *list.Element) bool) *Transaction
- func NewContractCreationTx(value, gas, gasPrice *big.Int, script []byte) *Transaction
- func NewTransactionFromBytes(data []byte) *Transaction
- func NewTransactionFromValue(val *ethutil.Value) *Transaction
- func NewTransactionMessage(to []byte, value, gas, gasPrice *big.Int, data []byte) *Transaction
- func (tx *Transaction) CreatesContract() bool
- func (tx *Transaction) CreationAddress() []byte
- func (self *Transaction) GasValue() *big.Int
- func (tx *Transaction) Hash() []byte
- func (tx *Transaction) IsContract() bool
- func (tx *Transaction) PublicKey() []byte
- func (tx *Transaction) RlpData() interface{}
- func (tx *Transaction) RlpDecode(data []byte)
- func (tx *Transaction) RlpEncode() []byte
- func (tx *Transaction) RlpValue() *ethutil.Value
- func (tx *Transaction) RlpValueDecode(decoder *ethutil.Value)
- func (tx *Transaction) Sender() []byte
- func (tx *Transaction) Sign(privk []byte) error
- func (tx *Transaction) Signature(key []byte) []byte
- func (tx *Transaction) String() string
- func (self *Transaction) TotalValue() *big.Int
- type Transactions
- type TxByNonce
- type TxMsg
- type TxMsgTy
- type TxPool
- func (pool *TxPool) CurrentTransactions() []*Transaction
- func (pool *TxPool) Flush() []*Transaction
- func (pool *TxPool) QueueTransaction(tx *Transaction)
- func (pool *TxPool) RemoveInvalid(state *ethstate.State)
- func (pool *TxPool) Start()
- func (pool *TxPool) Stop()
- func (pool *TxPool) ValidateTransaction(tx *Transaction) error
- type TxPoolHook
- type TxProcessor
- type VMEnv
- func (self *VMEnv) BlockHash() []byte
- func (self *VMEnv) BlockNumber() *big.Int
- func (self *VMEnv) Coinbase() []byte
- func (self *VMEnv) Difficulty() *big.Int
- func (self *VMEnv) Origin() []byte
- func (self *VMEnv) PrevHash() []byte
- func (self *VMEnv) State() *ethstate.State
- func (self *VMEnv) Time() int64
- func (self *VMEnv) Value() *big.Int
- type ValidationErr
Constants ¶
const ( TxPre = iota TxPost )
const ( // 0x0 range - arithmetic ops STOP = 0x00 ADD = 0x01 MUL = 0x02 SUB = 0x03 DIV = 0x04 SDIV = 0x05 MOD = 0x06 SMOD = 0x07 EXP = 0x08 NEG = 0x09 LT = 0x0a GT = 0x0b SLT = 0x0c SGT = 0x0d EQ = 0x0e NOT = 0x0f // 0x10 range - bit ops AND = 0x10 OR = 0x11 XOR = 0x12 BYTE = 0x13 // 0x20 range - crypto SHA3 = 0x20 // 0x30 range - closure state ADDRESS = 0x30 BALANCE = 0x31 ORIGIN = 0x32 CALLER = 0x33 CALLVALUE = 0x34 CALLDATALOAD = 0x35 CALLDATASIZE = 0x36 CALLDATACOPY = 0x37 CODESIZE = 0x38 CODECOPY = 0x39 GASPRICE = 0x3a // 0x40 range - block operations PREVHASH = 0x40 COINBASE = 0x41 TIMESTAMP = 0x42 NUMBER = 0x43 DIFFICULTY = 0x44 GASLIMIT = 0x45 // 0x50 range - 'storage' and execution POP = 0x50 DUP = 0x51 SWAP = 0x52 MLOAD = 0x53 MSTORE = 0x54 MSTORE8 = 0x55 SLOAD = 0x56 SSTORE = 0x57 JUMP = 0x58 JUMPI = 0x59 PC = 0x5a MSIZE = 0x5b GAS = 0x5c // 0x60 range PUSH1 = 0x60 PUSH2 = 0x61 PUSH3 = 0x62 PUSH4 = 0x63 PUSH5 = 0x64 PUSH6 = 0x65 PUSH7 = 0x66 PUSH8 = 0x67 PUSH9 = 0x68 PUSH10 = 0x69 PUSH11 = 0x6a PUSH12 = 0x6b PUSH13 = 0x6c PUSH14 = 0x6d PUSH15 = 0x6e PUSH16 = 0x6f PUSH17 = 0x70 PUSH18 = 0x71 PUSH19 = 0x72 PUSH20 = 0x73 PUSH21 = 0x74 PUSH22 = 0x75 PUSH23 = 0x76 PUSH24 = 0x77 PUSH25 = 0x78 PUSH26 = 0x79 PUSH27 = 0x7a PUSH28 = 0x7b PUSH29 = 0x7c PUSH30 = 0x7d PUSH31 = 0x7e PUSH32 = 0x7f // 0xf0 range - closures CREATE = 0xf0 CALL = 0xf1 RETURN = 0xf2 // 0x70 range - other LOG = 0xfe // XXX Unofficial SUICIDE = 0xff )
Op codes
Variables ¶
var BlockReward *big.Int = big.NewInt(1.5e+18)
var ContractAddr = []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
var EmptyShaList = ethcrypto.Sha3Bin(ethutil.Encode([]interface{}{}))
var Found bool
var Genesis = []interface{}{GenesisHeader, []interface{}{}, []interface{}{}}
var GenesisHeader = []interface{}{ ZeroHash256, ethcrypto.Sha3Bin(ethutil.Encode([]interface{}{})), ZeroHash160, "", "", big.NewInt(131072), ethutil.Big0, ethutil.Big0, big.NewInt(1000000), ethutil.Big0, ethutil.Big0, nil, ethcrypto.Sha3Bin(big.NewInt(42).Bytes()), }
var OpCodes = map[string]byte{
"STOP": 0x00,
"ADD": 0x01,
"MUL": 0x02,
"SUB": 0x03,
"DIV": 0x04,
"SDIV": 0x05,
"MOD": 0x06,
"SMOD": 0x07,
"EXP": 0x08,
"NEG": 0x09,
"LT": 0x0a,
"GT": 0x0b,
"EQ": 0x0c,
"NOT": 0x0d,
"AND": 0x10,
"OR": 0x11,
"XOR": 0x12,
"BYTE": 0x13,
"SHA3": 0x20,
"ADDRESS": 0x30,
"BALANCE": 0x31,
"ORIGIN": 0x32,
"CALLER": 0x33,
"CALLVALUE": 0x34,
"CALLDATALOAD": 0x35,
"CALLDATASIZE": 0x36,
"GASPRICE": 0x38,
"PREVHASH": 0x40,
"COINBASE": 0x41,
"TIMESTAMP": 0x42,
"NUMBER": 0x43,
"DIFFICULTY": 0x44,
"GASLIMIT": 0x45,
"POP": 0x51,
"DUP": 0x52,
"SWAP": 0x53,
"MLOAD": 0x54,
"MSTORE": 0x55,
"MSTORE8": 0x56,
"SLOAD": 0x57,
"SSTORE": 0x58,
"JUMP": 0x59,
"JUMPI": 0x5a,
"PC": 0x5b,
"MSIZE": 0x5c,
"PUSH1": 0x60,
"PUSH2": 0x61,
"PUSH3": 0x62,
"PUSH4": 0x63,
"PUSH5": 0x64,
"PUSH6": 0x65,
"PUSH7": 0x66,
"PUSH8": 0x67,
"PUSH9": 0x68,
"PUSH10": 0x69,
"PUSH11": 0x6a,
"PUSH12": 0x6b,
"PUSH13": 0x6c,
"PUSH14": 0x6d,
"PUSH15": 0x6e,
"PUSH16": 0x6f,
"PUSH17": 0x70,
"PUSH18": 0x71,
"PUSH19": 0x72,
"PUSH20": 0x73,
"PUSH21": 0x74,
"PUSH22": 0x75,
"PUSH23": 0x76,
"PUSH24": 0x77,
"PUSH25": 0x78,
"PUSH26": 0x70,
"PUSH27": 0x7a,
"PUSH28": 0x7b,
"PUSH29": 0x7c,
"PUSH30": 0x7d,
"PUSH31": 0x7e,
"PUSH32": 0x7f,
"CREATE": 0xf0,
"CALL": 0xf1,
"RETURN": 0xf2,
"LOG": 0xfe,
"SUICIDE": 0x7f,
}
Op codes for assembling
var UncleInclusionReward *big.Int = big.NewInt(1.875e+17)
var UncleReward *big.Int = big.NewInt(1.125e+18)
var ZeroHash160 = make([]byte, 20)
var ZeroHash256 = make([]byte, 32)
Functions ¶
func AddTestNetFunds ¶
func AddTestNetFunds(block *Block)
func CalculateUncleReward ¶
func CreateTxSha ¶
func DaggerVerify ¶
func Disassemble ¶
func IsContractAddr ¶
func IsGasLimitErr ¶
func IsNonceErr ¶
func IsOutOfGasErr ¶
func IsParentErr ¶
func IsValidationErr ¶
func MakeContract ¶
func MakeContract(tx *Transaction, state *ethstate.State) *ethstate.StateObject
Converts an transaction in to a state object
func ParentError ¶
Types ¶
type Block ¶
type Block struct {
// Hash to the previous block
PrevHash []byte
// Uncles of this block
Uncles []*Block
UncleSha []byte
// The coin base address
Coinbase []byte
// Difficulty for the current block
Difficulty *big.Int
// Creation time
Time int64
// The block number
Number *big.Int
// Minimum Gas Price
MinGasPrice *big.Int
// Gas limit
GasLimit *big.Int
// Gas used
GasUsed *big.Int
// Extra data
Extra string
// Block Nonce for verification
Nonce []byte
TxSha []byte
// contains filtered or unexported fields
}
func CreateBlock ¶
func NewBlockFromBytes ¶
func NewBlockFromRlpValue ¶
New block takes a raw encoded string
func NewUncleBlockFromValue ¶
func (*Block) GetTransaction ¶
func (self *Block) GetTransaction(hash []byte) *Transaction
func (*Block) HashNoNonce ¶
func (*Block) RlpValueDecode ¶
func (*Block) SetReceipts ¶
func (self *Block) SetReceipts(receipts []*Receipt, txs []*Transaction)
func (*Block) Transactions ¶
func (block *Block) Transactions() []*Transaction
type BlockChain ¶
type BlockChain struct {
Ethereum EthManager
// Last known total difficulty
TD *big.Int
LastBlockNumber uint64
CurrentBlock *Block
LastBlockHash []byte
// contains filtered or unexported fields
}
func NewBlockChain ¶
func NewBlockChain(ethereum EthManager) *BlockChain
func (*BlockChain) Add ¶
func (bc *BlockChain) Add(block *Block)
Add a block to the chain and record addition information
func (*BlockChain) BlockInfo ¶
func (bc *BlockChain) BlockInfo(block *Block) BlockInfo
func (*BlockChain) BlockInfoByHash ¶
func (bc *BlockChain) BlockInfoByHash(hash []byte) BlockInfo
func (*BlockChain) CalculateBlockTD ¶
func (bc *BlockChain) CalculateBlockTD(block *Block) *big.Int
func (*BlockChain) FindCanonicalChain ¶
func (bc *BlockChain) FindCanonicalChain(blocks []*Block, commonBlockHash []byte) bool
Is tasked by finding the CanonicalChain and resetting the chain if we are not the Conical one Return true if we are the using the canonical chain false if not
func (*BlockChain) FindCanonicalChainFromMsg ¶
func (bc *BlockChain) FindCanonicalChainFromMsg(msg *ethwire.Msg, commonBlockHash []byte) bool
func (*BlockChain) Genesis ¶
func (bc *BlockChain) Genesis() *Block
func (*BlockChain) GenesisBlock ¶
func (bc *BlockChain) GenesisBlock() *Block
func (*BlockChain) GetBlock ¶
func (bc *BlockChain) GetBlock(hash []byte) *Block
func (*BlockChain) GetBlockByNumber ¶
func (self *BlockChain) GetBlockByNumber(num uint64) *Block
func (*BlockChain) GetChainFromHash ¶
func (bc *BlockChain) GetChainFromHash(hash []byte, max uint64) []interface{}
Get chain return blocks from hash up to max in RLP format
func (*BlockChain) GetChainHashesFromHash ¶
func (self *BlockChain) GetChainHashesFromHash(hash []byte, max uint64) (chain [][]byte)
func (*BlockChain) HasBlock ¶
func (bc *BlockChain) HasBlock(hash []byte) bool
func (*BlockChain) HasBlockWithPrevHash ¶
func (bc *BlockChain) HasBlockWithPrevHash(hash []byte) bool
TODO: At one point we might want to save a block by prevHash in the db to optimise this...
func (*BlockChain) NewBlock ¶
func (bc *BlockChain) NewBlock(coinbase []byte) *Block
func (*BlockChain) ResetTillBlockHash ¶
func (bc *BlockChain) ResetTillBlockHash(hash []byte) error
func (*BlockChain) SetTotalDifficulty ¶
func (bc *BlockChain) SetTotalDifficulty(td *big.Int)
func (*BlockChain) Stop ¶
func (bc *BlockChain) Stop()
type BlockProcessor ¶
type BlockProcessor interface {
ProcessBlock(block *Block)
}
type BloomFilter ¶
type BloomFilter struct {
// contains filtered or unexported fields
}
func NewBloomFilter ¶
func NewBloomFilter(bin []byte) *BloomFilter
func (*BloomFilter) Bin ¶
func (self *BloomFilter) Bin() []byte
func (*BloomFilter) Search ¶
func (self *BloomFilter) Search(addr []byte) bool
func (*BloomFilter) Set ¶
func (self *BloomFilter) Set(addr []byte)
type EasyPow ¶
type EasyPow struct {
HashRate int64
// contains filtered or unexported fields
}
func (*EasyPow) GetHashrate ¶
type EthManager ¶
type EthManager interface {
StateManager() *StateManager
BlockChain() *BlockChain
TxPool() *TxPool
Broadcast(msgType ethwire.MsgType, data []interface{})
Reactor() *ethreact.ReactorEngine
PeerCount() int
IsMining() bool
IsListening() bool
Peers() *list.List
KeyManager() *ethcrypto.KeyManager
ClientIdentity() ethwire.ClientIdentity
Db() ethutil.Database
}
type Filter ¶
type Filter struct {
// 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 NewFilterFromMap ¶
func NewFilterFromMap(object map[string]interface{}, eth EthManager) *Filter
func (*Filter) AddAltered ¶
func (*Filter) FilterMessages ¶
func (*Filter) SetEarliestBlock ¶
func (self *Filter) SetEarliestBlock(earliest interface{})
Set the earliest and latest block for filtering. -1 = latest block (i.e., the current block) hash = particular hash from-to
func (*Filter) SetLatestBlock ¶
func (self *Filter) SetLatestBlock(latest interface{})
type GasLimitErr ¶
func GasLimitError ¶
func GasLimitError(is, max *big.Int) *GasLimitErr
func (*GasLimitErr) Error ¶
func (err *GasLimitErr) Error() string
type NonceErr ¶
func NonceError ¶
type OutOfGasErr ¶
type OutOfGasErr struct {
Message string
}
func OutOfGasError ¶
func OutOfGasError() *OutOfGasErr
func (*OutOfGasErr) Error ¶
func (self *OutOfGasErr) Error() string
type ParentErr ¶
type ParentErr struct {
Message string
}
Parent error. In case a parent is unknown this error will be thrown by the block manager
type Receipt ¶
type Receipt struct {
Tx *Transaction
PostState []byte
CumulativeGasUsed *big.Int
}
func NewRecieptFromValue ¶
func (*Receipt) RlpValueDecode ¶
type StateManager ¶
type StateManager struct {
// Proof of work used for validating
Pow PoW
// The ethereum manager interface
Ethereum EthManager
// contains filtered or unexported fields
}
func NewStateManager ¶
func NewStateManager(ethereum EthManager) *StateManager
func (*StateManager) AccumelateRewards ¶
func (sm *StateManager) AccumelateRewards(state *ethstate.State, block *Block) error
func (*StateManager) BlockChain ¶
func (sm *StateManager) BlockChain() *BlockChain
func (*StateManager) CalculateTD ¶
func (sm *StateManager) CalculateTD(block *Block) bool
func (*StateManager) CurrentState ¶
func (sm *StateManager) CurrentState() *ethstate.State
func (*StateManager) GetMessages ¶
func (sm *StateManager) GetMessages(block *Block) (messages []*ethstate.Message, err error)
func (*StateManager) MiningState ¶
func (sm *StateManager) MiningState() *ethstate.State
func (*StateManager) NewMiningState ¶
func (sm *StateManager) NewMiningState() *ethstate.State
func (*StateManager) Process ¶
func (sm *StateManager) Process(block *Block, dontReact bool) (err error)
func (*StateManager) ProcessTransactions ¶
func (self *StateManager) ProcessTransactions(coinbase *ethstate.StateObject, state *ethstate.State, block, parent *Block, txs Transactions) (Receipts, Transactions, Transactions, error)
func (*StateManager) Stop ¶
func (sm *StateManager) Stop()
func (*StateManager) TransState ¶
func (sm *StateManager) TransState() *ethstate.State
func (*StateManager) ValidateBlock ¶
func (sm *StateManager) ValidateBlock(block *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 StateTransition ¶
type StateTransition struct {
// 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 * 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 *ethstate.StateObject, tx *Transaction, state *ethstate.State, block *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() *ethstate.StateObject
func (*StateTransition) Eval ¶
func (self *StateTransition) Eval(msg *ethstate.Message, script []byte, context *ethstate.StateObject, typ string) (ret []byte, err error)
func (*StateTransition) MakeStateObject ¶
func (self *StateTransition) MakeStateObject(state *ethstate.State, tx *Transaction) *ethstate.StateObject
func (*StateTransition) Receiver ¶
func (self *StateTransition) Receiver() *ethstate.StateObject
func (*StateTransition) RefundGas ¶
func (self *StateTransition) RefundGas()
func (*StateTransition) Sender ¶
func (self *StateTransition) Sender() *ethstate.StateObject
func (*StateTransition) TransitionState ¶
func (self *StateTransition) TransitionState() (err error)
type Transaction ¶
type Transaction struct {
Nonce uint64
Recipient []byte
Value *big.Int
Gas *big.Int
GasPrice *big.Int
Data []byte
// contains filtered or unexported fields
}
func FindTx ¶
func FindTx(pool *list.List, finder func(*Transaction, *list.Element) bool) *Transaction
func NewContractCreationTx ¶
func NewContractCreationTx(value, gas, gasPrice *big.Int, script []byte) *Transaction
func NewTransactionFromBytes ¶
func NewTransactionFromBytes(data []byte) *Transaction
func NewTransactionFromValue ¶
func NewTransactionFromValue(val *ethutil.Value) *Transaction
func NewTransactionMessage ¶
func NewTransactionMessage(to []byte, value, gas, gasPrice *big.Int, data []byte) *Transaction
func (*Transaction) CreatesContract ¶
func (tx *Transaction) CreatesContract() bool
func (*Transaction) CreationAddress ¶
func (tx *Transaction) CreationAddress() []byte
func (*Transaction) GasValue ¶
func (self *Transaction) GasValue() *big.Int
func (*Transaction) Hash ¶
func (tx *Transaction) Hash() []byte
func (*Transaction) PublicKey ¶
func (tx *Transaction) PublicKey() []byte
func (*Transaction) RlpData ¶
func (tx *Transaction) RlpData() interface{}
func (*Transaction) RlpDecode ¶
func (tx *Transaction) RlpDecode(data []byte)
func (*Transaction) RlpEncode ¶
func (tx *Transaction) RlpEncode() []byte
func (*Transaction) RlpValue ¶
func (tx *Transaction) RlpValue() *ethutil.Value
func (*Transaction) RlpValueDecode ¶
func (tx *Transaction) RlpValueDecode(decoder *ethutil.Value)
func (*Transaction) Sender ¶
func (tx *Transaction) Sender() []byte
func (*Transaction) Sign ¶
func (tx *Transaction) Sign(privk []byte) error
func (*Transaction) Signature ¶
func (tx *Transaction) Signature(key []byte) []byte
func (*Transaction) String ¶
func (tx *Transaction) String() string
func (*Transaction) TotalValue ¶
func (self *Transaction) TotalValue() *big.Int
type Transactions ¶
type Transactions []*Transaction
Transaction slice type for basic sorting
func (Transactions) Len ¶
func (s Transactions) Len() int
func (Transactions) Swap ¶
func (s Transactions) Swap(i, j int)
type TxByNonce ¶
type TxByNonce struct{ Transactions }
type TxMsg ¶
type TxMsg struct {
Tx *Transaction
Type TxMsgTy
}
type TxPool ¶
type TxPool struct {
Ethereum EthManager
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(ethereum EthManager) *TxPool
func (*TxPool) CurrentTransactions ¶
func (pool *TxPool) CurrentTransactions() []*Transaction
func (*TxPool) Flush ¶
func (pool *TxPool) Flush() []*Transaction
func (*TxPool) QueueTransaction ¶
func (pool *TxPool) QueueTransaction(tx *Transaction)
func (*TxPool) RemoveInvalid ¶
func (*TxPool) ValidateTransaction ¶
func (pool *TxPool) ValidateTransaction(tx *Transaction) error
type TxPoolHook ¶
type TxPoolHook chan *Transaction
type TxProcessor ¶
type TxProcessor interface {
ProcessTransaction(tx *Transaction)
}
type VMEnv ¶
type VMEnv struct {
// contains filtered or unexported fields
}
func (*VMEnv) BlockNumber ¶
func (*VMEnv) Difficulty ¶
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
func (*ValidationErr) Error ¶
func (err *ValidationErr) Error() string