Versions in this module Expand all Collapse all v0 v0.1.0 May 8, 2018 Changes in this version + const BlockChainVersion + const SputnikVMExists + 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 BlockTSTooBigErr = errors.New("block time too big") + var DefaultDiehardGasTable = &vm.GasTable + var DifficultyBoundDivisor = big.NewInt(200) + var DisinflationRateDivisor = big.NewInt(250) + var DisinflationRateQuotient = big.NewInt(249) + var DurationLimit = big.NewInt(13) + var ErrBalance = errors.New("Insufficient balance") + var ErrChainConfigForkNotFound = errors.New("chain config fork not found") + var ErrChainConfigNotFound = errors.New("chain config not found") + var ErrCheap = errors.New("Gas price too low for acceptance") + var ErrGasLimit = errors.New("Exceeds block gas limit") + var ErrHashKnownBad = errors.New("known bad hash") + var ErrHashKnownFork = validateError("known fork hash mismatch") + 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 GasLimitBoundDivisor = big.NewInt(1024) + var MIPMapLevels = []uint64 + var MinGasLimit = big.NewInt(5000) + var MinimumDifficulty = big.NewInt(10000) + var TargetGasLimit = big.NewInt(4712388) + var TxDataNonZeroGas = big.NewInt(68) + var TxDataZeroGas = big.NewInt(4) + var TxGas = big.NewInt(21000) + var TxGasContractCreation = big.NewInt(53000) + var UseSputnikVM = false + func AccumulateRewards(config *ChainConfig, statedb *state.StateDB, header *types.Header, ...) + func ApplyMessage(env vm.Environment, msg Message, gp *GasPool) ([]byte, *big.Int, error) + func ApplyMultiVmTransaction(config *ChainConfig, bc *BlockChain, gp *GasPool, statedb *state.StateDB, ...) (*types.Receipt, evm.Logs, *big.Int, error) + func ApplyTransaction(config *ChainConfig, bc *BlockChain, gp *GasPool, statedb *state.StateDB, ...) (*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 DelegateCall(env vm.Environment, caller vm.ContractRef, addr common.Address, input []byte, ...) (ret []byte, err error) + 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(config *ChainConfig, parent *types.Block, db ethdb.Database, n int, ...) ([]*types.Block, []types.Receipts) + 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 GetBlockEra(blockNum, eraLength *big.Int) *big.Int + func GetBlockReceipts(db ethdb.Database, hash common.Hash) types.Receipts + func GetBlockUncleRewardByEra(era *big.Int, header, uncle *types.Header) *big.Int + func GetBlockWinnerRewardByEra(era *big.Int) *big.Int + func GetBlockWinnerRewardForUnclesByEra(era *big.Int, uncles []*types.Header) *big.Int + 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 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) *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, contractCreation, homestead bool) *big.Int + 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 IsValidateError(err error) bool + func IsValueTransferErr(e error) bool + func MessageCreatesContract(msg Message) bool + func ParentError(hash common.Hash) error + func ParseBootstrapNodeStrings(nodeStrings []string) []*discover.Node + func PreimageTable(db ethdb.Database) ethdb.Database + func Transfer(from, to vm.Account, amount *big.Int) + func UncleError(format string, v ...interface{}) error + func ValidateHeader(config *ChainConfig, pow pow.PoW, header *types.Header, parent *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, 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 WriteGenesisBlock(chainDb ethdb.Database, genesis *GenesisDump) (*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 WritePreimages(db ethdb.Database, number uint64, preimages map[common.Hash][]byte) error + func WriteReceipts(db ethdb.Database, receipts types.Receipts) error + func WriteTd(db ethdb.Database, hash common.Hash, td *big.Int) error + func WriteTransactions(db ethdb.Database, block *types.Block) error + func WriteTxLookupEntries(db ethdb.Putter, 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 BadHash struct + Block *big.Int + Hash common.Hash + type BlockChain struct + func NewBlockChain(chainDb ethdb.Database, config *ChainConfig, pow pow.PoW, mux *event.TypeMux) (*BlockChain, error) + func NewBlockChainDryrun(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) PurgeAbove(n uint64) + func (bc *BlockChain) Reset() error + func (bc *BlockChain) ResetWithGenesisBlock(genesis *types.Block) error + func (bc *BlockChain) SetHead(head uint64) error + func (bc *BlockChain) Stop() + func (self *BlockChain) AuxValidator() pow.PoW + 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) *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) GetEventMux() *event.TypeMux + 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) (chainIndex int, err 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) LoadLastState(dryrun bool) error + func (self *BlockChain) Processor() Processor + func (self *BlockChain) Recovery(from int, increment int) (checkpoint uint64) + 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) StateAt(root common.Hash) (*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(config *ChainConfig, 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 ChainConfig struct + BadHashes []*BadHash + Forks Forks + func MakeChainConfig() *ChainConfig + func (c *ChainConfig) ForkByName(name string) *Fork + func (c *ChainConfig) GasTable(num *big.Int) *vm.GasTable + func (c *ChainConfig) GetChainID() *big.Int + func (c *ChainConfig) GetFeature(num *big.Int, id string) (*ForkFeature, *Fork, bool) + func (c *ChainConfig) GetSigner(blockNumber *big.Int) types.Signer + func (c *ChainConfig) HasFeature(id string) (*ForkFeature, *Fork, bool) + func (c *ChainConfig) HeaderCheck(h *types.Header) error + func (c *ChainConfig) IsDiehard(num *big.Int) bool + func (c *ChainConfig) IsExplosion(num *big.Int) bool + func (c *ChainConfig) IsHomestead(num *big.Int) bool + func (c *ChainConfig) SortForks() *ChainConfig + type ChainEvent struct + Block *types.Block + Hash common.Hash + Logs vm.Logs + type ChainFeatureConfigOptions map[string]interface + type ChainHeadEvent struct + Block *types.Block + type ChainInsertEvent struct + Elasped time.Duration + Ignored int + LastHash common.Hash + LastNumber uint64 + LatestBlockTime time.Time + Processed int + Queued int + TxCount int + 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) + type DifficultyConfig struct + Name string + Options map[string]interface{} + type FakePow struct + func (f FakePow) GetHashrate() int64 + func (f FakePow) Search(block pow.Block, stop <-chan struct{}, index int) uint64 + func (f FakePow) Turbo(bool) + func (f FakePow) Verify(block pow.Block) bool + type Fork struct + Block *big.Int + Features []*ForkFeature + Name string + RequiredHash common.Hash + type ForkFeature struct + ID string + Options ChainFeatureConfigOptions + ParsedOptions map[string]interface{} + func (o *ForkFeature) GetBigInt(name string) (*big.Int, bool) + func (o *ForkFeature) GetString(name string) (string, bool) + type Forks []*Fork + func (fs Forks) Len() int + func (fs Forks) Less(i, j int) bool + func (fs Forks) Swap(i, j int) + 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 GenesisDump struct + Alloc map[hex]*GenesisDumpAlloc + AllocFile string + Coinbase prefixedHex + Difficulty prefixedHex + ExtraData prefixedHex + GasLimit prefixedHex + Nonce prefixedHex + ParentHash prefixedHex + Timestamp prefixedHex + func MakeGenesisDump(chaindb ethdb.Database) (*GenesisDump, error) + func (g *GenesisDump) Header() (*types.Header, error) + type GenesisDumpAlloc struct + Balance string + Code prefixedHex + Storage map[hex]hex + type HeaderChain struct + func NewHeaderChain(chainDb ethdb.Database, config *ChainConfig, mux *event.TypeMux, ...) (*HeaderChain, error) + func (hc *HeaderChain) CurrentHeader() *types.Header + func (hc *HeaderChain) GetBlockHashesFromHash(hash common.Hash, max uint64) []common.Hash + func (hc *HeaderChain) GetHeader(hash common.Hash) *types.Header + func (hc *HeaderChain) GetHeaderByNumber(number uint64) *types.Header + func (hc *HeaderChain) GetTd(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) PurgeAbove(n uint64, delFn DeleteCallback) + 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, td *big.Int) error + type HeaderChainInsertEvent struct + Elasped time.Duration + Ignored int + LastHash common.Hash + LastNumber uint64 + Processed int + type HeaderValidator interface + ValidateHeader func(header, parent *types.Header, checkPow bool) 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 + 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 PendingLogsEvent struct + Logs vm.Logs + type PendingStateEvent struct + type Processor interface + Process func(block *types.Block, statedb *state.StateDB) (types.Receipts, vm.Logs, *big.Int, error) + type RemovedLogsEvent struct + Logs vm.Logs + type RemovedTransactionEvent struct + Txs types.Transactions + type StartMining struct + type StateConfig struct + StartingNonce uint64 + type StateProcessor struct + func NewStateProcessor(config *ChainConfig, bc *BlockChain) *StateProcessor + func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB) (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 StopMining struct + type SufficientChainConfig struct + Bootstrap []string + ChainConfig *ChainConfig + Consensus string + Genesis *GenesisDump + ID string + Identity string + Include []string + Name string + Network int + ParsedBootstrap []*discover.Node + State *StateConfig + var DefaultConfigMainnet *SufficientChainConfig + var DefaultConfigMorden *SufficientChainConfig + func ReadExternalChainConfigFromFile(incomingPath string) (*SufficientChainConfig, error) + func (c *SufficientChainConfig) IsValid() (string, bool) + func (c *SufficientChainConfig) WriteToJSONFile(path string) error + type TDError struct + func (self *TDError) Error() string + type TxLookupEntry struct + BlockHash common.Hash + BlockIndex uint64 + Index uint64 + type TxPool struct + func NewTxPool(config *ChainConfig, eventMux *event.TypeMux, currentStateFn stateFn, ...) *TxPool + func (pool *TxPool) Content() (map[common.Address]map[uint64][]*types.Transaction, ...) + 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, chainConfig *ChainConfig, chain *BlockChain, msg Message, ...) *VMEnv + 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 Validator interface + ValidateBlock func(block *types.Block) error + ValidateState func(block, parent *types.Block, state *state.StateDB, receipts types.Receipts, ...) error + VerifyUncles func(block, parent *types.Block) 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