Versions in this module Expand all Collapse all v1 v1.0.2 Dec 20, 2016 Changes in this version + const BlockChainVersion + var BadHashes = map[common.Hash]bool + var Big0 = big.NewInt(0) + var BlockEqualTSErr = errors.New("block time stamp equal to previous") + var BlockFutureErr = errors.New("block time is in the future") + var BlockNumberErr = errors.New("block number invalid") + var BlockReward *big.Int = big.NewInt(5e+18) + var BlockTSTooBigErr = errors.New("block time too big") + var ChainConfigNotFoundErr = errors.New("ChainConfig not found") + var ErrGasLimit = errors.New("Exceeds block gas limit") + var ErrInsufficientFunds = errors.New("Insufficient funds for gas * price + value") + var ErrIntrinsicGas = errors.New("Intrinsic gas too low") + var ErrInvalidGasPrice = errors.New("Gas price not 0") + var ErrInvalidSender = errors.New("Invalid sender") + var ErrNegativeValue = errors.New("Negative value") + var ErrNoGenesis = errors.New("Genesis not found in chain") + var ErrNonExistentAccount = errors.New("Account doesn't exist") + var ErrNonce = errors.New("Nonce too low") + var ExpDiffPeriod = big.NewInt(100000) + var MIPMapLevels = []uint64 + func AccumulateRewards(statedb *state.StateDB, header *types.Header, uncles []*types.Header) + func ApplyDAOHardFork(statedb *state.StateDB) + func ApplyMessage(env vm.Environment, msg Message, gp *GasPool) ([]byte, *big.Int, error) + func ApplyTransaction(config *ChainConfig, bc *BlockChain, gp *GasPool, ...) (*types.Receipt, vm.Logs, *big.Int, error) + func CalcDifficulty(config *ChainConfig, time, parentTime uint64, ...) *big.Int + func CalcGasLimit(parent *types.Block) *big.Int + func Call(env vm.Environment, caller vm.ContractRef, addr common.Address, input []byte, ...) (ret []byte, err error) + func CallCode(env vm.Environment, caller vm.ContractRef, addr common.Address, input []byte, ...) (ret []byte, err error) + func Create(env vm.Environment, caller vm.ContractRef, code []byte, ...) (ret []byte, address common.Address, err error) + func DefaultGenesisBlock() string + func DelegateCall(env vm.Environment, caller vm.ContractRef, addr common.Address, input []byte, ...) (ret []byte, err error) + func DeleteBlock(db ethdb.Database, hash common.Hash, number uint64) + func DeleteBlockReceipts(db ethdb.Database, hash common.Hash, number uint64) + func DeleteBody(db ethdb.Database, hash common.Hash, number uint64) + func DeleteCanonicalHash(db ethdb.Database, number uint64) + func DeleteHeader(db ethdb.Database, hash common.Hash, number uint64) + func DeleteReceipt(db ethdb.Database, hash common.Hash) + func DeleteTd(db ethdb.Database, hash common.Hash, number uint64) + func DeleteTransaction(db ethdb.Database, hash common.Hash) + func Disassemble(script []byte) (asm []string) + func GenerateChain(config *ChainConfig, parent *types.Block, db ethdb.Database, n int, ...) ([]*types.Block, []types.Receipts) + func GenesisBlockForTesting(db ethdb.Database, addr common.Address, balance *big.Int) *types.Block + func GetBlock(db ethdb.Database, hash common.Hash, number uint64) *types.Block + func GetBlockByHashOld(db ethdb.Database, hash common.Hash) *types.Block + func GetBlockChainVersion(db ethdb.Database) int + func GetBlockNumber(db ethdb.Database, hash common.Hash) uint64 + func GetBlockReceipts(db ethdb.Database, hash common.Hash, number uint64) types.Receipts + func GetBody(db ethdb.Database, hash common.Hash, number uint64) *types.Body + func GetBodyRLP(db ethdb.Database, hash common.Hash, number uint64) rlp.RawValue + func GetCanonicalHash(db ethdb.Database, number uint64) common.Hash + func GetHashFn(ref common.Hash, chain *BlockChain) func(n uint64) common.Hash + func GetHeadBlockHash(db ethdb.Database) common.Hash + func GetHeadFastBlockHash(db ethdb.Database) common.Hash + func GetHeadHeaderHash(db ethdb.Database) common.Hash + func GetHeader(db ethdb.Database, hash common.Hash, number uint64) *types.Header + func GetHeaderRLP(db ethdb.Database, hash common.Hash, number uint64) rlp.RawValue + func GetMipmapBloom(db ethdb.Database, number, level uint64) types.Bloom + func GetPrivateStateRoot(db ethdb.Database, blockRoot common.Hash) common.Hash + func GetReceipt(db ethdb.Database, txHash common.Hash) *types.Receipt + func GetTd(db ethdb.Database, hash common.Hash, number uint64) *big.Int + func GetTransaction(db ethdb.Database, hash common.Hash) (*types.Transaction, common.Hash, uint64, uint64) + func IntrinsicGas(data []byte, contractCreation, homestead bool) *big.Int + func IsBadHashError(err error) bool + func IsBlockNonceErr(err error) bool + func IsGasLimitErr(err error) bool + func IsInvalidTxErr(err error) bool + func IsKnownBlockErr(e error) bool + func IsNonceErr(err error) bool + func IsParentErr(err error) bool + func IsTDError(e error) bool + func IsUncleErr(err error) bool + func IsValidationErr(err error) bool + func IsValueTransferErr(e error) bool + func MakeCallHelper() *callHelper + func MessageCreatesContract(msg Message) bool + func OlympicGenesisBlock() string + func ParentError(hash common.Hash) error + func TestNetGenesisBlock() string + func Transfer(from, to vm.Account, amount *big.Int) + func UncleError(format string, v ...interface{}) error + func ValidateDAOHeaderExtraData(config *ChainConfig, header *types.Header) error + func ValidateExtraData(chaindb ethdb.Database, bc *BlockChain, config *ChainConfig, ...) error + func ValidateHeader(chaindb ethdb.Database, bc *BlockChain, config *ChainConfig, ...) error + func WriteBlock(db ethdb.Database, block *types.Block) error + func WriteBlockChainVersion(db ethdb.Database, vsn int) + func WriteBlockReceipts(db ethdb.Database, hash common.Hash, number uint64, receipts types.Receipts) error + func WriteBody(db ethdb.Database, hash common.Hash, number uint64, body *types.Body) error + func WriteCanonicalHash(db ethdb.Database, hash common.Hash, number uint64) error + func WriteChainConfig(db ethdb.Database, hash common.Hash, cfg *ChainConfig) error + func WriteDefaultGenesisBlock(chainDb ethdb.Database) (*types.Block, error) + func WriteGenesisBlock(chainDb ethdb.Database, reader io.Reader) (*types.Block, error) + func WriteGenesisBlockForTesting(db ethdb.Database, accounts ...GenesisAccount) *types.Block + func WriteHeadBlockHash(db ethdb.Database, hash common.Hash) error + func WriteHeadFastBlockHash(db ethdb.Database, hash common.Hash) error + func WriteHeadHeaderHash(db ethdb.Database, hash common.Hash) error + func WriteHeader(db ethdb.Database, header *types.Header) error + func WriteMipmapBloom(db ethdb.Database, number uint64, receipts types.Receipts) error + func WriteOlympicGenesisBlock(db ethdb.Database) (*types.Block, error) + func WritePrivateStateRoot(db ethdb.Database, blockRoot, root common.Hash) error + func WriteReceipts(db ethdb.Database, receipts types.Receipts) error + func WriteTd(db ethdb.Database, hash common.Hash, number uint64, td *big.Int) error + func WriteTestNetGenesisBlock(chainDb ethdb.Database) (*types.Block, error) + func WriteTransactions(db ethdb.Database, block *types.Block) error + type Backend interface + AccountManager func() *accounts.Manager + BlockChain func() *BlockChain + ChainDb func() ethdb.Database + DappDb func() ethdb.Database + EventMux func() *event.TypeMux + TxPool func() *TxPool + type BadHashError common.Hash + func (h BadHashError) Error() string + type BlockChain struct + func NewBlockChain(chainDb ethdb.Database, config *ChainConfig, pow pow.PoW, mux *event.TypeMux, ...) (*BlockChain, error) + func (bc *BlockChain) Genesis() *types.Block + func (bc *BlockChain) HasBlock(hash common.Hash) bool + func (bc *BlockChain) HasBlockAndState(hash common.Hash) bool + func (bc *BlockChain) HasHeader(hash common.Hash) bool + func (bc *BlockChain) Reset() + func (bc *BlockChain) ResetWithGenesisBlock(genesis *types.Block) + func (bc *BlockChain) SetHead(head uint64) + func (bc *BlockChain) Stop() + func (self *BlockChain) Config() *ChainConfig + func (self *BlockChain) CurrentBlock() *types.Block + func (self *BlockChain) CurrentFastBlock() *types.Block + func (self *BlockChain) CurrentHeader() *types.Header + func (self *BlockChain) Export(w io.Writer) error + func (self *BlockChain) ExportN(w io.Writer, first uint64, last uint64) error + func (self *BlockChain) FastSyncCommitHead(hash common.Hash) error + func (self *BlockChain) GasLimit() *big.Int + func (self *BlockChain) GetBlock(hash common.Hash, number uint64) *types.Block + func (self *BlockChain) GetBlockByHash(hash common.Hash) *types.Block + func (self *BlockChain) GetBlockByNumber(number uint64) *types.Block + func (self *BlockChain) GetBlockHashesFromHash(hash common.Hash, max uint64) []common.Hash + func (self *BlockChain) GetBlocksFromHash(hash common.Hash, n int) (blocks []*types.Block) + func (self *BlockChain) GetBody(hash common.Hash) *types.Body + func (self *BlockChain) GetBodyRLP(hash common.Hash) rlp.RawValue + func (self *BlockChain) GetHeader(hash common.Hash, number uint64) *types.Header + func (self *BlockChain) GetHeaderByHash(hash common.Hash) *types.Header + func (self *BlockChain) GetHeaderByNumber(number uint64) *types.Header + func (self *BlockChain) GetTd(hash common.Hash, number uint64) *big.Int + func (self *BlockChain) GetTdByHash(hash common.Hash) *big.Int + func (self *BlockChain) GetUnclesInChain(block *types.Block, length int) []*types.Header + func (self *BlockChain) InsertChain(chain types.Blocks) (int, error) + func (self *BlockChain) InsertHeaderChain(chain []*types.Header, checkFreq int) (int, error) + func (self *BlockChain) InsertReceiptChain(blockChain types.Blocks, receiptChain []types.Receipts) (int, error) + func (self *BlockChain) LastBlockHash() common.Hash + func (self *BlockChain) Processor() Processor + func (self *BlockChain) Rollback(chain []common.Hash) + func (self *BlockChain) SetProcessor(processor Processor) + func (self *BlockChain) SetValidator(validator Validator) + func (self *BlockChain) State() (*state.StateDB, *state.StateDB, error) + func (self *BlockChain) StateAt(root common.Hash) (*state.StateDB, *state.StateDB, error) + func (self *BlockChain) Status() (td *big.Int, currentBlock common.Hash, genesisBlock common.Hash) + func (self *BlockChain) Validator() Validator + func (self *BlockChain) WriteBlock(block *types.Block) (status WriteStatus, err error) + type BlockGen struct + func (b *BlockGen) AddTx(tx *types.Transaction) + func (b *BlockGen) AddUncheckedReceipt(receipt *types.Receipt) + func (b *BlockGen) AddUncle(h *types.Header) + func (b *BlockGen) Number() *big.Int + func (b *BlockGen) OffsetTime(seconds int64) + func (b *BlockGen) PrevBlock(index int) *types.Block + func (b *BlockGen) SetCoinbase(addr common.Address) + func (b *BlockGen) SetExtra(data []byte) + func (b *BlockGen) TxNonce(addr common.Address) uint64 + type BlockNonceErr struct + Hash common.Hash + Nonce uint64 + Number *big.Int + func (err *BlockNonceErr) Error() string + type BlockValidator struct + func NewBlockValidator(chaindb ethdb.Database, config *ChainConfig, blockchain *BlockChain, ...) *BlockValidator + func (v *BlockValidator) ValidateBlock(block *types.Block) error + func (v *BlockValidator) ValidateHeader(chaindb ethdb.Database, header, parent *types.Header) error + func (v *BlockValidator) ValidateState(block, parent *types.Block, statedb *state.StateDB, receipts types.Receipts, ...) (err error) + func (v *BlockValidator) VerifyUncles(block, parent *types.Block) error + type ChainConfig struct + DAOForkBlock *big.Int + DAOForkSupport bool + HomesteadBlock *big.Int + HomesteadGasRepriceBlock *big.Int + HomesteadGasRepriceHash common.Hash + VmConfig vm.Config + func GetChainConfig(db ethdb.Database, hash common.Hash) (*ChainConfig, error) + func MakeChainConfig() *ChainConfig + func (c *ChainConfig) GasTable(num *big.Int) params.GasTable + func (c *ChainConfig) IsHomestead(num *big.Int) bool + type ChainEvent struct + Block *types.Block + Hash common.Hash + Logs vm.Logs + type ChainHeadEvent struct + Block *types.Block + type ChainSideEvent struct + Block *types.Block + Logs vm.Logs + type ChainSplitEvent struct + Block *types.Block + Logs vm.Logs + type ChainUncleEvent struct + Block *types.Block + type DeleteCallback func(common.Hash, uint64) + type DualStateEnv interface + Pop func() + PrivateState func() *state.StateDB + PublicState func() *state.StateDB + Push func(*state.StateDB) + type FakePow struct + func (f FakePow) GetHashrate() int64 + func (f FakePow) Search(block pow.Block, stop <-chan struct{}, index int) (uint64, []byte) + func (f FakePow) Turbo(bool) + func (f FakePow) Verify(block pow.Block) bool + type Finiliser interface + Finilise func(block *types.Block) error + type GasLimitErr struct + Have *big.Int + Want *big.Int + func (err *GasLimitErr) Error() string + type GasPool big.Int + func (gp *GasPool) AddGas(amount *big.Int) *GasPool + func (gp *GasPool) String() string + func (gp *GasPool) SubGas(amount *big.Int) error + type GasPriceChanged struct + Price *big.Int + type GenesisAccount struct + Address common.Address + Balance *big.Int + type HeaderChain struct + func NewHeaderChain(chainDb ethdb.Database, config *ChainConfig, getValidator getHeaderValidatorFn, ...) (*HeaderChain, error) + func (hc *HeaderChain) CurrentHeader() *types.Header + func (hc *HeaderChain) GetBlockHashesFromHash(hash common.Hash, max uint64) []common.Hash + func (hc *HeaderChain) GetBlockNumber(hash common.Hash) uint64 + func (hc *HeaderChain) GetHeader(hash common.Hash, number uint64) *types.Header + func (hc *HeaderChain) GetHeaderByHash(hash common.Hash) *types.Header + func (hc *HeaderChain) GetHeaderByNumber(number uint64) *types.Header + func (hc *HeaderChain) GetTd(hash common.Hash, number uint64) *big.Int + func (hc *HeaderChain) GetTdByHash(hash common.Hash) *big.Int + func (hc *HeaderChain) HasHeader(hash common.Hash) bool + func (hc *HeaderChain) InsertHeaderChain(chain []*types.Header, checkFreq int, writeHeader WhCallback) (int, error) + func (hc *HeaderChain) SetCurrentHeader(head *types.Header) + func (hc *HeaderChain) SetGenesis(head *types.Header) + func (hc *HeaderChain) SetHead(head uint64, delFn DeleteCallback) + func (hc *HeaderChain) WriteHeader(header *types.Header) (status WriteStatus, err error) + func (hc *HeaderChain) WriteTd(hash common.Hash, number uint64, td *big.Int) error + type HeaderValidator interface + ValidateHeader func(chaindb ethdb.Database, header, parent *types.Header) error + type InvalidTxErr struct + Message string + func InvalidTxError(err error) *InvalidTxErr + func (err *InvalidTxErr) Error() string + type KnownBlockError struct + func (self *KnownBlockError) Error() string + type Message interface + CheckNonce func() bool + Data func() []byte + From func() (common.Address, error) + FromFrontier func() (common.Address, error) + Gas func() *big.Int + GasPrice func() *big.Int + Nonce func() uint64 + To func() *common.Address + Value func() *big.Int + type NewBlockEvent struct + Block *types.Block + type NewMinedBlockEvent struct + Block *types.Block + type NonceErr struct + Exp uint64 + Is uint64 + Message string + func NonceError(is, exp uint64) *NonceErr + func (err *NonceErr) Error() string + type ParentErr struct + Message string + func (err *ParentErr) Error() string + type PendingBlockEvent struct + Block *types.Block + Logs vm.Logs + type PendingLogsEvent struct + Logs vm.Logs + type PendingStateEvent struct + type PrivateMessage interface + IsPrivate func() bool + type Processor interface + Process func(block *types.Block, publicState, privateState *state.StateDB, cfg vm.Config) (types.Receipts, vm.Logs, *big.Int, error) + type RemovedLogsEvent struct + Logs vm.Logs + type RemovedTransactionEvent struct + Txs types.Transactions + type StartMining struct + type StateProcessor struct + func NewStateProcessor(config *ChainConfig, bc *BlockChain) *StateProcessor + func (p *StateProcessor) Process(block *types.Block, publicState, privateState *state.StateDB, cfg vm.Config) (types.Receipts, vm.Logs, *big.Int, error) + type StateTransition struct + func NewStateTransition(env vm.Environment, msg Message, gp *GasPool) *StateTransition + func (self *StateTransition) TransitionDb() (ret []byte, requiredGas, usedGas *big.Int, err error) + type TDError struct + func (self *TDError) Error() string + type TopMining struct + type TxPool struct + func NewTxPool(config *ChainConfig, eventMux *event.TypeMux, currentStateFn stateFn, ...) *TxPool + func (pool *TxPool) Add(tx *types.Transaction) error + func (pool *TxPool) AddBatch(txs []*types.Transaction) + func (pool *TxPool) Content() (map[common.Address]types.Transactions, map[common.Address]types.Transactions) + func (pool *TxPool) Get(hash common.Hash) *types.Transaction + func (pool *TxPool) Nonce(addr common.Address) uint64 + func (pool *TxPool) Pending() map[common.Address]types.Transactions + func (pool *TxPool) Remove(hash common.Hash) + func (pool *TxPool) RemoveBatch(txs types.Transactions) + func (pool *TxPool) SetLocal(tx *types.Transaction) + func (pool *TxPool) State() *state.ManagedState + func (pool *TxPool) Stats() (pending int, queued int) + func (pool *TxPool) Stop() + type TxPostEvent struct + Tx *types.Transaction + type TxPreEvent struct + Tx *types.Transaction + type UncleErr struct + Message string + func (err *UncleErr) Error() string + type VMEnv struct + func NewEnv(publicState, privateState *state.StateDB, chainConfig *ChainConfig, ...) *VMEnv + func (env *VMEnv) Pop() + func (env *VMEnv) PrivateState() *state.StateDB + func (env *VMEnv) PublicState() *state.StateDB + func (env *VMEnv) Push(state *state.StateDB) + func (env *VMEnv) ReadOnly() bool + func (self *VMEnv) AddLog(log *vm.Log) + func (self *VMEnv) BlockNumber() *big.Int + func (self *VMEnv) Call(me vm.ContractRef, addr common.Address, data []byte, ...) ([]byte, error) + func (self *VMEnv) CallCode(me vm.ContractRef, addr common.Address, data []byte, ...) ([]byte, error) + func (self *VMEnv) CanTransfer(from common.Address, balance *big.Int) bool + func (self *VMEnv) Coinbase() common.Address + func (self *VMEnv) Create(me vm.ContractRef, data []byte, gas, price, value *big.Int) ([]byte, common.Address, error) + func (self *VMEnv) Db() vm.Database + func (self *VMEnv) DelegateCall(me vm.ContractRef, addr common.Address, data []byte, gas, price *big.Int) ([]byte, error) + func (self *VMEnv) Depth() int + func (self *VMEnv) Difficulty() *big.Int + func (self *VMEnv) GasLimit() *big.Int + func (self *VMEnv) GetHash(n uint64) common.Hash + func (self *VMEnv) Origin() common.Address + func (self *VMEnv) RevertToSnapshot(snapshot int) + func (self *VMEnv) RuleSet() vm.RuleSet + func (self *VMEnv) SetDepth(i int) + func (self *VMEnv) SnapshotDatabase() int + func (self *VMEnv) Time() *big.Int + func (self *VMEnv) Transfer(from, to vm.Account, amount *big.Int) + func (self *VMEnv) Value() *big.Int + func (self *VMEnv) Vm() vm.Vm + type ValidationErr struct + Message string + func ValidationError(format string, v ...interface{}) *ValidationErr + func (err *ValidationErr) Error() string + type Validator interface + ValidateBlock func(block *types.Block) error + ValidateState func(block, parent *types.Block, state *state.StateDB, receipts types.Receipts, ...) error + type ValueTransferError struct + func ValueTransferErr(str string, v ...interface{}) *ValueTransferError + func (self *ValueTransferError) Error() string + type WhCallback func(*types.Header) error + type WriteStatus byte + const CanonStatTy + const NonStatTy + const SideStatTy + const SplitStatTy