cph

package
v0.0.0-...-9fbb145 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2021 License: MIT Imports: 56 Imported by: 6

Documentation

Overview

Package cph implements the Cypherium protocol.

Index

Constants

View Source
const (
	// Protocol messages belonging to cph/62
	StatusMsg            = 0x00
	NewBlockHashesMsg    = 0x01
	TxMsg                = 0x02
	GetBlockHeadersMsg   = 0x03
	BlockHeadersMsg      = 0x04
	GetBlockBodiesMsg    = 0x05
	BlockBodiesMsg       = 0x06
	NewBlockMsg          = 0x07
	CandidateMsg         = 0x08
	NewKeyBlockHashesMsg = 0x09
	NewKeyBlockMsg       = 0x0A
	GetKeyBlocksMsg      = 0x0B
	KeyBlocksMsg         = 0x0C

	// Protocol messages belonging to cph/63
	GetNodeDataMsg            = 0x0d
	NodeDataMsg               = 0x0e
	GetReceiptsMsg            = 0x0f
	ReceiptsMsg               = 0x10
	GetContinuousKeyBlocksMsg = 0x11
)

cph protocol message codes

View Source
const (
	ErrMsgTooLarge = iota
	ErrDecode
	ErrInvalidMsgCode
	ErrProtocolVersionMismatch
	ErrNetworkIdMismatch
	ErrGenesisBlockMismatch
	ErrNoStatusMsg
	ErrExtraStatusMsg
	ErrSuspendedPeer
	ErrCandidate
)
View Source
const ProtocolMaxMsgSize = 10 * 1024 * 1024 // Maximum cap on the size of a protocol message

Variables

View Source
var DefaultConfig = Config{
	SyncMode: downloader.FullSync,
	Cphash: cphash.Config{
		CacheDir:       "cphash",
		CachesInMem:    2,
		CachesOnDisk:   3,
		DatasetsInMem:  1,
		DatasetsOnDisk: 2,
	},
	NetworkId:     1,
	LightPeers:    100,
	DatabaseCache: 768,
	TrieCache:     256,
	TrieTimeout:   60 * time.Minute,
	GasPrice:      big.NewInt(18 * params.Shannon),

	TxPool: core.DefaultTxPoolConfig,
	GPO: gasprice.Config{
		Blocks:     20,
		Percentile: 60,
	},
}

DefaultConfig contains default settings for use on the Cypherium main net.

View Source
var ProtocolLengths = []uint64{18, 13}

ProtocolLengths are the number of implemented message corresponding to different protocol versions.

View Source
var ProtocolName = "cph"

ProtocolName is the official short name of the protocol used during capability negotiation.

View Source
var ProtocolVersions = []uint{cph63, cph62}

ProtocolVersions are the upported versions of the cph protocol (first is primary).

Functions

func CreateConsensusEngine

func CreateConsensusEngine(ctx *node.ServiceContext, config *cphash.Config, chainConfig *params.ChainConfig, db cphdb.Database) pow.Engine

CreateConsensusEngine creates the required type of pow engine instance for an Cypherium service

func CreateDB

func CreateDB(ctx *node.ServiceContext, config *Config, name string) (cphdb.Database, error)

CreateDB creates the chain database.

func NewBloomIndexer

func NewBloomIndexer(db cphdb.Database, size uint64) *core.ChainIndexer

NewBloomIndexer returns a chain indexer that generates bloom bits data for the canonical chain for fast logs filtering.

Types

type BadBlockArgs

type BadBlockArgs struct {
	Hash  common.Hash            `json:"hash"`
	Block map[string]interface{} `json:"block"`
	RLP   string                 `json:"rlp"`
}

BadBlockArgs represents the entries in the list returned when bad blocks are queried.

type BloomIndexer

type BloomIndexer struct {
	// contains filtered or unexported fields
}

BloomIndexer implements a core.ChainIndexer, building up a rotated bloom bits index for the Cypherium header bloom filters, permitting blazing fast filtering.

func (*BloomIndexer) Commit

func (b *BloomIndexer) Commit() error

Commit implements core.ChainIndexerBackend, finalizing the bloom section and writing it out into the database.

