Documentation ¶
Overview ¶
Package cn implements components related to Klaytn Node.
Index ¶
- Constants
- Variables
- func CreateCliqueEngine(ctx *node.ServiceContext, config *Config, chainConfig *params.ChainConfig, ...) consensus.Engine
- func CreateConsensusEngine(ctx *node.ServiceContext, config *Config, chainConfig *params.ChainConfig, ...) consensus.Engine
- func CreateDB(ctx *node.ServiceContext, config *Config, name string) database.DBManager
- func NewBloomIndexer(db database.DBManager, size uint64) *blockchain.ChainIndexer
- type BloomIndexer
- type ByPassValidator
- type CN
- func (s *CN) APIs() []rpc.API
- func (s *CN) AccountManager() *accounts.Manager
- func (s *CN) AddLesServer(ls LesServer)
- func (s *CN) BlockChain() *blockchain.BlockChain
- func (s *CN) ChainDB() database.DBManager
- func (s *CN) Components() []interface{}
- func (s *CN) Engine() consensus.Engine
- func (s *CN) EventMux() *event.TypeMux
- func (s *CN) IsListening() bool
- func (s *CN) IsMining() bool
- func (s *CN) Miner() *work.Miner
- func (s *CN) NetVersion() uint64
- func (s *CN) Progress() klaytn.SyncProgress
- func (s *CN) ProtocolVersion() int
- func (s *CN) Protocols() []p2p.Protocol
- func (s *CN) ReBroadcastTxs(transactions types.Transactions)
- func (s *CN) ResetWithGenesisBlock(gb *types.Block)
- func (s *CN) Rewardbase() (eb common.Address, err error)
- func (s *CN) RewardbaseWallet() (accounts.Wallet, error)
- func (s *CN) SetComponents(component []interface{})
- func (s *CN) SetRewardbase(rewardbase common.Address)
- func (s *CN) Start(srvr p2p.Server) error
- func (s *CN) StartMining(local bool) error
- func (s *CN) Stop() error
- func (s *CN) StopMining()
- func (s *CN) TxPool() *blockchain.TxPool
- type CNAPIBackend
- func (b *CNAPIBackend) AccountManager() *accounts.Manager
- func (b *CNAPIBackend) BlockByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Block, error)
- func (b *CNAPIBackend) BloomStatus() (uint64, uint64)
- func (b *CNAPIBackend) ChainConfig() *params.ChainConfig
- func (b *CNAPIBackend) ChainDB() database.DBManager
- func (b *CNAPIBackend) CurrentBlock() *types.Block
- func (b *CNAPIBackend) EventMux() *event.TypeMux
- func (b *CNAPIBackend) GetBlock(ctx context.Context, hash common.Hash) (*types.Block, error)
- func (b *CNAPIBackend) GetBlockReceipts(ctx context.Context, hash common.Hash) types.Receipts
- func (b *CNAPIBackend) GetBlockReceiptsInCache(blockHash common.Hash) types.Receipts
- func (b *CNAPIBackend) GetEVM(ctx context.Context, msg blockchain.Message, state *state.StateDB, ...) (*vm.EVM, func() error, error)
- func (b *CNAPIBackend) GetLogs(ctx context.Context, hash common.Hash) ([][]*types.Log, error)
- func (b *CNAPIBackend) GetNonceInCache(addr common.Address) (uint64, bool)
- func (b *CNAPIBackend) GetPoolNonce(ctx context.Context, addr common.Address) uint64
- func (b *CNAPIBackend) GetPoolTransaction(hash common.Hash) *types.Transaction
- func (b *CNAPIBackend) GetPoolTransactions() (types.Transactions, error)
- func (b *CNAPIBackend) GetTd(blockHash common.Hash) *big.Int
- func (b *CNAPIBackend) GetTxAndLookupInfo(hash common.Hash) (*types.Transaction, common.Hash, uint64, uint64)
- func (b *CNAPIBackend) GetTxAndLookupInfoInCache(txHash common.Hash) (*types.Transaction, common.Hash, uint64, uint64)
- func (b *CNAPIBackend) GetTxLookupInfoAndReceipt(ctx context.Context, txHash common.Hash) (*types.Transaction, common.Hash, uint64, uint64, *types.Receipt)
- func (b *CNAPIBackend) GetTxLookupInfoAndReceiptInCache(txHash common.Hash) (*types.Transaction, common.Hash, uint64, uint64, *types.Receipt)
- func (b *CNAPIBackend) HeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Header, error)
- func (b *CNAPIBackend) IsParallelDBWrite() bool
- func (b *CNAPIBackend) IsSenderTxHashIndexingEnabled() bool
- func (b *CNAPIBackend) Progress() klaytn.SyncProgress
- func (b *CNAPIBackend) ProtocolVersion() int
- func (b *CNAPIBackend) SendTx(ctx context.Context, signedTx *types.Transaction) error
- func (b *CNAPIBackend) ServiceFilter(ctx context.Context, session *bloombits.MatcherSession)
- func (b *CNAPIBackend) SetHead(number uint64)
- func (b *CNAPIBackend) StateAndHeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*state.StateDB, *types.Header, error)
- func (b *CNAPIBackend) Stats() (pending int, queued int)
- func (b *CNAPIBackend) SubscribeChainEvent(ch chan<- blockchain.ChainEvent) event.Subscription
- func (b *CNAPIBackend) SubscribeChainHeadEvent(ch chan<- blockchain.ChainHeadEvent) event.Subscription
- func (b *CNAPIBackend) SubscribeChainSideEvent(ch chan<- blockchain.ChainSideEvent) event.Subscription
- func (b *CNAPIBackend) SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscription
- func (b *CNAPIBackend) SubscribeNewTxsEvent(ch chan<- blockchain.NewTxsEvent) event.Subscription
- func (b *CNAPIBackend) SubscribeRemovedLogsEvent(ch chan<- blockchain.RemovedLogsEvent) event.Subscription
- func (b *CNAPIBackend) SuggestPrice(ctx context.Context) (*big.Int, error)
- func (b *CNAPIBackend) TxPoolContent() (map[common.Address]types.Transactions, map[common.Address]types.Transactions)
- type ChannelManager
- type Config
- type EmptyTxPool
- type LesServer
- type NodeInfo
- type Peer
- type PeerInfo
- type PrivateAdminAPI
- type PrivateDebugAPI
- func (api *PrivateDebugAPI) GetBadBlocks(ctx context.Context) ([]blockchain.BadBlockArgs, error)
- func (api *PrivateDebugAPI) GetModifiedAccountsByHash(startHash common.Hash, endHash *common.Hash) ([]common.Address, error)
- func (api *PrivateDebugAPI) GetModifiedAccountsByNumber(startNum uint64, endNum *uint64) ([]common.Address, error)
- func (api *PrivateDebugAPI) Preimage(ctx context.Context, hash common.Hash) (hexutil.Bytes, error)
- func (api *PrivateDebugAPI) StandardTraceBadBlockToFile(ctx context.Context, hash common.Hash, config *StdTraceConfig) ([]string, error)
- func (api *PrivateDebugAPI) StandardTraceBlockToFile(ctx context.Context, hash common.Hash, config *StdTraceConfig) ([]string, error)
- func (api *PrivateDebugAPI) TraceBadBlock(ctx context.Context, hash common.Hash, config *TraceConfig) ([]*txTraceResult, error)
- func (api *PrivateDebugAPI) TraceBlock(ctx context.Context, blob hexutil.Bytes, config *TraceConfig) ([]*txTraceResult, error)
- func (api *PrivateDebugAPI) TraceBlockByHash(ctx context.Context, hash common.Hash, config *TraceConfig) ([]*txTraceResult, error)
- func (api *PrivateDebugAPI) TraceBlockByNumber(ctx context.Context, number rpc.BlockNumber, config *TraceConfig) ([]*txTraceResult, error)
- func (api *PrivateDebugAPI) TraceBlockFromFile(ctx context.Context, file string, config *TraceConfig) ([]*txTraceResult, error)
- func (api *PrivateDebugAPI) TraceChain(ctx context.Context, start, end rpc.BlockNumber, config *TraceConfig) (*rpc.Subscription, error)
- func (api *PrivateDebugAPI) TraceTransaction(ctx context.Context, hash common.Hash, config *TraceConfig) (interface{}, error)
- type PrivateMinerAPI
- func (api *PrivateMinerAPI) GetHashrate() uint64
- func (api *PrivateMinerAPI) SetExtra(extra string) (bool, error)
- func (api *PrivateMinerAPI) SetGasPrice(gasPrice hexutil.Big) bool
- func (api *PrivateMinerAPI) SetRewardbase(rewardbase common.Address) bool
- func (api *PrivateMinerAPI) Start(threads *int) error
- func (api *PrivateMinerAPI) Stop() bool
- type PrivateServiceChainAdminAPI
- type PrivateServiceChainDebugAPI
- func (api *PrivateServiceChainDebugAPI) GetBadBlocks(ctx context.Context) ([]blockchain.BadBlockArgs, error)
- func (api *PrivateServiceChainDebugAPI) GetModifiedAccountsByHash(startHash common.Hash, endHash *common.Hash) ([]common.Address, error)
- func (api *PrivateServiceChainDebugAPI) GetModifiedAccountsByNumber(startNum uint64, endNum *uint64) ([]common.Address, error)
- func (api *PrivateServiceChainDebugAPI) Preimage(ctx context.Context, hash common.Hash) (hexutil.Bytes, error)
- type PrivateServiceChainMinerAPI
- func (api *PrivateServiceChainMinerAPI) GetHashrate() uint64
- func (api *PrivateServiceChainMinerAPI) SetExtra(extra string) (bool, error)
- func (api *PrivateServiceChainMinerAPI) SetGasPrice(gasPrice hexutil.Big) bool
- func (api *PrivateServiceChainMinerAPI) Start(threads *int) error
- func (api *PrivateServiceChainMinerAPI) Stop() bool
- type ProtocolManager
- func (pm *ProtocolManager) BroadcastBlock(block *types.Block)
- func (pm *ProtocolManager) BroadcastBlockHash(block *types.Block)
- func (pm *ProtocolManager) BroadcastTxs(txs types.Transactions)
- func (pm *ProtocolManager) Enqueue(id string, block *types.Block)
- func (pm *ProtocolManager) FindCNPeers(targets map[common.Address]bool) map[common.Address]consensus.Peer
- func (pm *ProtocolManager) FindPeers(targets map[common.Address]bool) map[common.Address]consensus.Peer
- func (pm *ProtocolManager) GetCNPeers() map[common.Address]consensus.Peer
- func (pm *ProtocolManager) GetENPeers() map[common.Address]consensus.Peer
- func (pm *ProtocolManager) GetPeers() []common.Address
- func (pm *ProtocolManager) NodeInfo() *NodeInfo
- func (pm *ProtocolManager) ReBroadcastTxs(txs types.Transactions)
- func (pm *ProtocolManager) RegisterValidator(conType p2p.ConnType, validator p2p.PeerTypeValidator)
- func (pm *ProtocolManager) SetRewardbase(addr common.Address)
- func (pm *ProtocolManager) SetRewardbaseWallet(wallet accounts.Wallet)
- func (pm *ProtocolManager) Start(maxPeers int)
- func (pm *ProtocolManager) Stop()
- type PublicDebugAPI
- type PublicKlayAPI
- type PublicKlayServiceChainAPI
- type PublicMinerAPI
- type PublicServiceChainDebugAPI
- type PublicServiceChainMinerAPI
- type ServiceChain
- func (s *ServiceChain) APIs() []rpc.API
- func (s *ServiceChain) AccountManager() *accounts.Manager
- func (s *ServiceChain) BlockChain() *blockchain.BlockChain
- func (s *ServiceChain) ChainDB() database.DBManager
- func (s *ServiceChain) Components() []interface{}
- func (s *ServiceChain) Engine() consensus.Engine
- func (s *ServiceChain) EventMux() *event.TypeMux
- func (s *ServiceChain) IsListening() bool
- func (s *ServiceChain) IsMining() bool
- func (s *ServiceChain) Miner() *work.Miner
- func (s *ServiceChain) NetVersion() uint64
- func (s *ServiceChain) Progress() klaytn.SyncProgress
- func (s *ServiceChain) ProtocolVersion() int
- func (s *ServiceChain) Protocols() []p2p.Protocol
- func (s *ServiceChain) ReBroadcastTxs(transactions types.Transactions)
- func (s *ServiceChain) ResetWithGenesisBlock(gb *types.Block)
- func (s *ServiceChain) SetComponents(component []interface{})
- func (s *ServiceChain) Signer() (eb common.Address, err error)
- func (s *ServiceChain) Start(srvr p2p.Server) error
- func (s *ServiceChain) StartMining(local bool) error
- func (s *ServiceChain) Stop() error
- func (s *ServiceChain) StopMining()
- func (s *ServiceChain) TxPool() *blockchain.TxPool
- type ServiceChainAPIBackend
- func (b *ServiceChainAPIBackend) AccountManager() *accounts.Manager
- func (b *ServiceChainAPIBackend) BlockByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Block, error)
- func (b *ServiceChainAPIBackend) BloomStatus() (uint64, uint64)
- func (b *ServiceChainAPIBackend) ChainConfig() *params.ChainConfig
- func (b *ServiceChainAPIBackend) ChainDB() database.DBManager
- func (b *ServiceChainAPIBackend) CurrentBlock() *types.Block
- func (b *ServiceChainAPIBackend) EventMux() *event.TypeMux
- func (b *ServiceChainAPIBackend) GetBlock(ctx context.Context, hash common.Hash) (*types.Block, error)
- func (b *ServiceChainAPIBackend) GetBlockReceipts(ctx context.Context, hash common.Hash) types.Receipts
- func (b *ServiceChainAPIBackend) GetBlockReceiptsInCache(blockHash common.Hash) types.Receipts
- func (b *ServiceChainAPIBackend) GetEVM(ctx context.Context, msg blockchain.Message, state *state.StateDB, ...) (*vm.EVM, func() error, error)
- func (b *ServiceChainAPIBackend) GetLogs(ctx context.Context, hash common.Hash) ([][]*types.Log, error)
- func (b *ServiceChainAPIBackend) GetNonceInCache(addr common.Address) (uint64, bool)
- func (b *ServiceChainAPIBackend) GetPoolNonce(ctx context.Context, addr common.Address) uint64
- func (b *ServiceChainAPIBackend) GetPoolTransaction(hash common.Hash) *types.Transaction
- func (b *ServiceChainAPIBackend) GetPoolTransactions() (types.Transactions, error)
- func (b *ServiceChainAPIBackend) GetTd(blockHash common.Hash) *big.Int
- func (b *ServiceChainAPIBackend) GetTxAndLookupInfo(hash common.Hash) (*types.Transaction, common.Hash, uint64, uint64)
- func (b *ServiceChainAPIBackend) GetTxAndLookupInfoInCache(txHash common.Hash) (*types.Transaction, common.Hash, uint64, uint64)
- func (b *ServiceChainAPIBackend) GetTxLookupInfoAndReceipt(ctx context.Context, txHash common.Hash) (*types.Transaction, common.Hash, uint64, uint64, *types.Receipt)
- func (b *ServiceChainAPIBackend) GetTxLookupInfoAndReceiptInCache(txHash common.Hash) (*types.Transaction, common.Hash, uint64, uint64, *types.Receipt)
- func (b *ServiceChainAPIBackend) HeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Header, error)
- func (b *ServiceChainAPIBackend) IsParallelDBWrite() bool
- func (b *ServiceChainAPIBackend) IsSenderTxHashIndexingEnabled() bool
- func (b *ServiceChainAPIBackend) Progress() klaytn.SyncProgress
- func (b *ServiceChainAPIBackend) ProtocolVersion() int
- func (b *ServiceChainAPIBackend) SendTx(ctx context.Context, signedTx *types.Transaction) error
- func (b *ServiceChainAPIBackend) ServiceFilter(ctx context.Context, session *bloombits.MatcherSession)
- func (b *ServiceChainAPIBackend) SetHead(number uint64)
- func (b *ServiceChainAPIBackend) StateAndHeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*state.StateDB, *types.Header, error)
- func (b *ServiceChainAPIBackend) Stats() (pending int, queued int)
- func (b *ServiceChainAPIBackend) SubscribeChainEvent(ch chan<- blockchain.ChainEvent) event.Subscription
- func (b *ServiceChainAPIBackend) SubscribeChainHeadEvent(ch chan<- blockchain.ChainHeadEvent) event.Subscription
- func (b *ServiceChainAPIBackend) SubscribeChainSideEvent(ch chan<- blockchain.ChainSideEvent) event.Subscription
- func (b *ServiceChainAPIBackend) SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscription
- func (b *ServiceChainAPIBackend) SubscribeNewTxsEvent(ch chan<- blockchain.NewTxsEvent) event.Subscription
- func (b *ServiceChainAPIBackend) SubscribeRemovedLogsEvent(ch chan<- blockchain.RemovedLogsEvent) event.Subscription
- func (b *ServiceChainAPIBackend) SuggestPrice(ctx context.Context) (*big.Int, error)
- func (b *ServiceChainAPIBackend) TxPoolContent() (map[common.Address]types.Transactions, map[common.Address]types.Transactions)
- type StakingHandler
- type StdTraceConfig
- type StorageRangeResult
- type TraceConfig
Constants ¶
const ( BlockChannel uint = iota TxChannel ConsensusChannel MiscChannel MaxChannel )
const ( // DefaultMaxResendTxCount is the number of resending transactions to peer in order to prevent the txs from missing. DefaultMaxResendTxCount = 1000 // DefaultTxResendInterval is the second of resending transactions period. DefaultTxResendInterval = 4 )
const ( // Protocol messages belonging to klay/62 StatusMsg = 0x00 NewBlockHashesMsg = 0x01 BlockHeaderFetchRequestMsg = 0x02 BlockHeaderFetchResponseMsg = 0x03 BlockBodiesFetchRequestMsg = 0x04 BlockBodiesFetchResponseMsg = 0x05 TxMsg = 0x06 BlockHeadersRequestMsg = 0x07 BlockHeadersMsg = 0x08 BlockBodiesRequestMsg = 0x09 BlockBodiesMsg = 0x0a NewBlockMsg = 0x0b // Protocol messages belonging to klay/63 NodeDataRequestMsg = 0x0c NodeDataMsg = 0x0d ReceiptsRequestMsg = 0x0e ReceiptsMsg = 0x0f )
Klaytn protocol message codes TODO-Klaytn-Issue751 Protocol message should be refactored. Present code is not used.
const ( ErrMsgTooLarge = iota ErrDecode ErrInvalidMsgCode ErrProtocolVersionMismatch ErrNetworkIdMismatch ErrGenesisBlockMismatch ErrChainIDMismatch ErrNoStatusMsg ErrExtraStatusMsg ErrSuspendedPeer ErrUnexpectedTxType ErrFailedToGetStateDB )
const ProtocolMaxMsgSize = 10 * 1024 * 1024 // Maximum cap on the size of a protocol message
Variables ¶
var ChannelOfMessage = map[uint64]int{ StatusMsg: p2p.ConnDefault, NewBlockHashesMsg: p2p.ConnDefault, BlockHeaderFetchRequestMsg: p2p.ConnDefault, BlockHeaderFetchResponseMsg: p2p.ConnDefault, BlockBodiesFetchRequestMsg: p2p.ConnDefault, BlockBodiesFetchResponseMsg: p2p.ConnDefault, TxMsg: p2p.ConnTxMsg, BlockHeadersRequestMsg: p2p.ConnDefault, BlockHeadersMsg: p2p.ConnDefault, BlockBodiesRequestMsg: p2p.ConnDefault, BlockBodiesMsg: p2p.ConnDefault, NewBlockMsg: p2p.ConnDefault, NodeDataRequestMsg: p2p.ConnDefault, NodeDataMsg: p2p.ConnDefault, ReceiptsRequestMsg: p2p.ConnDefault, ReceiptsMsg: p2p.ConnDefault, }
ChannelOfMessage is a map with the index of the channel per message
var ConcurrentOfChannel = []int{ p2p.ConnDefault: 1, p2p.ConnTxMsg: 3, }
var DefaultConfig = Config{ SyncMode: downloader.FullSync, NetworkId: params.CypressNetworkId, LevelDBCacheSize: 768, TrieCacheSize: 512, TrieTimeout: 5 * time.Minute, TrieBlockInterval: blockchain.DefaultBlockInterval, GasPrice: big.NewInt(18 * params.Ston), TxPool: blockchain.DefaultTxPoolConfig, GPO: gasprice.Config{ Blocks: 20, Percentile: 60, }, WsEndpoint: "localhost:8546", Istanbul: *istanbul.DefaultConfig, }
DefaultConfig contains default settings for use on the Klaytn main net.
var ProtocolLengths = []uint64{17, 8}
ProtocolLengths are the number of implemented message corresponding to different protocol versions.
var ProtocolName = "klay"
ProtocolName is the official short name of the protocol used during capability negotiation.
var ProtocolVersions = []uint{klay63, klay62}
ProtocolVersions are the upported versions of the klay protocol (first is primary).
Functions ¶
func CreateCliqueEngine ¶
func CreateCliqueEngine(ctx *node.ServiceContext, config *Config, chainConfig *params.ChainConfig, db database.DBManager) consensus.Engine
CreateConsensusEngine creates the required type of consensus engine instance for a Klaytn service
func CreateConsensusEngine ¶
func CreateConsensusEngine(ctx *node.ServiceContext, config *Config, chainConfig *params.ChainConfig, db database.DBManager, gov *governance.Governance, nodetype p2p.ConnType) consensus.Engine
CreateConsensusEngine creates the required type of consensus engine instance for a Klaytn service
func NewBloomIndexer ¶
func NewBloomIndexer(db database.DBManager, size uint64) *blockchain.ChainIndexer
NewBloomIndexer returns a chain indexer that generates bloom bits data for the canonical chain for fast logs filtering.
Types ¶
type BloomIndexer ¶
type BloomIndexer struct {
// contains filtered or unexported fields
}
BloomIndexer implements a blockchain.ChainIndexer, building up a rotated bloom bits index for the Klaytn header bloom filters, permitting blazing fast filtering.
func (*BloomIndexer) Commit ¶
func (b *BloomIndexer) Commit() error
Commit implements blockchain.ChainIndexerBackend, finalizing the bloom section and writing it out into the database.
func (*BloomIndexer) Process ¶
func (b *BloomIndexer) Process(header *types.Header)
Process implements blockchain.ChainIndexerBackend, adding a new header's bloom into the index.
type ByPassValidator ¶
type ByPassValidator struct{}
func (ByPassValidator) ValidatePeerType ¶
func (v ByPassValidator) ValidatePeerType(addr common.Address) error
type CN ¶
type CN struct { APIBackend *CNAPIBackend // contains filtered or unexported fields }
CN implements the Klaytn consensus node service.
func New ¶
func New(ctx *node.ServiceContext, config *Config) (*CN, error)
New creates a new CN object (including the initialisation of the common CN object)
func (*CN) APIs ¶
APIs returns the collection of RPC services the ethereum package offers. NOTE, some of these services probably need to be moved to somewhere else.
func (*CN) AccountManager ¶
func (*CN) AddLesServer ¶
func (*CN) BlockChain ¶
func (s *CN) BlockChain() *blockchain.BlockChain
func (*CN) Components ¶
func (s *CN) Components() []interface{}
func (*CN) IsListening ¶
func (*CN) NetVersion ¶
func (*CN) Progress ¶ added in v1.1.0
func (s *CN) Progress() klaytn.SyncProgress
func (*CN) ProtocolVersion ¶
func (*CN) Protocols ¶
Protocols implements node.Service, returning all the currently configured network protocols to start.
func (*CN) ReBroadcastTxs ¶
func (s *CN) ReBroadcastTxs(transactions types.Transactions)
func (*CN) ResetWithGenesisBlock ¶
func (*CN) SetComponents ¶
func (s *CN) SetComponents(component []interface{})
func (*CN) SetRewardbase ¶
func (*CN) Start ¶
Start implements node.Service, starting all internal goroutines needed by the Klaytn protocol implementation.
func (*CN) StartMining ¶
func (*CN) Stop ¶
Stop implements node.Service, terminating all internal goroutines used by the Klaytn protocol.
func (*CN) StopMining ¶
func (s *CN) StopMining()
func (*CN) TxPool ¶
func (s *CN) TxPool() *blockchain.TxPool
type CNAPIBackend ¶
type CNAPIBackend struct {
// contains filtered or unexported fields
}
CNAPIBackend implements api.Backend for full nodes
func (*CNAPIBackend) AccountManager ¶
func (b *CNAPIBackend) AccountManager() *accounts.Manager
func (*CNAPIBackend) BlockByNumber ¶
func (b *CNAPIBackend) BlockByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Block, error)
func (*CNAPIBackend) BloomStatus ¶
func (b *CNAPIBackend) BloomStatus() (uint64, uint64)
func (*CNAPIBackend) ChainConfig ¶
func (b *CNAPIBackend) ChainConfig() *params.ChainConfig
func (*CNAPIBackend) ChainDB ¶
func (b *CNAPIBackend) ChainDB() database.DBManager
func (*CNAPIBackend) CurrentBlock ¶
func (b *CNAPIBackend) CurrentBlock() *types.Block
func (*CNAPIBackend) EventMux ¶
func (b *CNAPIBackend) EventMux() *event.TypeMux
func (*CNAPIBackend) GetBlockReceipts ¶
GetBlockReceipts retrieves the receipts for all transactions with given block hash.
func (*CNAPIBackend) GetBlockReceiptsInCache ¶
func (b *CNAPIBackend) GetBlockReceiptsInCache(blockHash common.Hash) types.Receipts
GetBlockReceiptsInCache retrieves receipts for a given block hash in cache.
func (*CNAPIBackend) GetNonceInCache ¶
func (b *CNAPIBackend) GetNonceInCache(addr common.Address) (uint64, bool)
GetNonceInCache returns (cachedNonce, true) if nonce exists in cache. If not, it returns (0, false).
func (*CNAPIBackend) GetPoolNonce ¶
func (*CNAPIBackend) GetPoolTransaction ¶
func (b *CNAPIBackend) GetPoolTransaction(hash common.Hash) *types.Transaction
func (*CNAPIBackend) GetPoolTransactions ¶
func (b *CNAPIBackend) GetPoolTransactions() (types.Transactions, error)
func (*CNAPIBackend) GetTxAndLookupInfo ¶
func (b *CNAPIBackend) GetTxAndLookupInfo(hash common.Hash) (*types.Transaction, common.Hash, uint64, uint64)
GetTxAndLookupInfo retrieves a tx and lookup info for a given transaction hash.
func (*CNAPIBackend) GetTxAndLookupInfoInCache ¶
func (b *CNAPIBackend) GetTxAndLookupInfoInCache(txHash common.Hash) (*types.Transaction, common.Hash, uint64, uint64)
GetTxAndLookupInfoInCache retrieves a tx and lookup info for a given transaction hash in cache.
func (*CNAPIBackend) GetTxLookupInfoAndReceipt ¶
func (b *CNAPIBackend) GetTxLookupInfoAndReceipt(ctx context.Context, txHash common.Hash) (*types.Transaction, common.Hash, uint64, uint64, *types.Receipt)
GetTxLookupInfoAndReceipt retrieves a tx and lookup info and receipt for a given transaction hash.
func (*CNAPIBackend) GetTxLookupInfoAndReceiptInCache ¶
func (b *CNAPIBackend) GetTxLookupInfoAndReceiptInCache(txHash common.Hash) (*types.Transaction, common.Hash, uint64, uint64, *types.Receipt)
GetTxLookupInfoAndReceiptInCache retrieves a tx and lookup info and receipt for a given transaction hash in cache.
func (*CNAPIBackend) HeaderByNumber ¶
func (b *CNAPIBackend) HeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Header, error)
func (*CNAPIBackend) IsParallelDBWrite ¶
func (b *CNAPIBackend) IsParallelDBWrite() bool
func (*CNAPIBackend) IsSenderTxHashIndexingEnabled ¶
func (b *CNAPIBackend) IsSenderTxHashIndexingEnabled() bool
func (*CNAPIBackend) Progress ¶ added in v1.1.0
func (b *CNAPIBackend) Progress() klaytn.SyncProgress
func (*CNAPIBackend) ProtocolVersion ¶
func (b *CNAPIBackend) ProtocolVersion() int
func (*CNAPIBackend) SendTx ¶
func (b *CNAPIBackend) SendTx(ctx context.Context, signedTx *types.Transaction) error
func (*CNAPIBackend) ServiceFilter ¶
func (b *CNAPIBackend) ServiceFilter(ctx context.Context, session *bloombits.MatcherSession)
func (*CNAPIBackend) SetHead ¶
func (b *CNAPIBackend) SetHead(number uint64)
func (*CNAPIBackend) StateAndHeaderByNumber ¶
func (b *CNAPIBackend) StateAndHeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*state.StateDB, *types.Header, error)
func (*CNAPIBackend) Stats ¶
func (b *CNAPIBackend) Stats() (pending int, queued int)
func (*CNAPIBackend) SubscribeChainEvent ¶
func (b *CNAPIBackend) SubscribeChainEvent(ch chan<- blockchain.ChainEvent) event.Subscription
func (*CNAPIBackend) SubscribeChainHeadEvent ¶
func (b *CNAPIBackend) SubscribeChainHeadEvent(ch chan<- blockchain.ChainHeadEvent) event.Subscription
func (*CNAPIBackend) SubscribeChainSideEvent ¶
func (b *CNAPIBackend) SubscribeChainSideEvent(ch chan<- blockchain.ChainSideEvent) event.Subscription
func (*CNAPIBackend) SubscribeLogsEvent ¶
func (b *CNAPIBackend) SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscription
func (*CNAPIBackend) SubscribeNewTxsEvent ¶
func (b *CNAPIBackend) SubscribeNewTxsEvent(ch chan<- blockchain.NewTxsEvent) event.Subscription
func (*CNAPIBackend) SubscribeRemovedLogsEvent ¶
func (b *CNAPIBackend) SubscribeRemovedLogsEvent(ch chan<- blockchain.RemovedLogsEvent) event.Subscription
func (*CNAPIBackend) SuggestPrice ¶
func (*CNAPIBackend) TxPoolContent ¶
func (b *CNAPIBackend) TxPoolContent() (map[common.Address]types.Transactions, map[common.Address]types.Transactions)
type ChannelManager ¶
type ChannelManager struct {
// contains filtered or unexported fields
}
func NewChannelManager ¶
func NewChannelManager(channelSize int) *ChannelManager
NewChannelManager returns a new ChannelManager. The ChannelManager manages the channel for the msg code.
func (*ChannelManager) GetChannelWithMsgCode ¶
GetChannelWithMsgCode returns the channel corresponding to msgCode.
func (*ChannelManager) RegisterChannelWithIndex ¶
func (cm *ChannelManager) RegisterChannelWithIndex(idx int, channelId uint, channel chan p2p.Msg)
RegisterChannelWithIndex registers the channel corresponding to network and channel ID.
func (*ChannelManager) RegisterMsgCode ¶
func (cm *ChannelManager) RegisterMsgCode(channelId uint, msgCode uint64)
RegisterMsgCode registers the channel id corresponding to msgCode.
type Config ¶
type Config struct { // The genesis block, which is inserted if the database is empty. // If nil, the Klaytn main net block is used. Genesis *blockchain.Genesis `toml:",omitempty"` // Protocol options NetworkId uint64 // Network ID to use for selecting peers to connect to SyncMode downloader.SyncMode NoPruning bool // Service chain options ParentOperatorAddr *common.Address `toml:",omitempty"` // A hex account address in the parent chain used to sign a child chain transaction. AnchoringPeriod uint64 // Period when child chain sends an anchoring transaction to the parent chain. Default value is 1. SentChainTxsLimit uint64 // Number of chain transactions stored for resending. Default value is 1000. // Database options SkipBcVersionCheck bool `toml:"-"` PartitionedDB bool NumStateTriePartitions uint LevelDBCompression database.LevelDBCompressionType LevelDBBufferPool bool LevelDBCacheSize int TrieCacheSize int TrieTimeout time.Duration TrieBlockInterval uint SenderTxHashIndexing bool ParallelDBWrite bool StateDBCaching bool TxPoolStateCache bool TrieCacheLimit int // Mining-related options ServiceChainSigner common.Address `toml:",omitempty"` ExtraData []byte `toml:",omitempty"` GasPrice *big.Int // Reward Rewardbase common.Address `toml:",omitempty"` // Transaction pool options TxPool blockchain.TxPoolConfig // Gas Price Oracle options GPO gasprice.Config // Enables tracking of SHA3 preimages in the VM EnablePreimageRecording bool // Istanbul options Istanbul istanbul.Config // Miscellaneous options DocRoot string `toml:"-"` WsEndpoint string `toml:",omitempty"` // Tx Resending options TxResendInterval uint64 TxResendCount int TxResendUseLegacy bool // Service Chain NoAccountCreation bool // use separate network different from baobab or cypress IsPrivate bool }
func (Config) MarshalTOML ¶
MarshalTOML marshals as TOML.
func (*Config) UnmarshalTOML ¶
UnmarshalTOML unmarshals from TOML.
type EmptyTxPool ¶
type EmptyTxPool struct {
// contains filtered or unexported fields
}
func (*EmptyTxPool) AddRemotes ¶
func (re *EmptyTxPool) AddRemotes([]*types.Transaction) []error
func (*EmptyTxPool) Pending ¶
func (re *EmptyTxPool) Pending() (map[common.Address]types.Transactions, error)
func (*EmptyTxPool) SubscribeNewTxsEvent ¶
func (re *EmptyTxPool) SubscribeNewTxsEvent(newtxch chan<- blockchain.NewTxsEvent) event.Subscription
type LesServer ¶
type LesServer interface { Start(srvr p2p.Server) Stop() Protocols() []p2p.Protocol SetBloomBitsIndexer(bbIndexer *blockchain.ChainIndexer) }
type NodeInfo ¶
type NodeInfo struct { // TODO-Klaytn describe predefined network ID below Network uint64 `json:"network"` // Klaytn network ID BlockScore *big.Int `json:"blockscore"` // Total blockscore of the host's blockchain Genesis common.Hash `json:"genesis"` // SHA3 hash of the host's genesis block Config *params.ChainConfig `json:"config"` // Chain configuration for the fork rules Head common.Hash `json:"head"` // SHA3 hash of the host's best owned block }
NodeInfo represents a short summary of the Klaytn sub-protocol metadata known about the host peer.
type Peer ¶
type Peer interface { // Broadcast is a write loop that multiplexes block propagations, announcements // and transaction broadcasts into the remote peer. The goal is to have an async // writer that does not lock up node internals. Broadcast() // Close signals the broadcast goroutine to terminate. Close() // Info gathers and returns a collection of metadata known about a peer. Info() *PeerInfo // SetHead updates the head hash and total blockscore of the peer. SetHead(hash common.Hash, td *big.Int) // AddToKnownBlocks adds a block hash to knownBlocksCache for the peer, ensuring that the block will // never be propagated to this particular peer. AddToKnownBlocks(hash common.Hash) // AddToKnownTxs adds a transaction hash to knownTxsCache for the peer, ensuring that it // will never be propagated to this particular peer. AddToKnownTxs(hash common.Hash) // Send writes an RLP-encoded message with the given code. // data should have been encoded as an RLP list. Send(msgcode uint64, data interface{}) error // SendTransactions sends transactions to the peer and includes the hashes // in its transaction hash set for future reference. SendTransactions(txs types.Transactions) error // ReSendTransactions sends txs to a peer in order to prevent the txs from missing. ReSendTransactions(txs types.Transactions) error // AsyncSendTransactions sends transactions asynchronously to the peer. AsyncSendTransactions(txs []*types.Transaction) // SendNewBlockHashes announces the availability of a number of blocks through // a hash notification. SendNewBlockHashes(hashes []common.Hash, numbers []uint64) error // AsyncSendNewBlockHash queues the availability of a block for propagation to a // remote peer. If the peer's broadcast queue is full, the event is silently // dropped. AsyncSendNewBlockHash(block *types.Block) // SendNewBlock propagates an entire block to a remote peer. SendNewBlock(block *types.Block, td *big.Int) error // AsyncSendNewBlock queues an entire block for propagation to a remote peer. If // the peer's broadcast queue is full, the event is silently dropped. AsyncSendNewBlock(block *types.Block, td *big.Int) // SendBlockHeaders sends a batch of block headers to the remote peer. SendBlockHeaders(headers []*types.Header) error // SendFetchedBlockHeader sends a block header to the remote peer, requested by fetcher. SendFetchedBlockHeader(header *types.Header) error // SendBlockBodies sends a batch of block contents to the remote peer. SendBlockBodies(bodies []*blockBody) error // SendBlockBodiesRLP sends a batch of block contents to the remote peer from // an already RLP encoded format. SendBlockBodiesRLP(bodies []rlp.RawValue) error // SendFetchedBlockBodiesRLP sends a batch of block contents to the remote peer from // an already RLP encoded format, requested by fetcher. SendFetchedBlockBodiesRLP(bodies []rlp.RawValue) error // SendNodeDataRLP sends a batch of arbitrary internal data, corresponding to the // hashes requested. SendNodeData(data [][]byte) error // SendReceiptsRLP sends a batch of transaction receipts, corresponding to the // ones requested from an already RLP encoded format. SendReceiptsRLP(receipts []rlp.RawValue) error // FetchBlockHeader is a wrapper around the header query functions to fetch a // single header. It is used solely by the fetcher. FetchBlockHeader(hash common.Hash) error // FetchBlockBodies fetches a batch of blocks' bodies corresponding to the hashes // specified. If uses different message type from RequestBodies. // It is used solely by the fetcher. FetchBlockBodies(hashes []common.Hash) error // Handshake executes the Klaytn protocol handshake, negotiating version number, // network IDs, difficulties, head, and genesis blocks and returning error. Handshake(network uint64, chainID, td *big.Int, head common.Hash, genesis common.Hash) error // ConnType returns the conntype of the peer. ConnType() p2p.ConnType // GetID returns the id of the peer. GetID() string // GetP2PPeerID returns the id of the p2p.Peer. GetP2PPeerID() discover.NodeID // GetChainID returns the chain id of the peer. GetChainID() *big.Int // GetAddr returns the address of the peer. GetAddr() common.Address // SetAddr sets the address of the peer. SetAddr(addr common.Address) // GetVersion returns the version of the peer. GetVersion() int // KnowsBlock returns if the peer is known to have the block, based on knownBlocksCache. KnowsBlock(hash common.Hash) bool // KnowsTx returns if the peer is known to have the transaction, based on knownTxsCache. KnowsTx(hash common.Hash) bool // GetP2PPeer returns the p2p. GetP2PPeer() *p2p.Peer // GetRW returns the MsgReadWriter of the peer. GetRW() p2p.MsgReadWriter // Handle is the callback invoked to manage the life cycle of a Klaytn Peer. When // this function terminates, the Peer is disconnected. Handle(pm *ProtocolManager) error // UpdateRWImplementationVersion updates the version of the implementation of RW. UpdateRWImplementationVersion() // Peer encapsulates the methods required to synchronise with a remote full peer. downloader.Peer // RegisterConsensusMsgCode registers the channel of consensus msg. RegisterConsensusMsgCode(msgCode uint64) }
type PeerInfo ¶
type PeerInfo struct { Version int `json:"version"` // Klaytn protocol version negotiated BlockScore *big.Int `json:"blockscore"` // Total blockscore of the peer's blockchain Head string `json:"head"` // SHA3 hash of the peer's best owned block }
PeerInfo represents a short summary of the Klaytn sub-protocol metadata known about a connected peer.
type PrivateAdminAPI ¶
type PrivateAdminAPI struct {
// contains filtered or unexported fields
}
PrivateAdminAPI is the collection of CN full node-related APIs exposed over the private admin endpoint.
func NewPrivateAdminAPI ¶
func NewPrivateAdminAPI(cn *CN) *PrivateAdminAPI
NewPrivateAdminAPI creates a new API definition for the full node private admin methods of the CN service.
func (*PrivateAdminAPI) ExportChain ¶
func (api *PrivateAdminAPI) ExportChain(file string) (bool, error)
ExportChain exports the current blockchain into a local file.
func (*PrivateAdminAPI) ImportChain ¶
func (api *PrivateAdminAPI) ImportChain(file string) (bool, error)
ImportChain imports a blockchain from a local file.
type PrivateDebugAPI ¶
type PrivateDebugAPI struct {
// contains filtered or unexported fields
}
PrivateDebugAPI is the collection of CN full node APIs exposed over the private debugging endpoint.
func NewPrivateDebugAPI ¶
func NewPrivateDebugAPI(config *params.ChainConfig, cn *CN) *PrivateDebugAPI
NewPrivateDebugAPI creates a new API definition for the full node-related private debug methods of the CN service.
func (*PrivateDebugAPI) GetBadBlocks ¶
func (api *PrivateDebugAPI) GetBadBlocks(ctx context.Context) ([]blockchain.BadBlockArgs, error)
GetBadBLocks returns a list of the last 'bad blocks' that the client has seen on the network and returns them as a JSON list of block-hashes
func (*PrivateDebugAPI) GetModifiedAccountsByHash ¶
func (api *PrivateDebugAPI) GetModifiedAccountsByHash(startHash common.Hash, endHash *common.Hash) ([]common.Address, error)
GetModifiedAccountsByHash returns all accounts that have changed between the two blocks specified. A change is defined as a difference in nonce, balance, code hash, or storage hash.
With one parameter, returns the list of accounts modified in the specified block.
func (*PrivateDebugAPI) GetModifiedAccountsByNumber ¶
func (api *PrivateDebugAPI) GetModifiedAccountsByNumber(startNum uint64, endNum *uint64) ([]common.Address, error)
GetModifiedAccountsByumber returns all accounts that have changed between the two blocks specified. A change is defined as a difference in nonce, balance, code hash, or storage hash.
With one parameter, returns the list of accounts modified in the specified block.
func (*PrivateDebugAPI) Preimage ¶
Preimage is a debug API function that returns the preimage for a sha3 hash, if known.
func (*PrivateDebugAPI) StandardTraceBadBlockToFile ¶
func (api *PrivateDebugAPI) StandardTraceBadBlockToFile(ctx context.Context, hash common.Hash, config *StdTraceConfig) ([]string, error)
StandardTraceBadBlockToFile dumps the structured logs created during the execution of EVM against a block pulled from the pool of bad ones to the local file system and returns a list of files to the caller.
func (*PrivateDebugAPI) StandardTraceBlockToFile ¶
func (api *PrivateDebugAPI) StandardTraceBlockToFile(ctx context.Context, hash common.Hash, config *StdTraceConfig) ([]string, error)
StandardTraceBlockToFile dumps the structured logs created during the execution of EVM to the local file system and returns a list of files to the caller.
func (*PrivateDebugAPI) TraceBadBlock ¶
func (api *PrivateDebugAPI) TraceBadBlock(ctx context.Context, hash common.Hash, config *TraceConfig) ([]*txTraceResult, error)
TraceBadBlock returns the structured logs created during the execution of EVM against a block pulled from the pool of bad ones and returns them as a JSON object.
func (*PrivateDebugAPI) TraceBlock ¶
func (api *PrivateDebugAPI) TraceBlock(ctx context.Context, blob hexutil.Bytes, config *TraceConfig) ([]*txTraceResult, error)
TraceBlock returns the structured logs created during the execution of EVM and returns them as a JSON object.
func (*PrivateDebugAPI) TraceBlockByHash ¶
func (api *PrivateDebugAPI) TraceBlockByHash(ctx context.Context, hash common.Hash, config *TraceConfig) ([]*txTraceResult, error)
TraceBlockByHash returns the structured logs created during the execution of EVM and returns them as a JSON object.
func (*PrivateDebugAPI) TraceBlockByNumber ¶
func (api *PrivateDebugAPI) TraceBlockByNumber(ctx context.Context, number rpc.BlockNumber, config *TraceConfig) ([]*txTraceResult, error)
TraceBlockByNumber returns the structured logs created during the execution of EVM and returns them as a JSON object.
func (*PrivateDebugAPI) TraceBlockFromFile ¶
func (api *PrivateDebugAPI) TraceBlockFromFile(ctx context.Context, file string, config *TraceConfig) ([]*txTraceResult, error)
TraceBlockFromFile returns the structured logs created during the execution of EVM and returns them as a JSON object.
func (*PrivateDebugAPI) TraceChain ¶
func (api *PrivateDebugAPI) TraceChain(ctx context.Context, start, end rpc.BlockNumber, config *TraceConfig) (*rpc.Subscription, error)
TraceChain returns the structured logs created during the execution of EVM between two blocks (excluding start) and returns them as a JSON object.
func (*PrivateDebugAPI) TraceTransaction ¶
func (api *PrivateDebugAPI) TraceTransaction(ctx context.Context, hash common.Hash, config *TraceConfig) (interface{}, error)
TraceTransaction returns the structured logs created during the execution of EVM and returns them as a JSON object.
type PrivateMinerAPI ¶
type PrivateMinerAPI struct {
// contains filtered or unexported fields
}
PrivateMinerAPI provides private RPC methods to control the miner. These methods can be abused by external users and must be considered insecure for use by untrusted users.
func NewPrivateMinerAPI ¶
func NewPrivateMinerAPI(e *CN) *PrivateMinerAPI
NewPrivateMinerAPI create a new RPC service which controls the miner of this node.
func (*PrivateMinerAPI) GetHashrate ¶
func (api *PrivateMinerAPI) GetHashrate() uint64
GetHashrate returns the current hashrate of the miner.
func (*PrivateMinerAPI) SetExtra ¶
func (api *PrivateMinerAPI) SetExtra(extra string) (bool, error)
SetExtra sets the extra data string that is included when this miner mines a block.
func (*PrivateMinerAPI) SetGasPrice ¶
func (api *PrivateMinerAPI) SetGasPrice(gasPrice hexutil.Big) bool
SetGasPrice sets the minimum accepted gas price for the miner.
func (*PrivateMinerAPI) SetRewardbase ¶
func (api *PrivateMinerAPI) SetRewardbase(rewardbase common.Address) bool
SetRewardbase sets the rewardbase of the CN.
func (*PrivateMinerAPI) Start ¶
func (api *PrivateMinerAPI) Start(threads *int) error
Start the miner with the given number of threads. If threads is nil the number of workers started is equal to the number of logical CPUs that are usable by this process. If mining is already running, this method adjust the number of threads allowed to use.
type PrivateServiceChainAdminAPI ¶
type PrivateServiceChainAdminAPI struct {
// contains filtered or unexported fields
}
PrivateAdminAPI is the collection of sc full node-related APIs exposed over the private admin endpoint.
func NewPrivateServiceChainAdminAPI ¶
func NewPrivateServiceChainAdminAPI(sc *ServiceChain) *PrivateServiceChainAdminAPI
NewPrivateAdminAPI creates a new API definition for the full node private admin methods of the sc service.
func (*PrivateServiceChainAdminAPI) ExportChain ¶
func (api *PrivateServiceChainAdminAPI) ExportChain(file string) (bool, error)
ExportChain exports the current blockchain into a local file.
func (*PrivateServiceChainAdminAPI) ImportChain ¶
func (api *PrivateServiceChainAdminAPI) ImportChain(file string) (bool, error)
ImportChain imports a blockchain from a local file.
type PrivateServiceChainDebugAPI ¶
type PrivateServiceChainDebugAPI struct {
// contains filtered or unexported fields
}
PrivateDebugAPI is the collection of sc full node APIs exposed over the private debugging endpoint.
func NewPrivateServiceChainDebugAPI ¶
func NewPrivateServiceChainDebugAPI(config *params.ChainConfig, sc *ServiceChain) *PrivateServiceChainDebugAPI
NewPrivateDebugAPI creates a new API definition for the full node-related private debug methods of the sc service.
func (*PrivateServiceChainDebugAPI) GetBadBlocks ¶
func (api *PrivateServiceChainDebugAPI) GetBadBlocks(ctx context.Context) ([]blockchain.BadBlockArgs, error)
GetBadBLocks returns a list of the last 'bad blocks' that the client has seen on the network and returns them as a JSON list of block-hashes
func (*PrivateServiceChainDebugAPI) GetModifiedAccountsByHash ¶
func (api *PrivateServiceChainDebugAPI) GetModifiedAccountsByHash(startHash common.Hash, endHash *common.Hash) ([]common.Address, error)
GetModifiedAccountsByHash returns all accounts that have changed between the two blocks specified. A change is defined as a difference in nonce, balance, code hash, or storage hash.
With one parameter, returns the list of accounts modified in the specified block.
func (*PrivateServiceChainDebugAPI) GetModifiedAccountsByNumber ¶
func (api *PrivateServiceChainDebugAPI) GetModifiedAccountsByNumber(startNum uint64, endNum *uint64) ([]common.Address, error)
GetModifiedAccountsByumber returns all accounts that have changed between the two blocks specified. A change is defined as a difference in nonce, balance, code hash, or storage hash.
With one parameter, returns the list of accounts modified in the specified block.
type PrivateServiceChainMinerAPI ¶
type PrivateServiceChainMinerAPI struct {
// contains filtered or unexported fields
}
PrivateMinerAPI provides private RPC methods to control the miner. These methods can be abused by external users and must be considered insecure for use by untrusted users.
func NewPrivateServiceChainMinerAPI ¶
func NewPrivateServiceChainMinerAPI(e *ServiceChain) *PrivateServiceChainMinerAPI
NewPrivateMinerAPI create a new RPC service which controls the miner of this node.
func (*PrivateServiceChainMinerAPI) GetHashrate ¶
func (api *PrivateServiceChainMinerAPI) GetHashrate() uint64
GetHashrate returns the current hashrate of the miner.
func (*PrivateServiceChainMinerAPI) SetExtra ¶
func (api *PrivateServiceChainMinerAPI) SetExtra(extra string) (bool, error)
SetExtra sets the extra data string that is included when this miner mines a block.
func (*PrivateServiceChainMinerAPI) SetGasPrice ¶
func (api *PrivateServiceChainMinerAPI) SetGasPrice(gasPrice hexutil.Big) bool
SetGasPrice sets the minimum accepted gas price for the miner.
func (*PrivateServiceChainMinerAPI) Start ¶
func (api *PrivateServiceChainMinerAPI) Start(threads *int) error
Start the miner with the given number of threads. If threads is nil the number of workers started is equal to the number of logical CPUs that are usable by this process. If mining is already running, this method adjust the number of threads allowed to use.
func (*PrivateServiceChainMinerAPI) Stop ¶
func (api *PrivateServiceChainMinerAPI) Stop() bool
Stop the miner
type ProtocolManager ¶
type ProtocolManager struct { SubProtocols []p2p.Protocol // contains filtered or unexported fields }
func NewProtocolManager ¶
func NewProtocolManager(config *params.ChainConfig, mode downloader.SyncMode, networkId uint64, mux *event.TypeMux, txpool txPool, engine consensus.Engine, blockchain *blockchain.BlockChain, chainDB database.DBManager, nodetype p2p.ConnType, cnconfig *Config) (*ProtocolManager, error)
NewProtocolManager returns a new Klaytn sub protocol manager. The Klaytn sub protocol manages peers capable with the Klaytn network.
func (*ProtocolManager) BroadcastBlock ¶
func (pm *ProtocolManager) BroadcastBlock(block *types.Block)
BroadcastBlock will propagate a block to a subset of its peers. If current node is CN, it will send block to all PN peers + sampled CN peers without block. However, if there are more than 5 PN peers, it will sample 5 PN peers. If current node is not CN, it will send block to sampled peers except CNs.
func (*ProtocolManager) BroadcastBlockHash ¶
func (pm *ProtocolManager) BroadcastBlockHash(block *types.Block)
BroadcastBlockHash will propagate a blockHash to a subset of its peers.
func (*ProtocolManager) BroadcastTxs ¶
func (pm *ProtocolManager) BroadcastTxs(txs types.Transactions)
BroadcastTxs will propagate a batch of transactions to all peers which are not known to already have the given transaction.
func (*ProtocolManager) Enqueue ¶
func (pm *ProtocolManager) Enqueue(id string, block *types.Block)
istanbul BFT
func (*ProtocolManager) FindCNPeers ¶
func (*ProtocolManager) GetCNPeers ¶
func (pm *ProtocolManager) GetCNPeers() map[common.Address]consensus.Peer
func (*ProtocolManager) GetENPeers ¶
func (pm *ProtocolManager) GetENPeers() map[common.Address]consensus.Peer
func (*ProtocolManager) GetPeers ¶
func (pm *ProtocolManager) GetPeers() []common.Address
func (*ProtocolManager) NodeInfo ¶
func (pm *ProtocolManager) NodeInfo() *NodeInfo
NodeInfo retrieves some protocol metadata about the running host node.
func (*ProtocolManager) ReBroadcastTxs ¶
func (pm *ProtocolManager) ReBroadcastTxs(txs types.Transactions)
func (*ProtocolManager) RegisterValidator ¶
func (pm *ProtocolManager) RegisterValidator(conType p2p.ConnType, validator p2p.PeerTypeValidator)
istanbul BFT
func (*ProtocolManager) SetRewardbase ¶
func (pm *ProtocolManager) SetRewardbase(addr common.Address)
func (*ProtocolManager) SetRewardbaseWallet ¶
func (pm *ProtocolManager) SetRewardbaseWallet(wallet accounts.Wallet)
func (*ProtocolManager) Start ¶
func (pm *ProtocolManager) Start(maxPeers int)
func (*ProtocolManager) Stop ¶
func (pm *ProtocolManager) Stop()
type PublicDebugAPI ¶
type PublicDebugAPI struct {
// contains filtered or unexported fields
}
PublicDebugAPI is the collection of Klaytn full node APIs exposed over the public debugging endpoint.
func NewPublicDebugAPI ¶
func NewPublicDebugAPI(cn *CN) *PublicDebugAPI
NewPublicDebugAPI creates a new API definition for the full node- related public debug methods of the Klaytn service.
func (*PublicDebugAPI) DumpBlock ¶
func (api *PublicDebugAPI) DumpBlock(blockNr rpc.BlockNumber) (state.Dump, error)
DumpBlock retrieves the entire state of the database at a given block.
type PublicKlayAPI ¶
type PublicKlayAPI struct {
// contains filtered or unexported fields
}
PublicKlayAPI provides an API to access Klaytn CN-related information.
func NewPublicKlayAPI ¶
func NewPublicKlayAPI(e *CN) *PublicKlayAPI
NewPublicKlayAPI creates a new Klaytn protocol API for full nodes.
func (*PublicKlayAPI) Hashrate ¶
func (api *PublicKlayAPI) Hashrate() hexutil.Uint64
Hashrate returns the POW hashrate
func (*PublicKlayAPI) Rewardbase ¶
func (api *PublicKlayAPI) Rewardbase() (common.Address, error)
Rewardbase is the address that consensus rewards will be send to
type PublicKlayServiceChainAPI ¶
type PublicKlayServiceChainAPI struct {
// contains filtered or unexported fields
}
PublicKlayAPI provides an API to access Klaytn CN-related information.
func NewPublicKlayServiceChainAPI ¶
func NewPublicKlayServiceChainAPI(sc *ServiceChain) *PublicKlayServiceChainAPI
NewPublicKlayAPI creates a new Klaytn protocol API for full nodes.
func (*PublicKlayServiceChainAPI) Hashrate ¶
func (api *PublicKlayServiceChainAPI) Hashrate() hexutil.Uint64
Hashrate returns the POW hashrate
type PublicMinerAPI ¶
type PublicMinerAPI struct {
// contains filtered or unexported fields
}
PublicMinerAPI provides an API to control the miner. It offers only methods that operate on data that pose no security risk when it is publicly accessible.
func NewPublicMinerAPI ¶
func NewPublicMinerAPI(e *CN) *PublicMinerAPI
NewPublicMinerAPI create a new PublicMinerAPI instance.
func (*PublicMinerAPI) GetWork ¶
func (api *PublicMinerAPI) GetWork() ([3]string, error)
GetWork returns a work package for external miner. The work package consists of 3 strings result[0], 32 bytes hex encoded current block header pow-hash result[1], 32 bytes hex encoded seed hash used for DAG result[2], 32 bytes hex encoded boundary condition ("target"), 2^256/blockscore
func (*PublicMinerAPI) Mining ¶
func (api *PublicMinerAPI) Mining() bool
Mining returns an indication if this node is currently mining.
func (*PublicMinerAPI) SubmitHashrate ¶
SubmitHashrate can be used for remote miners to submit their hash rate. This enables the node to report the combined hash rate of all miners which submit work through this node. It accepts the miner hash rate and an identifier which must be unique between nodes.
func (*PublicMinerAPI) SubmitWork ¶
func (api *PublicMinerAPI) SubmitWork(solution common.Hash) bool
SubmitWork can be used by external miner to submit their POW solution. It returns an indication if the work was accepted. Note, this is not an indication if the provided work was valid!
type PublicServiceChainDebugAPI ¶
type PublicServiceChainDebugAPI struct {
// contains filtered or unexported fields
}
PublicDebugAPI is the collection of Klaytn full node APIs exposed over the public debugging endpoint.
func NewPublicServiceChainDebugAPI ¶
func NewPublicServiceChainDebugAPI(sc *ServiceChain) *PublicServiceChainDebugAPI
NewPublicDebugAPI creates a new API definition for the full node- related public debug methods of the Klaytn service.
func (*PublicServiceChainDebugAPI) DumpBlock ¶
func (api *PublicServiceChainDebugAPI) DumpBlock(blockNr rpc.BlockNumber) (state.Dump, error)
DumpBlock retrieves the entire state of the database at a given block.
type PublicServiceChainMinerAPI ¶
type PublicServiceChainMinerAPI struct {
// contains filtered or unexported fields
}
PublicMinerAPI provides an API to control the miner. It offers only methods that operate on data that pose no security risk when it is publicly accessible.
func NewPublicServiceChainMinerAPI ¶
func NewPublicServiceChainMinerAPI(e *ServiceChain) *PublicServiceChainMinerAPI
NewPublicMinerAPI create a new PublicMinerAPI instance.
func (*PublicServiceChainMinerAPI) GetWork ¶
func (api *PublicServiceChainMinerAPI) GetWork() ([3]string, error)
GetWork returns a work package for external miner. The work package consists of 3 strings result[0], 32 bytes hex encoded current block header pow-hash result[1], 32 bytes hex encoded seed hash used for DAG result[2], 32 bytes hex encoded boundary condition ("target"), 2^256/blockScore
func (*PublicServiceChainMinerAPI) Mining ¶
func (api *PublicServiceChainMinerAPI) Mining() bool
Mining returns an indication if this node is currently mining.
func (*PublicServiceChainMinerAPI) SubmitWork ¶
func (api *PublicServiceChainMinerAPI) SubmitWork(solution common.Hash) bool
SubmitWork can be used by external miner to submit their POW solution. It returns an indication if the work was accepted. Note, this is not an indication if the provided work was valid!
type ServiceChain ¶
type ServiceChain struct { APIBackend *ServiceChainAPIBackend // contains filtered or unexported fields }
ServiceChain implements the Klaytn servicechain node service.
func NewServiceChain ¶
func NewServiceChain(ctx *node.ServiceContext, config *Config) (*ServiceChain, error)
New creates a new ServiceChain object (including the initialisation of the common ServiceChain object)
func (*ServiceChain) APIs ¶
func (s *ServiceChain) APIs() []rpc.API
APIs returns the collection of RPC services the ethereum package offers. NOTE, some of these services probably need to be moved to somewhere else.
func (*ServiceChain) AccountManager ¶
func (s *ServiceChain) AccountManager() *accounts.Manager
func (*ServiceChain) BlockChain ¶
func (s *ServiceChain) BlockChain() *blockchain.BlockChain
func (*ServiceChain) ChainDB ¶
func (s *ServiceChain) ChainDB() database.DBManager
func (*ServiceChain) Components ¶
func (s *ServiceChain) Components() []interface{}
func (*ServiceChain) Engine ¶
func (s *ServiceChain) Engine() consensus.Engine
func (*ServiceChain) EventMux ¶
func (s *ServiceChain) EventMux() *event.TypeMux
func (*ServiceChain) IsListening ¶
func (s *ServiceChain) IsListening() bool
func (*ServiceChain) IsMining ¶
func (s *ServiceChain) IsMining() bool
func (*ServiceChain) Miner ¶
func (s *ServiceChain) Miner() *work.Miner
func (*ServiceChain) NetVersion ¶
func (s *ServiceChain) NetVersion() uint64
func (*ServiceChain) Progress ¶ added in v1.1.0
func (s *ServiceChain) Progress() klaytn.SyncProgress
func (*ServiceChain) ProtocolVersion ¶
func (s *ServiceChain) ProtocolVersion() int
func (*ServiceChain) Protocols ¶
func (s *ServiceChain) Protocols() []p2p.Protocol
Protocols implements node.Service, returning all the currently configured network protocols to start.
func (*ServiceChain) ReBroadcastTxs ¶
func (s *ServiceChain) ReBroadcastTxs(transactions types.Transactions)
func (*ServiceChain) ResetWithGenesisBlock ¶
func (s *ServiceChain) ResetWithGenesisBlock(gb *types.Block)
func (*ServiceChain) SetComponents ¶
func (s *ServiceChain) SetComponents(component []interface{})
func (*ServiceChain) Start ¶
func (s *ServiceChain) Start(srvr p2p.Server) error
Start implements node.Service, starting all internal goroutines needed by the Klaytn protocol implementation.
func (*ServiceChain) StartMining ¶
func (s *ServiceChain) StartMining(local bool) error
func (*ServiceChain) Stop ¶
func (s *ServiceChain) Stop() error
Stop implements node.Service, terminating all internal goroutines used by the Klaytn protocol.
func (*ServiceChain) StopMining ¶
func (s *ServiceChain) StopMining()
func (*ServiceChain) TxPool ¶
func (s *ServiceChain) TxPool() *blockchain.TxPool
type ServiceChainAPIBackend ¶
type ServiceChainAPIBackend struct {
// contains filtered or unexported fields
}
ServiceChainAPIBackend implements api.Backend for full nodes
func (*ServiceChainAPIBackend) AccountManager ¶
func (b *ServiceChainAPIBackend) AccountManager() *accounts.Manager
func (*ServiceChainAPIBackend) BlockByNumber ¶
func (b *ServiceChainAPIBackend) BlockByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Block, error)
func (*ServiceChainAPIBackend) BloomStatus ¶
func (b *ServiceChainAPIBackend) BloomStatus() (uint64, uint64)
func (*ServiceChainAPIBackend) ChainConfig ¶
func (b *ServiceChainAPIBackend) ChainConfig() *params.ChainConfig
func (*ServiceChainAPIBackend) ChainDB ¶
func (b *ServiceChainAPIBackend) ChainDB() database.DBManager
func (*ServiceChainAPIBackend) CurrentBlock ¶
func (b *ServiceChainAPIBackend) CurrentBlock() *types.Block
func (*ServiceChainAPIBackend) EventMux ¶
func (b *ServiceChainAPIBackend) EventMux() *event.TypeMux
func (*ServiceChainAPIBackend) GetBlockReceipts ¶
func (b *ServiceChainAPIBackend) GetBlockReceipts(ctx context.Context, hash common.Hash) types.Receipts
GetBlockReceipts retrieves the receipts for all transactions with given block hash.
func (*ServiceChainAPIBackend) GetBlockReceiptsInCache ¶
func (b *ServiceChainAPIBackend) GetBlockReceiptsInCache(blockHash common.Hash) types.Receipts
GetBlockReceiptsInCache retrieves receipts for a given block hash in cache.
func (*ServiceChainAPIBackend) GetNonceInCache ¶
func (b *ServiceChainAPIBackend) GetNonceInCache(addr common.Address) (uint64, bool)
GetNonceInCache returns (cachedNonce, true) if nonce exists in cache. If not, it returns (0, false).
func (*ServiceChainAPIBackend) GetPoolNonce ¶
func (*ServiceChainAPIBackend) GetPoolTransaction ¶
func (b *ServiceChainAPIBackend) GetPoolTransaction(hash common.Hash) *types.Transaction
func (*ServiceChainAPIBackend) GetPoolTransactions ¶
func (b *ServiceChainAPIBackend) GetPoolTransactions() (types.Transactions, error)
func (*ServiceChainAPIBackend) GetTd ¶
func (b *ServiceChainAPIBackend) GetTd(blockHash common.Hash) *big.Int
func (*ServiceChainAPIBackend) GetTxAndLookupInfo ¶
func (b *ServiceChainAPIBackend) GetTxAndLookupInfo(hash common.Hash) (*types.Transaction, common.Hash, uint64, uint64)
GetTxAndLookupInfo retrieves a tx and lookup info for a given transaction hash.
func (*ServiceChainAPIBackend) GetTxAndLookupInfoInCache ¶
func (b *ServiceChainAPIBackend) GetTxAndLookupInfoInCache(txHash common.Hash) (*types.Transaction, common.Hash, uint64, uint64)
GetTxAndLookupInfoInCache retrieves a tx and lookup info for a given transaction hash in cache.
func (*ServiceChainAPIBackend) GetTxLookupInfoAndReceipt ¶
func (b *ServiceChainAPIBackend) GetTxLookupInfoAndReceipt(ctx context.Context, txHash common.Hash) (*types.Transaction, common.Hash, uint64, uint64, *types.Receipt)
GetTxLookupInfoAndReceipt retrieves a tx and lookup info and receipt for a given transaction hash.
func (*ServiceChainAPIBackend) GetTxLookupInfoAndReceiptInCache ¶
func (b *ServiceChainAPIBackend) GetTxLookupInfoAndReceiptInCache(txHash common.Hash) (*types.Transaction, common.Hash, uint64, uint64, *types.Receipt)
GetTxLookupInfoAndReceiptInCache retrieves a tx and lookup info and receipt for a given transaction hash in cache.
func (*ServiceChainAPIBackend) HeaderByNumber ¶
func (b *ServiceChainAPIBackend) HeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Header, error)
func (*ServiceChainAPIBackend) IsParallelDBWrite ¶
func (b *ServiceChainAPIBackend) IsParallelDBWrite() bool
func (*ServiceChainAPIBackend) IsSenderTxHashIndexingEnabled ¶
func (b *ServiceChainAPIBackend) IsSenderTxHashIndexingEnabled() bool
func (*ServiceChainAPIBackend) Progress ¶ added in v1.1.0
func (b *ServiceChainAPIBackend) Progress() klaytn.SyncProgress
func (*ServiceChainAPIBackend) ProtocolVersion ¶
func (b *ServiceChainAPIBackend) ProtocolVersion() int
func (*ServiceChainAPIBackend) SendTx ¶
func (b *ServiceChainAPIBackend) SendTx(ctx context.Context, signedTx *types.Transaction) error
func (*ServiceChainAPIBackend) ServiceFilter ¶
func (b *ServiceChainAPIBackend) ServiceFilter(ctx context.Context, session *bloombits.MatcherSession)
func (*ServiceChainAPIBackend) SetHead ¶
func (b *ServiceChainAPIBackend) SetHead(number uint64)
func (*ServiceChainAPIBackend) StateAndHeaderByNumber ¶
func (b *ServiceChainAPIBackend) StateAndHeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*state.StateDB, *types.Header, error)
func (*ServiceChainAPIBackend) Stats ¶
func (b *ServiceChainAPIBackend) Stats() (pending int, queued int)
func (*ServiceChainAPIBackend) SubscribeChainEvent ¶
func (b *ServiceChainAPIBackend) SubscribeChainEvent(ch chan<- blockchain.ChainEvent) event.Subscription
func (*ServiceChainAPIBackend) SubscribeChainHeadEvent ¶
func (b *ServiceChainAPIBackend) SubscribeChainHeadEvent(ch chan<- blockchain.ChainHeadEvent) event.Subscription
func (*ServiceChainAPIBackend) SubscribeChainSideEvent ¶
func (b *ServiceChainAPIBackend) SubscribeChainSideEvent(ch chan<- blockchain.ChainSideEvent) event.Subscription
func (*ServiceChainAPIBackend) SubscribeLogsEvent ¶
func (b *ServiceChainAPIBackend) SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscription
func (*ServiceChainAPIBackend) SubscribeNewTxsEvent ¶
func (b *ServiceChainAPIBackend) SubscribeNewTxsEvent(ch chan<- blockchain.NewTxsEvent) event.Subscription
func (*ServiceChainAPIBackend) SubscribeRemovedLogsEvent ¶
func (b *ServiceChainAPIBackend) SubscribeRemovedLogsEvent(ch chan<- blockchain.RemovedLogsEvent) event.Subscription
func (*ServiceChainAPIBackend) SuggestPrice ¶
func (*ServiceChainAPIBackend) TxPoolContent ¶
func (b *ServiceChainAPIBackend) TxPoolContent() (map[common.Address]types.Transactions, map[common.Address]types.Transactions)
type StakingHandler ¶ added in v1.1.0
type StakingHandler interface { SetStakingManager(manager *reward.StakingManager) GetStakingManager() *reward.StakingManager }
type StdTraceConfig ¶
StdTraceConfig holds extra parameters to standard-json trace functions.
type StorageRangeResult ¶
type StorageRangeResult struct { Storage storageMap `json:"storage"` NextKey *common.Hash `json:"nextKey"` // nil if Storage includes the last key in the statedb. }
StorageRangeResult is the result of a debug_storageRangeAt API call.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package filters implements an ethereum filtering system for block, transactions and log events.
|
Package filters implements an ethereum filtering system for block, transactions and log events. |
Package gasprice contains Oracle type which recommends gas prices based on recent blocks.
|
Package gasprice contains Oracle type which recommends gas prices based on recent blocks. |
Package tracers is a collection of JavaScript transaction tracers.
|
Package tracers is a collection of JavaScript transaction tracers. |
internal/tracers
Package tracers contains the actual JavaScript tracer assets.
|
Package tracers contains the actual JavaScript tracer assets. |