Versions in this module Expand all Collapse all v1 v1.6.9 May 31, 2018 Changes in this version + const BlockChainVersion + var BadHashes = map[common.Hash]bool + var Big0 = big.NewInt(0) + var BlockReward = big.NewInt(5e+18) + var DefaultTxPoolConfig = TxPoolConfig + var ErrBlacklistedHash = errors.New("blacklisted hash") + var ErrChainConfigNotFound = errors.New("ChainConfig not found") + var ErrGasLimit = errors.New("exceeds block gas limit") + var ErrGasLimitReached = errors.New("gas limit reached") + var ErrInsufficientFunds = errors.New("insufficient funds for gas * price + value") + var ErrIntrinsicGas = errors.New("intrinsic gas too low") + var ErrInvalidSender = errors.New("invalid sender") + var ErrKnownBlock = errors.New("block already known") + var ErrNegativeValue = errors.New("negative value") + var ErrNoGenesis = errors.New("Genesis not found in chain") + var ErrNonceTooLow = errors.New("nonce too low") + var ErrOversizedData = errors.New("oversized data") + var ErrReplaceUnderpriced = errors.New("replacement transaction underpriced") + var ErrUnderpriced = errors.New("transaction underpriced") + var MIPMapLevels = []uint64 + func ApplyDAOHardFork(statedb *state.StateDB) + func ApplyMessage(evm *vm.EVM, msg Message, gp *GasPool) ([]byte, *big.Int, error) + func ApplyTransaction(config *params.ChainConfig, bc *BlockChain, author *common.Address, ...) (*types.Receipt, *big.Int, error) + func CalcGasLimit(parent *types.Block) *big.Int + func CanTransfer(db vm.StateDB, addr common.Address, amount *big.Int) bool + 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 FindCommonAncestor(db ethdb.Database, a, b *types.Header) *types.Header + func GenerateChain(config *params.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 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 GetChainConfig(db ethdb.Database, hash common.Hash) (*params.ChainConfig, error) + func GetHashFn(ref *types.Header, chain ChainContext) 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 GetReceipt(db ethdb.Database, hash 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 NewEVMContext(msg Message, header *types.Header, chain ChainContext, author *common.Address) vm.Context + func PreimageTable(db ethdb.Database) ethdb.Database + func SetReceiptsData(config *params.ChainConfig, block *types.Block, receipts types.Receipts) + func SetupGenesisBlock(db ethdb.Database, genesis *Genesis) (*params.ChainConfig, common.Hash, error) + func Transfer(db vm.StateDB, sender, recipient common.Address, amount *big.Int) + func ValidateDAOHeaderExtraData(config *params.ChainConfig, header *types.Header) 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 WriteBodyRLP(db ethdb.Database, hash common.Hash, number uint64, rlp rlp.RawValue) error + func WriteCanonicalHash(db ethdb.Database, hash common.Hash, number uint64) error + func WriteChainConfig(db ethdb.Database, hash common.Hash, cfg *params.ChainConfig) error + 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 WritePreimages(db ethdb.Database, number uint64, preimages map[common.Hash][]byte) error + func WriteReceipt(db ethdb.Database, receipt *types.Receipt) 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 WriteTransactions(db ethdb.Database, block *types.Block) error + type BadBlockArgs struct + Hash common.Hash + Header *types.Header + type BlockChain struct + func NewBlockChain(chainDb ethdb.Database, config *params.ChainConfig, engine consensus.Engine, ...) (*BlockChain, error) + func (bc *BlockChain) BadBlocks() ([]BadBlockArgs, error) + func (bc *BlockChain) Config() *params.ChainConfig + func (bc *BlockChain) CurrentBlock() *types.Block + func (bc *BlockChain) CurrentFastBlock() *types.Block + func (bc *BlockChain) CurrentHeader() *types.Header + func (bc *BlockChain) Engine() consensus.Engine + func (bc *BlockChain) Export(w io.Writer) error + func (bc *BlockChain) ExportN(w io.Writer, first uint64, last uint64) error + func (bc *BlockChain) FastSyncCommitHead(hash common.Hash) error + func (bc *BlockChain) GasLimit() *big.Int + func (bc *BlockChain) Genesis() *types.Block + func (bc *BlockChain) GetBlock(hash common.Hash, number uint64) *types.Block + func (bc *BlockChain) GetBlockByHash(hash common.Hash) *types.Block + func (bc *BlockChain) GetBlockByNumber(number uint64) *types.Block + func (bc *BlockChain) GetBlockHashesFromHash(hash common.Hash, max uint64) []common.Hash + func (bc *BlockChain) GetBlocksFromHash(hash common.Hash, n int) (blocks []*types.Block) + func (bc *BlockChain) GetBody(hash common.Hash) *types.Body + func (bc *BlockChain) GetBodyRLP(hash common.Hash) rlp.RawValue + func (bc *BlockChain) GetHeader(hash common.Hash, number uint64) *types.Header + func (bc *BlockChain) GetHeaderByHash(hash common.Hash) *types.Header + func (bc *BlockChain) GetHeaderByNumber(number uint64) *types.Header + func (bc *BlockChain) GetTd(hash common.Hash, number uint64) *big.Int + func (bc *BlockChain) GetTdByHash(hash common.Hash) *big.Int + func (bc *BlockChain) GetUnclesInChain(block *types.Block, length int) []*types.Header + 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) InsertChain(chain types.Blocks) (int, error) + func (bc *BlockChain) InsertHeaderChain(chain []*types.Header, checkFreq int) (int, error) + func (bc *BlockChain) InsertReceiptChain(blockChain types.Blocks, receiptChain []types.Receipts) (int, error) + func (bc *BlockChain) LastBlockHash() common.Hash + func (bc *BlockChain) Processor() Processor + func (bc *BlockChain) Reset() error + func (bc *BlockChain) ResetWithGenesisBlock(genesis *types.Block) error + func (bc *BlockChain) Rollback(chain []common.Hash) + func (bc *BlockChain) SetHead(head uint64) error + func (bc *BlockChain) SetProcessor(processor Processor) + func (bc *BlockChain) SetValidator(validator Validator) + func (bc *BlockChain) State() (*state.StateDB, error) + func (bc *BlockChain) StateAt(root common.Hash) (*state.StateDB, error) + func (bc *BlockChain) Status() (td *big.Int, currentBlock common.Hash, genesisBlock common.Hash) + func (bc *BlockChain) Stop() + func (bc *BlockChain) Validator() Validator + func (bc *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 BlockValidator struct + func NewBlockValidator(config *params.ChainConfig, blockchain *BlockChain, engine consensus.Engine) *BlockValidator + func (v *BlockValidator) ValidateBody(block *types.Block) error + func (v *BlockValidator) ValidateState(block, parent *types.Block, statedb *state.StateDB, receipts types.Receipts, ...) error + type ChainContext interface + Engine func() consensus.Engine + GetHeader func(common.Hash, uint64) *types.Header + type ChainEvent struct + Block *types.Block + Hash common.Hash + Logs []*types.Log + type ChainHeadEvent struct + Block *types.Block + type ChainSideEvent struct + Block *types.Block + type DeleteCallback func(common.Hash, uint64) + 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 Genesis struct + Alloc GenesisAlloc + Coinbase common.Address + Config *params.ChainConfig + Difficulty *big.Int + ExtraData []byte + GasLimit uint64 + GasUsed uint64 + Mixhash common.Hash + Nonce uint64 + Number uint64 + ParentHash common.Hash + Timestamp uint64 + func DefaultGenesisBlock() *Genesis + func DefaultTestnetGenesisBlock() *Genesis + func DevGenesisBlock() *Genesis + func (g *Genesis) Commit(db ethdb.Database) (*types.Block, error) + func (g *Genesis) MustCommit(db ethdb.Database) *types.Block + func (g *Genesis) ToBlock() (*types.Block, *state.StateDB) + func (g *Genesis) UnmarshalJSON(input []byte) error + func (g Genesis) MarshalJSON() ([]byte, error) + type GenesisAccount struct + Balance *big.Int + Code []byte + Nonce uint64 + PrivateKey []byte + Storage map[common.Hash]common.Hash + func (g *GenesisAccount) UnmarshalJSON(input []byte) error + func (g GenesisAccount) MarshalJSON() ([]byte, error) + type GenesisAlloc map[common.Address]GenesisAccount + func (ga *GenesisAlloc) UnmarshalJSON(data []byte) error + type GenesisMismatchError struct + New common.Hash + Stored common.Hash + func (e *GenesisMismatchError) Error() string + type HeaderChain struct + func NewHeaderChain(chainDb ethdb.Database, config *params.ChainConfig, engine consensus.Engine, ...) (*HeaderChain, error) + func (hc *HeaderChain) Config() *params.ChainConfig + func (hc *HeaderChain) CurrentHeader() *types.Header + func (hc *HeaderChain) Engine() consensus.Engine + func (hc *HeaderChain) GetBlock(hash common.Hash, number uint64) *types.Block + 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, writeHeader WhCallback, start time.Time) (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) ValidateHeaderChain(chain []*types.Header, checkFreq int) (int, error) + 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 Message interface + CheckNonce func() bool + Data func() []byte + From func() common.Address + Gas func() *big.Int + GasPrice func() *big.Int + Nonce func() uint64 + To func() *common.Address + Value func() *big.Int + type NewMinedBlockEvent struct + Block *types.Block + type PendingLogsEvent struct + Logs []*types.Log + type PendingStateEvent struct + type Processor interface + Process func(block *types.Block, statedb *state.StateDB, cfg vm.Config) (types.Receipts, []*types.Log, *big.Int, error) + type RemovedLogsEvent struct + Logs []*types.Log + type RemovedTransactionEvent struct + Txs types.Transactions + type StateProcessor struct + func NewStateProcessor(config *params.ChainConfig, bc *BlockChain, engine consensus.Engine) *StateProcessor + func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg vm.Config) (types.Receipts, []*types.Log, *big.Int, error) + type StateTransition struct + func NewStateTransition(evm *vm.EVM, msg Message, gp *GasPool) *StateTransition + func (st *StateTransition) TransitionDb() (ret []byte, requiredGas, usedGas *big.Int, err error) + type TxPool struct + func NewTxPool(config TxPoolConfig, chainconfig *params.ChainConfig, eventMux *event.TypeMux, ...) *TxPool + func (pool *TxPool) AddLocal(tx *types.Transaction) error + func (pool *TxPool) AddLocals(txs []*types.Transaction) error + func (pool *TxPool) AddRemote(tx *types.Transaction) error + func (pool *TxPool) AddRemotes(txs []*types.Transaction) error + func (pool *TxPool) Content() (map[common.Address]types.Transactions, map[common.Address]types.Transactions) + func (pool *TxPool) GasPrice() *big.Int + func (pool *TxPool) Get(hash common.Hash) *types.Transaction + func (pool *TxPool) Pending() (map[common.Address]types.Transactions, error) + func (pool *TxPool) Remove(hash common.Hash) + func (pool *TxPool) RemoveBatch(txs types.Transactions) + func (pool *TxPool) SetGasPrice(price *big.Int) + func (pool *TxPool) State() *state.ManagedState + func (pool *TxPool) Stats() (int, int) + func (pool *TxPool) Stop() + type TxPoolConfig struct + AccountQueue uint64 + AccountSlots uint64 + GlobalQueue uint64 + GlobalSlots uint64 + Lifetime time.Duration + NoLocals bool + PriceBump uint64 + PriceLimit uint64 + type TxPreEvent struct + Tx *types.Transaction + type Validator interface + ValidateBody func(block *types.Block) error + ValidateState func(block, parent *types.Block, state *state.StateDB, receipts types.Receipts, ...) error + type WhCallback func(*types.Header) error + type WriteStatus byte + const CanonStatTy + const NonStatTy + const SideStatTy