func (*BloomIndexer) Process

func (b *BloomIndexer) Process(header *types.Header)

Process implements core.ChainIndexerBackend, adding a new header's bloom into the index.

func (*BloomIndexer) Reset

func (b *BloomIndexer) Reset(section uint64, lastSectionHead common.Hash) error

Reset implements core.ChainIndexerBackend, starting a new bloombits index section.

type Config

type Config struct {
	// The genesis block, which is inserted if the database is empty.
	// If nil, the Cypherium main net block is used.
	GenesisKey *core.GenesisKey `toml:",omitempty"`
	Genesis    *core.Genesis    `toml:",omitempty"`

	// Protocol options
	NetworkId uint64 // Network ID to use for selecting peers to connect to
	SyncMode  downloader.SyncMode
	NoPruning bool

	// Light client options
	LightServ  int `toml:",omitempty"` // Maximum percentage of time allowed for serving LES requests
	LightPeers int `toml:",omitempty"` // Maximum number of LES client peers

	// Database options
	SkipBcVersionCheck bool `toml:"-"`
	DatabaseHandles    int  `toml:"-"`
	DatabaseCache      int
	TrieCache          int
	TrieTimeout        time.Duration

	// Mining-related options
	MinerThreads int    `toml:",omitempty"`
	ExtraData    []byte `toml:",omitempty"`
	GasPrice     *big.Int

	// Cphash options
	Cphash cphash.Config

	// Transaction pool options
	TxPool          core.TxPoolConfig
	LocalTestConfig core.LocalTestIpConfig
	// Gas Price Oracle options
	GPO gasprice.Config

	// Enables tracking of SHA3 preimages in the VM
	EnablePreimageRecording bool

	// Miscellaneous options
	DocRoot    string `toml:"-"`
	RnetPort   string
	ExternalIp string
}

func (Config) MarshalTOML

func (c Config) MarshalTOML() (interface{}, error)

MarshalTOML marshals as TOML.

func (*Config) UnmarshalTOML

func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error

UnmarshalTOML unmarshals from TOML.

type CphAPIBackend

type CphAPIBackend struct {
	// contains filtered or unexported fields
}

CphAPIBackend implements cphapi.Backend for full nodes

func (*CphAPIBackend) AccountManager

func (b *CphAPIBackend) AccountManager() *accounts.Manager

func (*CphAPIBackend) AnnounceBlock

func (b *CphAPIBackend) AnnounceBlock(blockNr rpc.BlockNumber)

func (*CphAPIBackend) BlockByNumber

func (b *CphAPIBackend) BlockByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Block, error)

func (*CphAPIBackend) BloomStatus

func (b *CphAPIBackend) BloomStatus() (uint64, uint64)

func (*CphAPIBackend) CandidatePool

func (b *CphAPIBackend) CandidatePool() *core.CandidatePool

func (*CphAPIBackend) ChainConfig

func (b *CphAPIBackend) ChainConfig() *params.ChainConfig

ChainConfig returns the active chain configuration.

func (*CphAPIBackend) ChainDb

func (b *CphAPIBackend) ChainDb() cphdb.Database

func (*CphAPIBackend) CommitteeMembers

func (b *CphAPIBackend) CommitteeMembers(ctx context.Context, blockNr rpc.BlockNumber) ([]*common.Cnode, error)

func (*CphAPIBackend) CurrentBlock

func (b *CphAPIBackend) CurrentBlock() *types.Block

func (*CphAPIBackend) Downloader

func (b *CphAPIBackend) Downloader() *downloader.Downloader

func (*CphAPIBackend) EventMux

func (b *CphAPIBackend) EventMux() *event.TypeMux

func (*CphAPIBackend) Exceptions

func (b *CphAPIBackend) Exceptions(blockNumber int64) []string

func (*CphAPIBackend) GetBlock

func (b *CphAPIBackend) GetBlock(ctx context.Context, hash common.Hash) (*types.Block, error)

func (*CphAPIBackend) GetEVM

func (b *CphAPIBackend) GetEVM(ctx context.Context, msg core.Message, state *state.StateDB, header *types.Header, vmCfg vm.Config) (*vm.EVM, func() error, error)

