node

package
v2.3.0-rc10 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: BSD-3-Clause Imports: 112 Imported by: 2

Documentation

Overview

Package node defines the concept of a Bee node by bootstrapping and injecting all necessary dependencies.

Index

Constants

View Source
const LoggerName = "node"

LoggerName is the tree path name of the logger for this package.

Variables

View Source
var ErrShutdownInProgress error = errors.New("shutdown in progress")

Functions

func GetTxHash

func GetTxHash(stateStore storage.StateStorer, logger log.Logger, trxString string) ([]byte, error)

func GetTxNextBlock

func GetTxNextBlock(ctx context.Context, logger log.Logger, backend transaction.Backend, monitor transaction.Monitor, duration time.Duration, trx []byte, blockHash string) ([]byte, error)

func InitChain

func InitChain(
	ctx context.Context,
	logger log.Logger,
	stateStore storage.StateStorer,
	endpoint string,
	oChainID int64,
	signer crypto.Signer,
	pollingInterval time.Duration,
	chainEnabled bool,
) (transaction.Backend, common.Address, int64, transaction.Monitor, transaction.Service, error)

InitChain will initialize the Ethereum backend at the given endpoint and set up the Transaction Service to interact with it using the provided signer.

func InitChequebookFactory

func InitChequebookFactory(logger log.Logger, backend transaction.Backend, chainID int64, transactionService transaction.Service, factoryAddress string) (chequebook.Factory, error)

InitChequebookFactory will initialize the chequebook factory with the given chain backend.

func InitChequebookService

func InitChequebookService(
	ctx context.Context,
	logger log.Logger,
	stateStore storage.StateStorer,
	signer crypto.Signer,
	chainID int64,
	backend transaction.Backend,
	overlayEthAddress common.Address,
	transactionService transaction.Service,
	chequebookFactory chequebook.Factory,
	initialDeposit string,
	deployGasPrice string,
	erc20Service erc20.Service,
) (chequebook.Service, error)

InitChequebookService will initialize the chequebook service with the given chequebook factory and chain backend.

func InitStamperStore

func InitStamperStore(logger log.Logger, dataDir string, stateStore storage.StateStorer) (storage.Store, error)

InitStamperStore will create new stamper store with the given path to the data directory. When given an empty directory path, the function will instead initialize an in-memory state store that will not be persisted.

func InitStateStore

func InitStateStore(logger log.Logger, dataDir string, cacheCapacity uint64) (storage.StateStorerManager, metrics.Collector, error)

InitStateStore will initialize the stateStore with the given path to the data directory. When given an empty directory path, the function will instead initialize an in-memory state store that will not be persisted.

func InitSwap

func InitSwap(
	p2ps *libp2p.Service,
	logger log.Logger,
	stateStore storage.StateStorer,
	networkID uint64,
	overlayEthAddress common.Address,
	chequebookService chequebook.Service,
	chequeStore chequebook.ChequeStore,
	cashoutService chequebook.CashoutService,
	accounting settlement.Accounting,
	priceOracleAddress string,
	chainID int64,
	transactionService transaction.Service,
) (*swap.Service, priceoracle.Service, error)

InitSwap will initialize and register the swap service.

Types

type Bee

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

func NewBee

func NewBee(
	ctx context.Context,
	addr string,
	publicKey *ecdsa.PublicKey,
	signer crypto.Signer,
	networkID uint64,
	logger log.Logger,
	libp2pPrivateKey,
	pssPrivateKey *ecdsa.PrivateKey,
	session accesscontrol.Session,
	o *Options,
) (b *Bee, err error)

func (*Bee) Shutdown

func (b *Bee) Shutdown() error

func (*Bee) SyncingStopped

func (b *Bee) SyncingStopped() chan struct{}

type DevBee

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

func NewDevBee

func NewDevBee(logger log.Logger, o *DevOptions) (b *DevBee, err error)

NewDevBee starts the bee instance in 'development' mode this implies starting an API and a Debug endpoints while mocking all their services.

func (*DevBee) Shutdown

func (b *DevBee) Shutdown() error

type DevOptions

type DevOptions struct {
	Logger                   log.Logger
	APIAddr                  string
	CORSAllowedOrigins       []string
	DBOpenFilesLimit         uint64
	ReserveCapacity          uint64
	DBWriteBufferSize        uint64
	DBBlockCacheCapacity     uint64
	DBDisableSeeksCompaction bool
}

type Options

type Options struct {
	DataDir                       string
	CacheCapacity                 uint64
	DBOpenFilesLimit              uint64
	DBWriteBufferSize             uint64
	DBBlockCacheCapacity          uint64
	DBDisableSeeksCompaction      bool
	APIAddr                       string
	Addr                          string
	NATAddr                       string
	EnableWS                      bool
	WelcomeMessage                string
	Bootnodes                     []string
	CORSAllowedOrigins            []string
	Logger                        log.Logger
	TracingEnabled                bool
	TracingEndpoint               string
	TracingServiceName            string
	PaymentThreshold              string
	PaymentTolerance              int64
	PaymentEarly                  int64
	ResolverConnectionCfgs        []multiresolver.ConnectionConfig
	RetrievalCaching              bool
	BootnodeMode                  bool
	BlockchainRpcEndpoint         string
	SwapFactoryAddress            string
	SwapInitialDeposit            string
	SwapEnable                    bool
	ChequebookEnable              bool
	FullNodeMode                  bool
	PostageContractAddress        string
	PostageContractStartBlock     uint64
	StakingContractAddress        string
	PriceOracleAddress            string
	RedistributionContractAddress string
	BlockTime                     time.Duration
	DeployGasPrice                string
	WarmupTime                    time.Duration
	ChainID                       int64
	Resync                        bool
	BlockProfile                  bool
	MutexProfile                  bool
	StaticNodes                   []swarm.Address
	AllowPrivateCIDRs             bool
	UsePostageSnapshot            bool
	EnableStorageIncentives       bool
	StatestoreCacheCapacity       uint64
	TargetNeighborhood            string
	NeighborhoodSuggester         string
	WhitelistedWithdrawalAddress  []string
	TrxDebugMode                  bool
	MinimumStorageRadius          uint
	ReserveCapacityDoubling       int
}

Jump to

Keyboard shortcuts

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