Versions in this module Expand all Collapse all v0 v0.0.1 Jan 25, 2016 Changes in this version + const BlockChainVersion + const CanonStatTy + const NonStatTy + const SideStatTy + const SplitStatTy + var BadHashes = map[common.Hash]bool + 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 DisableBadBlockReporting = true + var ErrBalance = errors.New("Insufficient balance") + var ErrCheap = errors.New("Gas price too low for acceptance") + 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 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 does not exist or account balance too low") + 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 ApplyMessage(env vm.Environment, msg Message, gp *GasPool) ([]byte, *big.Int, error) + func ApplyTransaction(bc *BlockChain, gp *GasPool, statedb *state.StateDB, header *types.Header, ...) (*types.Receipt, vm.Logs, *big.Int, error) + func CalcDifficulty(time, parentTime uint64, parentNumber, parentDiff *big.Int) *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 Canary(statedb *state.StateDB) bool + func Create(env vm.Environment, caller vm.ContractRef, code []byte, ...) (ret []byte, address common.Address, err error) + func DefaultGenesisBlock() string + func DeleteBlock(db ethdb.Database, hash common.Hash) + func DeleteBlockReceipts(db ethdb.Database, hash common.Hash) + func DeleteBody(db ethdb.Database, hash common.Hash) + func DeleteCanonicalHash(db ethdb.Database, number uint64) + func DeleteHeader(db ethdb.Database, hash common.Hash) + func DeleteReceipt(db ethdb.Database, hash common.Hash) + func DeleteTd(db ethdb.Database, hash common.Hash) + func DeleteTransaction(db ethdb.Database, hash common.Hash) + func Disassemble(script []byte) (asm []string) + func GenerateChain(parent *types.Block, db ethdb.Database, n int, gen func(int, *BlockGen)) ([]*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) *types.Block + func GetBlockByHashOld(db ethdb.Database, hash common.Hash) *types.Block + func GetBlockChainVersion(db ethdb.Database) int + func GetBlockReceipts(db ethdb.Database, hash common.Hash) types.Receipts + func GetBody(db ethdb.Database, hash common.Hash) *types.Body + func GetBodyRLP(db ethdb.Database, hash common.Hash) rlp.RawValue + func GetCanonicalHash(db ethdb.Database, number 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) *types.Header + func GetHeaderRLP(db ethdb.Database, hash common.Hash) rlp.RawValue + func GetMipmapBloom(db ethdb.Database, number, level uint64) types.Bloom + func GetReceipt(db ethdb.Database, txHash common.Hash) *types.Receipt + func GetTd(db ethdb.Database, hash common.Hash) *big.Int + func GetTransaction(db ethdb.Database, hash common.Hash) (*types.Transaction, common.Hash, uint64, uint64) + func IntrinsicGas(data []byte) *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 MessageCreatesContract(msg Message) bool + func OlympicGenesisBlock() string + func ParentError(hash common.Hash) error + func ReportBlock(block *types.Block, err error) + func TestNetGenesisBlock() string + func Transfer(from, to vm.Account, amount *big.Int) + func UncleError(format string, v ...interface{}) error + func ValidateHeader(pow pow.PoW, header *types.Header, parent *types.Header, checkPow, uncle bool) 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, receipts types.Receipts) error + func WriteBody(db ethdb.Database, hash common.Hash, body *types.Body) error + func WriteCanonicalHash(db ethdb.Database, hash common.Hash, number uint64) 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 WriteReceipts(db ethdb.Database, receipts types.Receipts) error + func WriteTd(db ethdb.Database, hash common.Hash, 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, 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) AuxValidator() pow.PoW + 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) *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) *types.Header + func (self *BlockChain) GetHeaderByNumber(number uint64) *types.Header + func (self *BlockChain) GetTd(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, 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 + Pow pow.PoW + func NewBlockValidator(blockchain *BlockChain, pow pow.PoW) *BlockValidator + func (v *BlockValidator) ValidateBlock(block *types.Block) error + func (v *BlockValidator) ValidateHeader(header, parent *types.Header, checkPow bool) 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 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 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 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 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 + Data func() []byte + From 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 Processor interface + Process func(block *types.Block, statedb *state.StateDB) (types.Receipts, vm.Logs, *big.Int, error) + type RemovedLogEvent struct + Logs vm.Logs + type RemovedTransactionEvent struct + Txs types.Transactions + type StartMining struct + type StateProcessor struct + func NewStateProcessor(bc *BlockChain) *StateProcessor + func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB) (types.Receipts, vm.Logs, *big.Int, error) + type StateTransition struct + type TDError struct + func (self *TDError) Error() string + type TopMining struct + type TxPool struct + func NewTxPool(eventMux *event.TypeMux, currentStateFn stateFn, gasLimitFn func() *big.Int) *TxPool + func (pool *TxPool) RemoveTx(hash common.Hash) + 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() + func (self *TxPool) Add(tx *types.Transaction) error + func (self *TxPool) AddTransactions(txs []*types.Transaction) + func (self *TxPool) GetQueuedTransactions() types.Transactions + func (self *TxPool) GetTransactions() (txs types.Transactions) + func (self *TxPool) RemoveTransactions(txs types.Transactions) + func (tp *TxPool) GetTransaction(hash common.Hash) *types.Transaction + 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(state *state.StateDB, chain *BlockChain, msg Message, header *types.Header) *VMEnv + func (self *VMEnv) AddLog(log *vm.Log) + func (self *VMEnv) AddStructLog(log vm.StructLog) + 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) 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) MakeSnapshot() vm.Database + func (self *VMEnv) Origin() common.Address + func (self *VMEnv) SetDepth(i int) + func (self *VMEnv) SetSnapshot(copy vm.Database) + func (self *VMEnv) SetVmType(t vm.Type) + func (self *VMEnv) StructLogs() []vm.StructLog + 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) VmType() vm.Type + 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 + ValidateHeader func(header, parent *types.Header, checkPow bool) 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