func (*CphAPIBackend) GetKeyBlockChain

func (b *CphAPIBackend) GetKeyBlockChain() *core.KeyBlockChain

func (*CphAPIBackend) GetLogs

func (b *CphAPIBackend) GetLogs(ctx context.Context, hash common.Hash) ([][]*types.Log, error)

func (*CphAPIBackend) GetPoolNonce

func (b *CphAPIBackend) GetPoolNonce(ctx context.Context, addr common.Address) (uint64, error)

func (*CphAPIBackend) GetPoolTransaction

func (b *CphAPIBackend) GetPoolTransaction(hash common.Hash) *types.Transaction

func (*CphAPIBackend) GetPoolTransactions

func (b *CphAPIBackend) GetPoolTransactions() (types.Transactions, error)

func (*CphAPIBackend) GetReceipts

func (b *CphAPIBackend) GetReceipts(ctx context.Context, hash common.Hash) (types.Receipts, error)

func (*CphAPIBackend) GetTd

func (b *CphAPIBackend) GetTd(blockHash common.Hash) *big.Int

func (*CphAPIBackend) HeaderByNumber

func (b *CphAPIBackend) HeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Header, error)

func (*CphAPIBackend) KeyBlockByHash

func (b *CphAPIBackend) KeyBlockByHash(ctx context.Context, blockHash common.Hash) (*types.KeyBlock, error)

func (*CphAPIBackend) KeyBlockByNumber

func (b *CphAPIBackend) KeyBlockByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.KeyBlock, error)

func (*CphAPIBackend) KeyBlockNumber

func (b *CphAPIBackend) KeyBlockNumber() uint64

func (*CphAPIBackend) MockKeyBlock

func (b *CphAPIBackend) MockKeyBlock(amount int64)

func (*CphAPIBackend) ProtocolVersion

func (b *CphAPIBackend) ProtocolVersion() int

func (*CphAPIBackend) RollbackKeyChainFrom

func (b *CphAPIBackend) RollbackKeyChainFrom(blockHash common.Hash) error

func (*CphAPIBackend) RollbackTxChainFrom

func (b *CphAPIBackend) RollbackTxChainFrom(blockHash common.Hash) error

func (*CphAPIBackend) RosterConfig

func (b *CphAPIBackend) RosterConfig(data ...interface{}) error

func (*CphAPIBackend) SendTx

func (b *CphAPIBackend) SendTx(ctx context.Context, signedTx *types.Transaction) error

func (*CphAPIBackend) ServiceFilter

func (b *CphAPIBackend) ServiceFilter(ctx context.Context, session *bloombits.MatcherSession)

func (*CphAPIBackend) SetHead

func (b *CphAPIBackend) SetHead(number uint64)

func (*CphAPIBackend) StateAndHeaderByNumber

func (b *CphAPIBackend) StateAndHeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*state.StateDB, *types.Header, error)

func (*CphAPIBackend) Stats

func (b *CphAPIBackend) Stats() (pending int, queued int)

func (*CphAPIBackend) SubscribeChainEvent

func (b *CphAPIBackend) SubscribeChainEvent(ch chan<- core.ChainEvent) event.Subscription

func (*CphAPIBackend) SubscribeChainHeadEvent

func (b *CphAPIBackend) SubscribeChainHeadEvent(ch chan<- core.ChainHeadEvent) event.Subscription

func (*CphAPIBackend) SubscribeKeyChainHeadEvent

func (b *CphAPIBackend) SubscribeKeyChainHeadEvent(ch chan<- core.KeyChainHeadEvent) event.Subscription

func (*CphAPIBackend) SubscribeLatestTPSEvent

func (b *CphAPIBackend) SubscribeLatestTPSEvent(ch chan<- uint64) event.Subscription

func (*CphAPIBackend) SubscribeLogsEvent

func (b *CphAPIBackend) SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscription

func (*CphAPIBackend) SubscribeNewTxsEvent

func (b *CphAPIBackend) SubscribeNewTxsEvent(ch chan<- core.NewTxsEvent) event.Subscription

func (*CphAPIBackend) SubscribeRemovedLogsEvent

