tendermint: github.com/tendermint/tendermint/node Index | Files

package node

import "github.com/tendermint/tendermint/node"

Package node is the main entry point, where the Node struct, which represents a full node, is defined.

Adding new p2p.Reactor(s)

To add a new p2p.Reactor, use the CustomReactors option:

node, err := NewNode(
		config,
		privVal,
		nodeKey,
		clientCreator,
		genesisDocProvider,
		dbProvider,
		metricsProvider,
		logger,
		CustomReactors(map[string]p2p.Reactor{"CUSTOM": customReactor}),
)

Replacing existing p2p.Reactor(s)

To replace the built-in p2p.Reactor, use the CustomReactors option:

node, err := NewNode(
		config,
		privVal,
		nodeKey,
		clientCreator,
		genesisDocProvider,
		dbProvider,
		metricsProvider,
		logger,
		CustomReactors(map[string]p2p.Reactor{"BLOCKCHAIN": customBlockchainReactor}),
)

The list of existing reactors can be found in CustomReactors documentation.

Index

Package Files

doc.go id.go node.go

func DefaultDBProvider Uses

func DefaultDBProvider(ctx *DBContext) (dbm.DB, error)

DefaultDBProvider returns a database using the DBBackend and DBDir specified in the ctx.Config.

func LoadStateFromDBOrGenesisDocProvider Uses

func LoadStateFromDBOrGenesisDocProvider(
    stateDB dbm.DB,
    genesisDocProvider GenesisDocProvider,
) (sm.State, *types.GenesisDoc, error)

LoadStateFromDBOrGenesisDocProvider attempts to load the state from the database, or creates one using the given genesisDocProvider and persists the result to the database. On success this also returns the genesis doc loaded through the given provider.

type DBContext Uses

type DBContext struct {
    ID     string
    Config *cfg.Config
}

DBContext specifies config information for loading a new DB.

type DBProvider Uses

type DBProvider func(*DBContext) (dbm.DB, error)

DBProvider takes a DBContext and returns an instantiated DB.

type GenesisDocProvider Uses

type GenesisDocProvider func() (*types.GenesisDoc, error)

GenesisDocProvider returns a GenesisDoc. It allows the GenesisDoc to be pulled from sources other than the filesystem, for instance from a distributed key-value store cluster.

func DefaultGenesisDocProviderFunc Uses

func DefaultGenesisDocProviderFunc(config *cfg.Config) GenesisDocProvider

DefaultGenesisDocProviderFunc returns a GenesisDocProvider that loads the GenesisDoc from the config.GenesisFile() on the filesystem.

type Greeting Uses

type Greeting struct {
    ID
    Version string
    ChainID string
    Message string
    Time    time.Time
}

type ID Uses

type ID struct {
    Name   string
    PubKey crypto.PubKey
}

type MetricsProvider Uses

type MetricsProvider func(chainID string) (*cs.Metrics, *p2p.Metrics, *mempl.Metrics, *sm.Metrics)

MetricsProvider returns a consensus, p2p and mempool Metrics.

func DefaultMetricsProvider Uses

func DefaultMetricsProvider(config *cfg.InstrumentationConfig) MetricsProvider

DefaultMetricsProvider returns Metrics build using Prometheus client library if Prometheus is enabled. Otherwise, it returns no-op Metrics.

type Node Uses

type Node struct {
    service.BaseService
    // contains filtered or unexported fields
}

Node is the highest level interface to a full Tendermint node. It includes all configuration information and running services.

func DefaultNewNode Uses

func DefaultNewNode(config *cfg.Config, logger log.Logger) (*Node, error)

DefaultNewNode returns a Tendermint node with default settings for the PrivValidator, ClientCreator, GenesisDoc, and DBProvider. It implements NodeProvider.

func NewNode Uses

func NewNode(config *cfg.Config,
    privValidator types.PrivValidator,
    nodeKey *p2p.NodeKey,
    clientCreator proxy.ClientCreator,
    genesisDocProvider GenesisDocProvider,
    dbProvider DBProvider,
    metricsProvider MetricsProvider,
    logger log.Logger,
    options ...Option) (*Node, error)

