server

package
v2.11.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: BSD-2-Clause Imports: 64 Imported by: 0

Documentation

Overview

Copyright (c) 2023-2024 Nibi, Inc.

Copyright (c) 2023-2024 Nibi, Inc.

Index

Constants

View Source
const (
	EVMTxIndexerServiceName = "EVMTxIndexerService"

	NewBlockWaitTimeout = 60 * time.Second
)
View Source
const (
	WithTendermint = "with-tendermint"
	Address        = "address"
	Transport      = "transport"
	TraceStore     = "trace-store"
	CPUProfile     = "cpu-profile"
	// The type of database for application and snapshots databases
	AppDBBackend = "app-db-backend"
)

Tendermint/cosmos-sdk full-node start flags

View Source
const (
	GRPCOnly       = "grpc-only"
	GRPCEnable     = "grpc.enable"
	GRPCAddress    = "grpc.address"
	GRPCWebEnable  = "grpc-web.enable"
	GRPCWebAddress = "grpc-web.address"
)

GRPC-related flags.

View Source
const (
	RPCEnable         = "api.enable"
	EnabledUnsafeCors = "api.enabled-unsafe-cors"
)

Cosmos API flags

View Source
const (
	JSONRPCEnable              = "json-rpc.enable"
	JSONRPCAPI                 = "json-rpc.api"
	JSONRPCAddress             = "json-rpc.address"
	JSONWsAddress              = "json-rpc.ws-address"
	JSONRPCGasCap              = "json-rpc.gas-cap"
	JSONRPCEVMTimeout          = "json-rpc.evm-timeout"
	JSONRPCTxFeeCap            = "json-rpc.txfee-cap"
	JSONRPCFilterCap           = "json-rpc.filter-cap"
	JSONRPCLogsCap             = "json-rpc.logs-cap"
	JSONRPCBlockRangeCap       = "json-rpc.block-range-cap"
	JSONRPCHTTPTimeout         = "json-rpc.http-timeout"
	JSONRPCHTTPIdleTimeout     = "json-rpc.http-idle-timeout"
	JSONRPCAllowUnprotectedTxs = "json-rpc.allow-unprotected-txs"
	JSONRPCMaxOpenConnections  = "json-rpc.max-open-connections"
	JSONRPCEnableIndexer       = "json-rpc.enable-indexer"
	JSONRPCEnableMetrics       = "metrics"
)

JSON-RPC flags

View Source
const (
	EVMTracer         = "evm.tracer"
	EVMMaxTxGasWanted = "evm.max-tx-gas-wanted"
)

EVM flags

View Source
const (
	TLSCertPath = "tls.certificate-path"
	TLSKeyPath  = "tls.key-path"
)

TLS flags

Variables

This section is empty.

Functions

func AddCommands

func AddCommands(
	rootCmd *cobra.Command,
	opts StartOptions,
	appExport types.AppExporter,
	addStartFlags types.ModuleInitFlags,
)

AddCommands adds server commands

func AddTxFlags

func AddTxFlags(cmd *cobra.Command) (*cobra.Command, error)

AddTxFlags adds common flags for commands to post tx

func ConnectTmWS

func ConnectTmWS(tmRPCAddr, tmEndpoint string, logger tmlog.Logger) *rpcclient.WSClient

func Listen

func Listen(addr string, config *srvconfig.Config) (net.Listener, error)

Listen starts a net.Listener on the tcp network on the given address. If there is a specified MaxOpenConnections in the config, it will also set the limitListener.

func NewEVMTxIndexCmd

func NewEVMTxIndexCmd() *cobra.Command

func OpenIndexerDB

func OpenIndexerDB(rootDir string, backendType dbm.BackendType) (dbm.DB, error)

OpenIndexerDB opens the custom eth indexer db, using the same db backend as the main app

func StartCmd

func StartCmd(opts StartOptions) *cobra.Command

StartCmd runs the service passed in, either stand-alone or in-process with Tendermint.

func StartEthereumJSONRPC added in v2.5.0

func StartEthereumJSONRPC(
	ctx *server.Context,
	clientCtx client.Context,
	tmRPCAddr,
	tmEndpoint string,
	config *srvconfig.Config,
	indexer eth.EVMTxIndexer,
) (*http.Server, chan struct{}, error)

StartEthereumJSONRPC starts the Ethereum JSON-RPC server and websocket server for Nibiru.

func WaitForQuitSignals

func WaitForQuitSignals() sdkserver.ErrorCode

WaitForQuitSignals waits for SIGINT and SIGTERM and returns.

Types

type EVMTxIndexerService

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

EVMTxIndexerService indexes transactions for json-rpc service.

func NewEVMIndexerService

func NewEVMIndexerService(evmTxIndexer *indexer.EVMTxIndexer, rpcClient cmtrpcclient.Client) *EVMTxIndexerService

NewEVMIndexerService returns a new service instance.

func OpenEVMIndexer

func OpenEVMIndexer(
	ctx *sdkserver.Context, indexerDb dbm.DB, clientCtx client.Context,
) (eth.EVMTxIndexer, *EVMTxIndexerService, error)

func (*EVMTxIndexerService) OnStart

func (service *EVMTxIndexerService) OnStart() error

OnStart implements service.Service by subscribing for new blocks and indexing them by events.

func (*EVMTxIndexerService) OnStop

func (service *EVMTxIndexerService) OnStop()

type LogHandler added in v2.4.0

type LogHandler struct {
	CmtLogger cmtlog.Logger
	// contains filtered or unexported fields
}

LogHandler implements slog.Handler, which is needed to construct the conventional go-ethereum.Logger, using a CometBFT logger ("github.com/cometbft/cometbft/libs/log".Logger).

func (*LogHandler) Enabled added in v2.4.0

func (h *LogHandler) Enabled(_ context.Context, level slog.Level) bool

Enabled decides whether a log record should be processed. We let the underlying CometBFT logger handle filtering.

func (*LogHandler) Handle added in v2.4.0

func (h *LogHandler) Handle(_ context.Context, r slog.Record) error

Handle processes the log record and sends it to the CometBFT logger.

func (*LogHandler) WithAttrs added in v2.4.0

func (h *LogHandler) WithAttrs(attrs []slog.Attr) slog.Handler

WithAttrs returns a new LogHandler with the provided attributes added.

func (*LogHandler) WithGroup added in v2.4.0

func (h *LogHandler) WithGroup(name string) slog.Handler

WithGroup returns a new LogHandler associated with the specified group.

type StartOptions

type StartOptions struct {
	AppCreator      types.AppCreator
	DefaultNodeHome string
}

StartOptions defines options that can be customized in `StartCmd`

func NewDefaultStartOptions

func NewDefaultStartOptions(appCreator types.AppCreator, defaultNodeHome string) StartOptions

NewDefaultStartOptions use the default db opener provided in tm-db.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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