func (b *CphAPIBackend) SubscribeRemovedLogsEvent(ch chan<- core.RemovedLogsEvent) event.Subscription

func (*CphAPIBackend) SuggestPrice

func (b *CphAPIBackend) SuggestPrice(ctx context.Context) (*big.Int, error)

func (*CphAPIBackend) TakePartInNumberList

func (b *CphAPIBackend) TakePartInNumberList(address common.Address, blockNumber rpc.BlockNumber) []string

func (*CphAPIBackend) TxPoolContent

type Cypherium

type Cypherium struct {
	APIBackend *CphAPIBackend
	// contains filtered or unexported fields
}

Cypherium implements the Cypherium full node service.

func New

func New(ctx *node.ServiceContext, config *Config) (*Cypherium, error)

New creates a new Cypherium object (including the initialisation of the common Cypherium object)

func (*Cypherium) APIs

func (s *Cypherium) APIs() []rpc.API

APIs return the collection of RPC services the cypherium package offers. NOTE, some of these services probably need to be moved to somewhere else.

func (*Cypherium) AccountManager

func (s *Cypherium) AccountManager() *accounts.Manager

func (*Cypherium) AddLesServer

func (s *Cypherium) AddLesServer(ls LesServer)

func (*Cypherium) BlockChain

func (s *Cypherium) BlockChain() *core.BlockChain

func (*Cypherium) CandidatePool

func (s *Cypherium) CandidatePool() *core.CandidatePool

func (*Cypherium) ChainDb

func (s *Cypherium) ChainDb() cphdb.Database

func (*Cypherium) Coinbase

func (s *Cypherium) Coinbase() (eb common.Address, err error)

func (*Cypherium) Downloader

func (s *Cypherium) Downloader() *downloader.Downloader

func (*Cypherium) Engine

func (s *Cypherium) Engine() pow.Engine

func (*Cypherium) EthVersion

func (s *Cypherium) EthVersion() int

func (*Cypherium) EventMux

func (s *Cypherium) EventMux() *event.TypeMux

func (*Cypherium) Exceptions

func (s *Cypherium) Exceptions(blockNumber int64) []string

func (*Cypherium) ExtIP

func (s *Cypherium) ExtIP() net.IP

func (*Cypherium) IsListening

func (s *Cypherium) IsListening() bool

func (*Cypherium) IsMining

func (s *Cypherium) IsMining() bool

func (*Cypherium) KeyBlockChain

func (s *Cypherium) KeyBlockChain() *core.KeyBlockChain

func (*Cypherium) LatestTPSMeter

func (s *Cypherium) LatestTPSMeter()

func (*Cypherium) Miner

func (s *Cypherium) Miner() *miner.Miner

func (*Cypherium) NetVersion

func (s *Cypherium) NetVersion() uint64

func (*Cypherium) Protocols

func (s *Cypherium) Protocols() []p2p.Protocol

Protocols implements node.Service, returning all the currently configured network protocols to start.

func (*Cypherium) PublicKey

func (s *Cypherium) PublicKey() ed25519.PublicKey

func (*Cypherium) Reconfig

func (s *Cypherium) Reconfig() *reconfig.Reconfig

func (*Cypherium) ResetWithGenesisBlock

func (s *Cypherium) ResetWithGenesisBlock(gb *types.Block)

func (*Cypherium) Start

func (s *Cypherium) Start(srvr *p2p.Server) error

Start implements node.Service, starting all internal goroutines needed by the Cypherium protocol implementation.

func (*Cypherium) StartMining

func (s *Cypherium) StartMining(local bool, eb common.Address, pubKey ed25519.PublicKey) error

func (*Cypherium) Stop

func (s *Cypherium) Stop() error

Stop implements node.Service, terminating all internal goroutines used by the Cypherium protocol.

func (*Cypherium) StopMining

func (s *Cypherium) StopMining()

func (*Cypherium) SubscribeLatestTPSEvent

func (s *Cypherium) SubscribeLatestTPSEvent(ch chan<- uint64) event.Subscription

func (*Cypherium) TakePartInNumberList

func (s *Cypherium) TakePartInNumberList(address common.Address, backCheckNumber rpc.BlockNumber) []string

