Documentation
¶
Index ¶
- func NewBadgerDatabase(luxDB database.Database, config BadgerDatabaseConfig) (ethdb.Database, error)
- func SlurpIntoAncient(sourceDB ethdb.Database, targetPath string, startBlock, endBlock uint64) error
- func WrapDatabase(db database.Database) ethdb.Database
- type BadgerDatabaseConfig
- type BatchWrapper
- func (b *BatchWrapper) Delete(key []byte) error
- func (b *BatchWrapper) DeleteRange(start, end []byte) error
- func (b *BatchWrapper) Put(key []byte, value []byte) error
- func (b *BatchWrapper) Replay(w ethdb.KeyValueWriter) error
- func (b *BatchWrapper) Reset()
- func (b *BatchWrapper) ValueSize() int
- func (b *BatchWrapper) Write() error
- type Block
- func (b *Block) Accept(ctx context.Context) error
- func (b *Block) Bytes() []byte
- func (b *Block) Height() uint64
- func (b *Block) ID() ids.ID
- func (b *Block) Parent() ids.ID
- func (b *Block) Reject(ctx context.Context) error
- func (b *Block) Status() choices.Status
- func (b *Block) Timestamp() time.Time
- func (b *Block) Verify(ctx context.Context) error
- type DatabaseWrapper
- func (d *DatabaseWrapper) Ancient(kind string, number uint64) ([]byte, error)
- func (d *DatabaseWrapper) AncientDatadir() (string, error)
- func (d *DatabaseWrapper) AncientRange(kind string, start, count, maxBytes uint64) ([][]byte, error)
- func (d *DatabaseWrapper) AncientSize(kind string) (uint64, error)
- func (d *DatabaseWrapper) Ancients() (uint64, error)
- func (d *DatabaseWrapper) Close() error
- func (d *DatabaseWrapper) Compact(start []byte, limit []byte) error
- func (d *DatabaseWrapper) Delete(key []byte) error
- func (d *DatabaseWrapper) DeleteRange(start, end []byte) error
- func (d *DatabaseWrapper) Get(key []byte) ([]byte, error)
- func (d *DatabaseWrapper) Has(key []byte) (bool, error)
- func (d *DatabaseWrapper) MigrateTable(string, func([]byte) ([]byte, error)) error
- func (d *DatabaseWrapper) ModifyAncients(fn func(ethdb.AncientWriteOp) error) (int64, error)
- func (d *DatabaseWrapper) NewBatch() ethdb.Batch
- func (d *DatabaseWrapper) NewBatchWithSize(size int) ethdb.Batch
- func (d *DatabaseWrapper) NewIterator(prefix []byte, start []byte) ethdb.Iterator
- func (d *DatabaseWrapper) Put(key []byte, value []byte) error
- func (d *DatabaseWrapper) ReadAncients(fn func(ethdb.AncientReaderOp) error) (err error)
- func (d *DatabaseWrapper) Stat() (string, error)
- func (d *DatabaseWrapper) Sync() error
- func (d *DatabaseWrapper) SyncAncient() error
- func (d *DatabaseWrapper) SyncKeyValue() error
- func (d *DatabaseWrapper) Tail() (uint64, error)
- func (d *DatabaseWrapper) TruncateHead(n uint64) (uint64, error)
- func (d *DatabaseWrapper) TruncateTail(n uint64) (uint64, error)
- type EthAPI
- func (api *EthAPI) BlockNumber() (hexutil.Uint64, error)
- func (api *EthAPI) ChainId() (*hexutil.Big, error)
- func (api *EthAPI) EstimateGas(ctx context.Context, args TransactionArgs, ...) (hexutil.Uint64, error)
- func (api *EthAPI) GasPrice(ctx context.Context) (*hexutil.Big, error)
- func (api *EthAPI) GetBalance(ctx context.Context, address common.Address, ...) (*hexutil.Big, error)
- func (api *EthAPI) GetBlockByHash(ctx context.Context, hash common.Hash, fullTx bool) (map[string]interface{}, error)
- func (api *EthAPI) GetBlockByNumber(ctx context.Context, number rpc.BlockNumber, fullTx bool) (map[string]interface{}, error)
- func (api *EthAPI) GetCode(ctx context.Context, address common.Address, ...) (hexutil.Bytes, error)
- func (api *EthAPI) GetTransactionByHash(ctx context.Context, hash common.Hash) (*RPCTransaction, error)
- func (api *EthAPI) GetTransactionCount(ctx context.Context, address common.Address, ...) (*hexutil.Uint64, error)
- func (api *EthAPI) GetTransactionReceipt(ctx context.Context, hash common.Hash) (map[string]interface{}, error)
- func (api *EthAPI) SendRawTransaction(ctx context.Context, input hexutil.Bytes) (common.Hash, error)
- type Factory
- type IteratorWrapper
- type MinimalEthBackend
- func NewMigratedBackend(db ethdb.Database, migratedHeight uint64) (*MinimalEthBackend, error)
- func NewMinimalEthBackend(db ethdb.Database, config *ethconfig.Config, genesis *gethcore.Genesis) (*MinimalEthBackend, error)
- func NewMinimalEthBackendForMigration(db ethdb.Database, config *ethconfig.Config, genesis *gethcore.Genesis, ...) (*MinimalEthBackend, error)
- type NetAPI
- type RPCTransaction
- type TransactionArgs
- type VM
- func (vm *VM) AppGossip(ctx context.Context, nodeID ids.NodeID, msg []byte) error
- func (vm *VM) AppRequest(ctx context.Context, nodeID ids.NodeID, requestID uint32, deadline time.Time, ...) error
- func (vm *VM) AppRequestFailed(ctx context.Context, nodeID ids.NodeID, requestID uint32, ...) error
- func (vm *VM) AppResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, response []byte) error
- func (vm *VM) BuildBlock(ctx context.Context) (chain.Block, error)
- func (vm *VM) Connected(ctx context.Context, nodeID ids.NodeID, version *version.Application) error
- func (vm *VM) CreateHandlers(ctx context.Context) (map[string]http.Handler, error)
- func (vm *VM) CrossChainAppRequest(ctx context.Context, chainID ids.ID, requestID uint32, deadline time.Time, ...) error
- func (vm *VM) CrossChainAppRequestFailed(ctx context.Context, chainID ids.ID, requestID uint32, appErr *core.AppError) error
- func (vm *VM) CrossChainAppResponse(ctx context.Context, chainID ids.ID, requestID uint32, response []byte) error
- func (vm *VM) Disconnected(ctx context.Context, nodeID ids.NodeID) error
- func (vm *VM) GetBlock(ctx context.Context, blkID ids.ID) (chain.Block, error)
- func (vm *VM) GetBlockIDAtHeight(ctx context.Context, height uint64) (ids.ID, error)
- func (vm *VM) HealthCheck(ctx context.Context) (interface{}, error)
- func (vm *VM) Initialize(ctx context.Context, chainCtx *consensusNode.Context, db database.Database, ...) error
- func (vm *VM) LastAccepted(ctx context.Context) (ids.ID, error)
- func (vm *VM) NewHTTPHandler(ctx context.Context) (http.Handler, error)
- func (vm *VM) ParseBlock(ctx context.Context, blockBytes []byte) (chain.Block, error)
- func (vm *VM) SetPreference(ctx context.Context, blkID ids.ID) error
- func (vm *VM) SetState(ctx context.Context, state consensusNode.State) error
- func (vm *VM) Shutdown(ctx context.Context) error
- func (vm *VM) Version(ctx context.Context) (string, error)
- func (vm *VM) WaitForEvent(ctx context.Context) (core.Message, error)
- type Web3API
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewBadgerDatabase ¶
func NewBadgerDatabase(luxDB database.Database, config BadgerDatabaseConfig) (ethdb.Database, error)
NewBadgerDatabase creates a new BadgerDB with optional ancient store support
Types ¶
type BadgerDatabaseConfig ¶
type BadgerDatabaseConfig struct {
DataDir string
EnableAncient bool
AncientDir string
ReadOnly bool
FreezeThreshold uint64 // Blocks to keep in main DB before freezing
}
BadgerDatabaseConfig holds configuration for BadgerDB with ancient store
type BatchWrapper ¶
type BatchWrapper struct {
// contains filtered or unexported fields
}
BatchWrapper wraps a Lux batch to implement ethdb.Batch
func (*BatchWrapper) Delete ¶
func (b *BatchWrapper) Delete(key []byte) error
Delete removes the key from the batch
func (*BatchWrapper) DeleteRange ¶
func (b *BatchWrapper) DeleteRange(start, end []byte) error
DeleteRange removes the key range from the batch
func (*BatchWrapper) Put ¶
func (b *BatchWrapper) Put(key []byte, value []byte) error
Put inserts the given value into the batch
func (*BatchWrapper) Replay ¶
func (b *BatchWrapper) Replay(w ethdb.KeyValueWriter) error
Replay replays the batch contents to the given writer
func (*BatchWrapper) ValueSize ¶
func (b *BatchWrapper) ValueSize() int
ValueSize retrieves the amount of data queued up for writing
func (*BatchWrapper) Write ¶
func (b *BatchWrapper) Write() error
Write flushes any accumulated data to disk
type Block ¶
type Block struct {
// contains filtered or unexported fields
}
Block wraps an Ethereum block to implement the chain.Block interface
type DatabaseWrapper ¶
type DatabaseWrapper struct {
// contains filtered or unexported fields
}
DatabaseWrapper wraps a Lux database to implement ethdb.Database
func (*DatabaseWrapper) Ancient ¶
func (d *DatabaseWrapper) Ancient(kind string, number uint64) ([]byte, error)
Ancient retrieves an ancient binary blob from the append-only immutable files
func (*DatabaseWrapper) AncientDatadir ¶
func (d *DatabaseWrapper) AncientDatadir() (string, error)
AncientDatadir returns the ancient datadir
func (*DatabaseWrapper) AncientRange ¶
func (d *DatabaseWrapper) AncientRange(kind string, start, count, maxBytes uint64) ([][]byte, error)
AncientRange retrieves multiple items in sequence
func (*DatabaseWrapper) AncientSize ¶
func (d *DatabaseWrapper) AncientSize(kind string) (uint64, error)
AncientSize returns the ancient size of the specified category
func (*DatabaseWrapper) Ancients ¶
func (d *DatabaseWrapper) Ancients() (uint64, error)
Ancients returns the ancient item numbers in the ancient store
func (*DatabaseWrapper) Compact ¶
func (d *DatabaseWrapper) Compact(start []byte, limit []byte) error
Compact flattens the underlying data store for the given key range
func (*DatabaseWrapper) Delete ¶
func (d *DatabaseWrapper) Delete(key []byte) error
Delete removes the key from the key-value data store
func (*DatabaseWrapper) DeleteRange ¶
func (d *DatabaseWrapper) DeleteRange(start, end []byte) error
DeleteRange removes all entries between the given markers
func (*DatabaseWrapper) Get ¶
func (d *DatabaseWrapper) Get(key []byte) ([]byte, error)
Get retrieves the given key if it's present in the key-value data store
func (*DatabaseWrapper) Has ¶
func (d *DatabaseWrapper) Has(key []byte) (bool, error)
Has retrieves if a key is present in the key-value data store
func (*DatabaseWrapper) MigrateTable ¶
MigrateTable processes and migrates entries of a given table to a new format
func (*DatabaseWrapper) ModifyAncients ¶
func (d *DatabaseWrapper) ModifyAncients(fn func(ethdb.AncientWriteOp) error) (int64, error)
ModifyAncients runs a write operation on the ancient store
func (*DatabaseWrapper) NewBatch ¶
func (d *DatabaseWrapper) NewBatch() ethdb.Batch
NewBatch creates a write-only database that buffers changes to its host db
func (*DatabaseWrapper) NewBatchWithSize ¶
func (d *DatabaseWrapper) NewBatchWithSize(size int) ethdb.Batch
NewBatchWithSize creates a write-only database batch with a specified size
func (*DatabaseWrapper) NewIterator ¶
func (d *DatabaseWrapper) NewIterator(prefix []byte, start []byte) ethdb.Iterator
NewIterator creates a binary-alphabetical iterator over a subset
func (*DatabaseWrapper) Put ¶
func (d *DatabaseWrapper) Put(key []byte, value []byte) error
Put inserts the given value into the key-value data store
func (*DatabaseWrapper) ReadAncients ¶
func (d *DatabaseWrapper) ReadAncients(fn func(ethdb.AncientReaderOp) error) (err error)
ReadAncients applies the provided AncientReader function
func (*DatabaseWrapper) Stat ¶
func (d *DatabaseWrapper) Stat() (string, error)
Stat returns a particular internal stat of the database
func (*DatabaseWrapper) Sync ¶
func (d *DatabaseWrapper) Sync() error
Sync flushes the database to disk
func (*DatabaseWrapper) SyncAncient ¶
func (d *DatabaseWrapper) SyncAncient() error
SyncAncient syncs the ancient data directory
func (*DatabaseWrapper) SyncKeyValue ¶
func (d *DatabaseWrapper) SyncKeyValue() error
SyncKeyValue ensures that all pending writes are flushed to disk
func (*DatabaseWrapper) Tail ¶
func (d *DatabaseWrapper) Tail() (uint64, error)
Tail returns the number of first stored item in the freezer
func (*DatabaseWrapper) TruncateHead ¶
func (d *DatabaseWrapper) TruncateHead(n uint64) (uint64, error)
TruncateHead discards all but the first n ancient data from the ancient store
func (*DatabaseWrapper) TruncateTail ¶
func (d *DatabaseWrapper) TruncateTail(n uint64) (uint64, error)
TruncateTail discards the first n ancient data from the ancient store
type EthAPI ¶
type EthAPI struct {
// contains filtered or unexported fields
}
EthAPI provides an Ethereum RPC API
func NewEthAPI ¶
func NewEthAPI(backend *MinimalEthBackend) *EthAPI
NewEthAPI creates a new Ethereum RPC API
func (*EthAPI) BlockNumber ¶
BlockNumber returns the current block number
func (*EthAPI) EstimateGas ¶
func (api *EthAPI) EstimateGas(ctx context.Context, args TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash) (hexutil.Uint64, error)
EstimateGas estimates the gas needed for a transaction
func (*EthAPI) GetBalance ¶
func (api *EthAPI) GetBalance(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (*hexutil.Big, error)
GetBalance returns the balance of an account
func (*EthAPI) GetBlockByHash ¶
func (api *EthAPI) GetBlockByHash(ctx context.Context, hash common.Hash, fullTx bool) (map[string]interface{}, error)
GetBlockByHash returns the block for the given block hash
func (*EthAPI) GetBlockByNumber ¶
func (api *EthAPI) GetBlockByNumber(ctx context.Context, number rpc.BlockNumber, fullTx bool) (map[string]interface{}, error)
GetBlockByNumber returns the block for the given block number
func (*EthAPI) GetCode ¶
func (api *EthAPI) GetCode(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error)
GetCode returns the code of a contract
func (*EthAPI) GetTransactionByHash ¶
func (api *EthAPI) GetTransactionByHash(ctx context.Context, hash common.Hash) (*RPCTransaction, error)
GetTransactionByHash returns a transaction by hash
func (*EthAPI) GetTransactionCount ¶
func (api *EthAPI) GetTransactionCount(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (*hexutil.Uint64, error)
GetTransactionCount returns the nonce of an account
type IteratorWrapper ¶
type IteratorWrapper struct {
// contains filtered or unexported fields
}
IteratorWrapper wraps a Lux iterator to implement ethdb.Iterator
func (*IteratorWrapper) Error ¶
func (i *IteratorWrapper) Error() error
Error returns any accumulated error
func (*IteratorWrapper) Key ¶
func (i *IteratorWrapper) Key() []byte
Key returns the key of the current key/value pair
func (*IteratorWrapper) Next ¶
func (i *IteratorWrapper) Next() bool
Next moves the iterator to the next key/value pair
func (*IteratorWrapper) Release ¶
func (i *IteratorWrapper) Release()
Release releases associated resources
func (*IteratorWrapper) Value ¶
func (i *IteratorWrapper) Value() []byte
Value returns the value of the current key/value pair
type MinimalEthBackend ¶
type MinimalEthBackend struct {
// contains filtered or unexported fields
}
MinimalEthBackend provides a minimal Ethereum backend without p2p networking
func NewMigratedBackend ¶
func NewMigratedBackend(db ethdb.Database, migratedHeight uint64) (*MinimalEthBackend, error)
NewMigratedBackend creates a special backend for fully migrated data This completely bypasses genesis initialization
func NewMinimalEthBackend ¶
func NewMinimalEthBackend(db ethdb.Database, config *ethconfig.Config, genesis *gethcore.Genesis) (*MinimalEthBackend, error)
NewMinimalEthBackend creates a new minimal Ethereum backend
func NewMinimalEthBackendForMigration ¶
func NewMinimalEthBackendForMigration(db ethdb.Database, config *ethconfig.Config, genesis *gethcore.Genesis, migratedHeight uint64) (*MinimalEthBackend, error)
NewMinimalEthBackendForMigration creates a backend that loads from migrated data
func (*MinimalEthBackend) APIs ¶
func (b *MinimalEthBackend) APIs() []rpc.API
APIs returns the collection of RPC services the ethereum package offers
func (*MinimalEthBackend) BlockChain ¶
func (b *MinimalEthBackend) BlockChain() *gethcore.BlockChain
BlockChain returns the blockchain
func (*MinimalEthBackend) ChainConfig ¶
func (b *MinimalEthBackend) ChainConfig() *params.ChainConfig
ChainConfig returns the chain configuration
func (*MinimalEthBackend) TxPool ¶
func (b *MinimalEthBackend) TxPool() *txpool.TxPool
TxPool returns the transaction pool
type NetAPI ¶
type NetAPI struct {
// contains filtered or unexported fields
}
NetAPI provides network RPC API
type RPCTransaction ¶
type RPCTransaction struct {
BlockHash *common.Hash `json:"blockHash"`
BlockNumber *hexutil.Big `json:"blockNumber"`
From common.Address `json:"from"`
Gas hexutil.Uint64 `json:"gas"`
GasPrice *hexutil.Big `json:"gasPrice"`
GasFeeCap *hexutil.Big `json:"maxFeePerGas,omitempty"`
GasTipCap *hexutil.Big `json:"maxPriorityFeePerGas,omitempty"`
Hash common.Hash `json:"hash"`
Input hexutil.Bytes `json:"input"`
Nonce hexutil.Uint64 `json:"nonce"`
To *common.Address `json:"to"`
TransactionIndex *hexutil.Uint64 `json:"transactionIndex"`
Value *hexutil.Big `json:"value"`
Type hexutil.Uint64 `json:"type"`
Accesses *types.AccessList `json:"accessList,omitempty"`
ChainID *hexutil.Big `json:"chainId,omitempty"`
V *hexutil.Big `json:"v"`
R *hexutil.Big `json:"r"`
S *hexutil.Big `json:"s"`
}
RPCTransaction represents a transaction for RPC
type TransactionArgs ¶
type TransactionArgs struct {
From *common.Address `json:"from"`
To *common.Address `json:"to"`
Gas *hexutil.Uint64 `json:"gas"`
GasPrice *hexutil.Big `json:"gasPrice"`
Value *hexutil.Big `json:"value"`
Nonce *hexutil.Uint64 `json:"nonce"`
Data *hexutil.Bytes `json:"data"`
Input *hexutil.Bytes `json:"input"`
}
TransactionArgs represents the arguments for a transaction
type VM ¶
type VM struct {
// contains filtered or unexported fields
}
VM implements the C-Chain VM interface using geth
func (*VM) AppRequest ¶
func (vm *VM) AppRequest(ctx context.Context, nodeID ids.NodeID, requestID uint32, deadline time.Time, request []byte) error
AppRequest implements the block.ChainVM interface
func (*VM) AppRequestFailed ¶
func (vm *VM) AppRequestFailed(ctx context.Context, nodeID ids.NodeID, requestID uint32, appErr *core.AppError) error
AppRequestFailed implements the block.ChainVM interface
func (*VM) AppResponse ¶
func (vm *VM) AppResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, response []byte) error
AppResponse implements the block.ChainVM interface
func (*VM) BuildBlock ¶
BuildBlock implements the block.ChainVM interface
func (*VM) CreateHandlers ¶
CreateHandlers implements the block.ChainVM interface
func (*VM) CrossChainAppRequest ¶
func (vm *VM) CrossChainAppRequest(ctx context.Context, chainID ids.ID, requestID uint32, deadline time.Time, request []byte) error
CrossChainAppRequest implements the block.ChainVM interface
func (*VM) CrossChainAppRequestFailed ¶
func (vm *VM) CrossChainAppRequestFailed(ctx context.Context, chainID ids.ID, requestID uint32, appErr *core.AppError) error
CrossChainAppRequestFailed implements the block.ChainVM interface
func (*VM) CrossChainAppResponse ¶
func (vm *VM) CrossChainAppResponse(ctx context.Context, chainID ids.ID, requestID uint32, response []byte) error
CrossChainAppResponse implements the block.ChainVM interface
func (*VM) Disconnected ¶
Disconnected implements the block.ChainVM interface
func (*VM) GetBlockIDAtHeight ¶
GetBlockIDAtHeight implements the block.ChainVM interface
func (*VM) HealthCheck ¶
HealthCheck implements the block.ChainVM interface
func (*VM) Initialize ¶
func (vm *VM) Initialize( ctx context.Context, chainCtx *consensusNode.Context, db database.Database, genesisBytes []byte, upgradeBytes []byte, configBytes []byte, fxs []*core.Fx, appSender core.AppSender, ) error
Initialize implements the block.ChainVM interface
func (*VM) LastAccepted ¶
LastAccepted implements the block.ChainVM interface
func (*VM) NewHTTPHandler ¶
NewHTTPHandler implements the block.ChainVM interface
func (*VM) ParseBlock ¶
ParseBlock implements the block.ChainVM interface
func (*VM) SetPreference ¶
SetPreference implements the block.ChainVM interface
type Web3API ¶
type Web3API struct{}
Web3API provides web3 RPC API
func (*Web3API) ClientVersion ¶
ClientVersion returns the node client version