NewNode returns a new, ready to go, Tendermint Node.

func (*Node) BlockStore Uses

func (n *Node) BlockStore() *store.BlockStore

BlockStore returns the Node's BlockStore.

func (*Node) Config Uses

func (n *Node) Config() *cfg.Config

Config returns the Node's config.

func (*Node) ConfigureRPC Uses

func (n *Node) ConfigureRPC() error

ConfigureRPC makes sure RPC has all the objects it needs to operate.

func (*Node) ConsensusReactor Uses

func (n *Node) ConsensusReactor() *cs.Reactor

ConsensusReactor returns the Node's ConsensusReactor.

func (*Node) ConsensusState Uses

func (n *Node) ConsensusState() *cs.State

ConsensusState returns the Node's ConsensusState.

func (*Node) EventBus Uses

func (n *Node) EventBus() *types.EventBus

EventBus returns the Node's EventBus.

func (*Node) EvidencePool Uses

func (n *Node) EvidencePool() *evidence.Pool

EvidencePool returns the Node's EvidencePool.

func (*Node) GenesisDoc Uses

func (n *Node) GenesisDoc() *types.GenesisDoc

GenesisDoc returns the Node's GenesisDoc.

func (*Node) IsListening Uses

func (n *Node) IsListening() bool

func (*Node) Listeners Uses

func (n *Node) Listeners() []string

func (*Node) Mempool Uses

func (n *Node) Mempool() mempl.Mempool

Mempool returns the Node's mempool.

func (*Node) MempoolReactor Uses

func (n *Node) MempoolReactor() *mempl.Reactor

MempoolReactor returns the Node's mempool reactor.

func (*Node) NodeInfo Uses

func (n *Node) NodeInfo() p2p.NodeInfo

NodeInfo returns the Node's Info from the Switch.

func (*Node) OnStart Uses

func (n *Node) OnStart() error

OnStart starts the Node. It implements service.Service.

func (*Node) OnStop Uses

func (n *Node) OnStop()

OnStop stops the Node. It implements service.Service.

func (*Node) PEXReactor Uses

func (n *Node) PEXReactor() *pex.Reactor

PEXReactor returns the Node's PEXReactor. It returns nil if PEX is disabled.

func (*Node) PrivValidator Uses

func (n *Node) PrivValidator() types.PrivValidator

PrivValidator returns the Node's PrivValidator. XXX: for convenience only!

func (*Node) ProxyApp Uses

func (n *Node) ProxyApp() proxy.AppConns

ProxyApp returns the Node's AppConns, representing its connections to the ABCI application.

func (*Node) Switch Uses

func (n *Node) Switch() *p2p.Switch

Switch returns the Node's Switch.

type Option Uses

type Option func(*Node)

Option sets a parameter for the node.

func CustomReactors Uses

func CustomReactors(reactors map[string]p2p.Reactor) Option

CustomReactors allows you to add custom reactors (name -> p2p.Reactor) to the node's Switch.

WARNING: using any name from the below list of the existing reactors will result in replacing it with the custom one.

- MEMPOOL
- BLOCKCHAIN
- CONSENSUS
- EVIDENCE
- PEX
- STATESYNC

func StateProvider Uses

func StateProvider(stateProvider statesync.StateProvider) Option

StateProvider overrides the state provider used by state sync to retrieve trusted app hashes and build a State object for bootstrapping the node. WARNING: this interface is considered unstable and subject to change.

type PrivNodeID Uses

type PrivNodeID struct {
    ID
    PrivKey crypto.PrivKey
}

func (*PrivNodeID) SignGreeting Uses

func (pnid *PrivNodeID) SignGreeting() *SignedNodeGreeting

type Provider Uses

type Provider func(*cfg.Config, log.Logger) (*Node, error)

Provider takes a config and a logger and returns a ready to go Node.

type SignedNodeGreeting Uses

type SignedNodeGreeting struct {
    Greeting
    Signature []byte
}

Package node imports 43 packages (graph) and is imported by 72 packages. Updated 2020-07-01. Refresh now. Tools for package owners.