func (*Cypherium) TxPool

func (s *Cypherium) TxPool() *core.TxPool

type LesServer

type LesServer interface {
	Start(srvr *p2p.Server)
	Stop()
	Protocols() []p2p.Protocol
	SetBloomBitsIndexer(bbIndexer *core.ChainIndexer)
}

type NodeInfo

type NodeInfo struct {
	Network         uint64              `json:"network"`         // Cypherium network ID (1=Frontier, 2=Morden, Ropsten=3, Rinkeby=4)
	KeyBlockTd      *big.Int            `json:"keyBlockTd"`      // Total difficulty of the host's key blockchain
	KeyBlockGenesis common.Hash         `json:"keyBlockGenesis"` // SHA3 hash of the host's genesis key block
	Config          *params.ChainConfig `json:"config"`          // Chain configuration for the fork rules
	KeyBlockHead    common.Hash         `json:"keyBlockHead"`    // SHA3 hash of the host's best owned key block
	TxBlockHead     common.Hash         `json:"txBlockHead"`     // SHA3 hash of the host's best owned tx block
	TxBlockHeight   *big.Int            `json:"txBlockHeight"`   // Height of tx block chain
}

NodeInfo represents a short summary of the Cypherium sub-protocol metadata known about the host peer.

type PeerInfo

type PeerInfo struct {
	Version   int      `json:"version"`        // Cypherium protocol version negotiated
	KeyHead   string   `json:"keyHead"`        // SHA3 hash of the peer's best key block
	KeyHeight *big.Int `json:"keyBlockHeight"` // Height of peer's key block chain
	TxHead    string   `json:"txHead"`         // SHA3 hash of the peer's best tx block
	TxHeight  *big.Int `json:"txBlockHeight"`  // Height of peer's tx block chain

}

PeerInfo represents a short summary of the Cypherium sub-protocol metadata known about a connected peer.

type PrivateAdminAPI

type PrivateAdminAPI struct {
	// contains filtered or unexported fields
}

PrivateAdminAPI is the collection of Cypherium full node-related APIs exposed over the private admin endpoint.

func NewPrivateAdminAPI

func NewPrivateAdminAPI(cph *Cypherium) *PrivateAdminAPI

NewPrivateAdminAPI creates a new API definition for the full node private admin methods of the Cypherium 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 Cypherium full node APIs exposed over the private debugging endpoint.

func NewPrivateDebugAPI

func NewPrivateDebugAPI(config *params.ChainConfig, cph *Cypherium) *PrivateDebugAPI

NewPrivateDebugAPI creates a new API definition for the full node-related private debug methods of the Cypherium service.

func (*PrivateDebugAPI) GetBadBlocks

func (api *PrivateDebugAPI) GetBadBlocks(ctx context.Context) ([]*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)

GetModifiedAccountsByNumber 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

func (api *PrivateDebugAPI) Preimage(ctx context.Context, hash common.Hash) (hexutil.Bytes, error)

Preimage is a debug API function that returns the preimage for a sha3 hash, if known.

func (*PrivateDebugAPI) StorageRangeAt

func (api *PrivateDebugAPI) StorageRangeAt(ctx context.Context, blockHash common.Hash, txIndex int, contractAddress common.Address, keyStart hexutil.Bytes, maxResult int) (StorageRangeResult, error)

StorageRangeAt returns the storage at the given block height and transaction index.

func (*PrivateDebugAPI) TraceBlock

func (api *PrivateDebugAPI) TraceBlock(ctx context.Context, blob []byte, 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 *Cypherium) *PrivateMinerAPI

NewPrivateMinerAPI create a new RPC service which controls the miner of this node.

func (*PrivateMinerAPI) Start

func (api *PrivateMinerAPI) Start(threads *int, addr common.Address, password string) 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 (*PrivateMinerAPI) Status

func (api *PrivateMinerAPI) Status() string

func (*PrivateMinerAPI) Stop

func (api *PrivateMinerAPI) Stop() bool

Stop the miner

type PrivateReconfigAPI

type PrivateReconfigAPI struct {
	// contains filtered or unexported fields
}

PrivateReconfigAPI

func NewPrivateReconfigAPI

