Documentation
¶
Index ¶
- Variables
- type ChainHighestBlock
- type ChainStateReader
- type ConnHandler
- type DownloaderFinishEvent
- type DownloaderStartEvent
- type GasPool
- type IBlockChain
- type IDownloader
- type IHeaderChain
- type IMiner
- type INetwork
- type IPeer
- type IPubSub
- type IStateDB
- type ITxsPool
- type MinedEntireEvent
- type NewLocalTxsEvent
- type NewLogsEvent
- type NewPendingLogsEvent
- type NewTxsEvent
- type Peer
- type PeerDropEvent
- type PeerJoinEvent
- type PeerMap
- type PeerSet
- type PrettyAge
- type PrettyDuration
- type ProtocolHandshakeFn
- type ProtocolHandshakeInfo
- type RemovedLogsEvent
- type Service
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type ChainHighestBlock ¶
type ChainStateReader ¶
type ChainStateReader interface {
BalanceAt(ctx context.Context, account types.Address, blockNumber uint256.Int) (uint256.Int, error)
StorageAt(ctx context.Context, account types.Address, key types.Hash, blockNumber uint256.Int) ([]byte, error)
CodeAt(ctx context.Context, account types.Address, blockNumber uint256.Int) ([]byte, error)
NonceAt(ctx context.Context, account types.Address, blockNumber uint256.Int) (uint64, error)
}
type DownloaderFinishEvent ¶
type DownloaderFinishEvent struct{}
DownloaderFinishEvent finish download
type GasPool ¶
type GasPool uint64
GasPool tracks the amount of gas available during execution of the transactions in a block. The zero value is a pool with zero gas available.
type IBlockChain ¶
type IBlockChain interface {
IHeaderChain
Config() *params.ChainConfig
CurrentBlock() block.IBlock
Blocks() []block.IBlock
Start() error
GenesisBlock() block.IBlock
NewBlockHandler(payload []byte, peer peer.ID) error
InsertChain(blocks []block.IBlock) (int, error)
InsertBlock(blocks []block.IBlock, isSync bool) (int, error)
SetEngine(engine consensus.Engine)
GetBlocksFromHash(hash types.Hash, n int) (blocks []block.IBlock)
SealedBlock(b block.IBlock) error
Engine() consensus.Engine
GetReceipts(blockHash types.Hash) (block.Receipts, error)
GetLogs(blockHash types.Hash) ([][]*block.Log, error)
SetHead(head uint64) error
AddFutureBlock(block block.IBlock) error
GetHeader(types.Hash, *uint256.Int) block.IHeader
// alias for GetBlocksFromHash?
GetBlock(hash types.Hash, number uint64) block.IBlock
StateAt(tx kv.Tx, blockNr uint64) *state.IntraBlockState
GetTd(hash types.Hash, number *uint256.Int) *uint256.Int
HasBlock(hash types.Hash, number uint64) bool
DB() kv.RwDB
Quit() <-chan struct{}
Close() error
WriteBlockWithState(block block.IBlock, receipts []*block.Receipt, ibs *state.IntraBlockState, nopay map[types.Address]*uint256.Int) error
GetDepositInfo(address types.Address) (*uint256.Int, *uint256.Int)
GetAccountRewardUnpaid(account types.Address) (*uint256.Int, error)
}
type IDownloader ¶
type IHeaderChain ¶
type INetwork ¶
type INetwork interface {
WriterMessage(messageType message.MessageType, payload []byte, peer peer.ID) error
//BroadcastMessage(messageType message.MessageType, payload []byte) (int, error)
SetHandler(message.MessageType, ConnHandler) error
ClosePeer(id peer.ID) error
Start() error
Host() host.Host
PeerCount() int
Bootstrapped() bool
}
type IPeer ¶
type IPeer interface {
ID() peer.ID
Write(msg message.IMessage) error
WriteMsg(messageType message.MessageType, payload []byte) error
SetHandler(message.MessageType, ConnHandler) error
ClearHandler(message.MessageType) error
Close() error
}
type IStateDB ¶
type IStateDB interface {
CreateAccount(types.Address)
SubBalance(addr types.Address, amount uint256.Int)
AddBalance(addr types.Address, amount uint256.Int)
GetBalance(addr types.Address) uint256.Int
GetNonce(addr types.Address) uint64
SetNonce(addr types.Address, nonce uint64)
GetCodeHash(addr types.Address) types.Hash
GetCode(addr types.Address) []byte
SetCode(addr types.Address, code []byte)
GetCodeSize(addr types.Address) int
AddRefund(uint64)
SubRefund(uint64)
GetRefund() uint64
GetCommittedState(types.Address, types.Hash) types.Hash
GetState(types.Address, types.Hash) types.Hash
SetState(types.Address, types.Hash, types.Hash)
Suicide(types.Address) bool
HasSuicided(types.Address) bool
Exist(types.Address) bool
Empty(types.Address) bool
PrepareAccessList(sender types.Address, dest *types.Address, precompiles []types.Address, list transaction.AccessList)
AddressInAccessList(addr types.Address) bool
SlotInAccessList(addr types.Address, slot types.Hash) (addressOk bool, slotOk bool)
AddAddressToAccessList(addr types.Address)
AddSlotToAccessList(addr types.Address, slot types.Hash)
RevertToSnapshot(int)
Snapshot() int
AddLog(*block.Log)
GetLogs(hash types.Hash, blockHash types.Hash) []*block.Log
TxIndex() int
Prepare(thash types.Hash, ti int)
Error() error
}
type ITxsPool ¶ added in v0.1.2
type ITxsPool interface {
Service
Has(hash types.Hash) bool
Pending(enforceTips bool) map[types.Address][]*transaction.Transaction
GetTransaction() ([]*transaction.Transaction, error)
GetTx(hash types.Hash) *transaction.Transaction
AddRemotes(txs []*transaction.Transaction) []error
AddLocal(tx *transaction.Transaction) error
Stats() (int, int, int, int)
Nonce(addr types.Address) uint64
Content() (map[types.Address][]*transaction.Transaction, map[types.Address][]*transaction.Transaction)
}
type MinedEntireEvent ¶
type MinedEntireEvent struct {
Entire state.EntireCode
}
type NewLocalTxsEvent ¶
type NewLocalTxsEvent struct{ Txs []*transaction.Transaction }
NewLocalTxsEvent local txs
type NewPendingLogsEvent ¶
NewPendingLogsEvent is posted when a reorg happens // todo miner v2
type PrettyAge ¶
PrettyAge is a pretty printed version of a time.Duration value that rounds the values up to a single most significant unit, days/weeks/years included.
type PrettyDuration ¶
PrettyDuration is a pretty printed version of a time.Duration value that cuts the unnecessary precision off from the formatted textual representation.
func (PrettyDuration) String ¶
func (d PrettyDuration) String() string
String implements the Stringer interface, allowing pretty printing of duration values rounded to three decimals.
type ProtocolHandshakeFn ¶
type RemovedLogsEvent ¶
RemovedLogsEvent is posted when a reorg happens // todo blockchain v2
type Service ¶ added in v0.1.2
type Service interface {
// Start spawns any goroutines required by the service.
//Start()
// Stop terminates all goroutines belonging to the service,
// blocking until they are all terminated.
Stop() error
}
Service is a struct that can be registered into a ServiceRegistry for easy dependency management.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
blake2b
Package blake2b implements the BLAKE2b hash algorithm defined by RFC 7693 and the extendable output function (XOF) BLAKE2Xb.
|
Package blake2b implements the BLAKE2b hash algorithm defined by RFC 7693 and the extendable output function (XOF) BLAKE2Xb. |
|
bls
Package bls implements a go-wrapper around a library implementing the the BLS12-381 curve and signature scheme.
|
Package bls implements a go-wrapper around a library implementing the the BLS12-381 curve and signature scheme. |
|
bls/blst
Package blst implements a go-wrapper around a library implementing the the BLS12-381 curve and signature scheme.
|
Package blst implements a go-wrapper around a library implementing the the BLS12-381 curve and signature scheme. |
|
bls/common
Package common provides the BLS interfaces that are implemented by the various BLS wrappers.
|
Package common provides the BLS interfaces that are implemented by the various BLS wrappers. |
|
bn256
Package bn256 implements the Optimal Ate pairing over a 256-bit Barreto-Naehrig curve.
|
Package bn256 implements the Optimal Ate pairing over a 256-bit Barreto-Naehrig curve. |
|
bn256/cloudflare
Package bn256 implements a particular bilinear group at the 128-bit security level.
|
Package bn256 implements a particular bilinear group at the 128-bit security level. |
|
bn256/google
Package bn256 implements a particular bilinear group.
|
Package bn256 implements a particular bilinear group. |
|
rand
Package rand defines methods of obtaining random number generators.
|
Package rand defines methods of obtaining random number generators. |
|
Package hexutil implements hex encoding with 0x prefix.
|
Package hexutil implements hex encoding with 0x prefix. |
|
Package math provides integer math utilities.
|
Package math provides integer math utilities. |
|
Package mclock is a wrapper for a monotonic clock source
|
Package mclock is a wrapper for a monotonic clock source |
|
Package prque implements a priority queue data structure supporting arbitrary value types and int64 priorities.
|
Package prque implements a priority queue data structure supporting arbitrary value types and int64 priorities. |