func NewPrivateReconfigAPI(e *Cypherium) *PrivateReconfigAPI

NewPrivateMinerAPI

func (*PrivateReconfigAPI) Start

func (api *PrivateReconfigAPI) Start(threads *int, addr common.Address) error

Start .

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 pow.Engine, blockchain *core.BlockChain, keyBlockChain *core.KeyBlockChain, reconfg *reconfig.Reconfig, chaindb cphdb.Database, candidatePool *core.CandidatePool) (*ProtocolManager, error)

NewProtocolManager returns a new Cypherium sub protocol manager. The Cypherium sub protocol manages peers capable with the Cypherium network.

func (*ProtocolManager) AddNewMinedBlock

func (pm *ProtocolManager) AddNewMinedBlock(block *types.Block)

func (*ProtocolManager) BroadcastBlock

func (pm *ProtocolManager) BroadcastBlock(block *types.Block, propagate bool)

BroadcastBlock will either propagate a block to a subset of it's peers, or will only announce it's availability (depending what's requested).

func (*ProtocolManager) BroadcastCandidate

func (pm *ProtocolManager) BroadcastCandidate(candidate *types.Candidate)

func (*ProtocolManager) BroadcastKeyBlock

func (pm *ProtocolManager) BroadcastKeyBlock(block *types.KeyBlock, propagate bool)

BroadcastKeyBlock will either propagate a block to a subset of it's peers, or will only announce it's availability (depending what's requested).

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) NodeInfo

func (pm *ProtocolManager) NodeInfo() *NodeInfo

NodeInfo retrieves some protocol metadata about the running host node.

func (*ProtocolManager) Start

func (pm *ProtocolManager) Start(maxPeers int)

func (*ProtocolManager) Stop

func (pm *ProtocolManager) Stop()

type PublicCphereumAPI

type PublicCphereumAPI struct {
	// contains filtered or unexported fields
}

PublicCphereumAPI provides an API to access Cypherium full node-related information.

func NewPublicCphereumAPI

func NewPublicCphereumAPI(e *Cypherium) *PublicCphereumAPI

NewPublicCphereumAPI creates a new Cypherium protocol API for full nodes.

func (*PublicCphereumAPI) Coinbase

func (api *PublicCphereumAPI) Coinbase() (common.Address, error)

Coinbase is the address that mining rewards will be send to

func (*PublicCphereumAPI) Exceptions

func (api *PublicCphereumAPI) Exceptions(blockNumber int64) []string

func (*PublicCphereumAPI) Hashrate

func (api *PublicCphereumAPI) Hashrate() hexutil.Uint64

Hashrate returns the POW hashrate

func (*PublicCphereumAPI) Status

func (api *PublicCphereumAPI) Status() string

func (*PublicCphereumAPI) TakePartInNumberList

func (api *PublicCphereumAPI) TakePartInNumberList(address common.Address, blockNumber rpc.BlockNumber) []string

type PublicDebugAPI

type PublicDebugAPI struct {
	// contains filtered or unexported fields
}

PublicDebugAPI is the collection of Cypherium full node APIs exposed over the public debugging endpoint.

func NewPublicDebugAPI

func NewPublicDebugAPI(cph *Cypherium) *PublicDebugAPI

NewPublicDebugAPI creates a new API definition for the full node- related public debug methods of the Cypherium 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 StorageRangeResult

type StorageRangeResult struct {
	Storage storageMap   `json:"storage"`
	NextKey *common.Hash `json:"nextKey"` // nil if Storage includes the last key in the trie.
}

StorageRangeResult is the result of a debug_storageRangeAt API call.

type TraceConfig

type TraceConfig struct {
	*vm.LogConfig
	Tracer  *string
	Timeout *string
	Reexec  *uint64
}

TraceConfig holds extra parameters to trace functions.

Directories

Path Synopsis
Package downloader contains the manual full chain synchronisation.
Package downloader contains the manual full chain synchronisation.
Package fetcher contains the block announcement based synchronisation.
Package fetcher contains the block announcement based synchronisation.
Package filters implements an cypherium filtering system for block, transactions and log events.
Package filters implements an cypherium filtering system for block, transactions and log events.
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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL