Documentation
¶
Index ¶
- type Blockchain
- type BlockchainStatus
- type BlockchainType
- type Builder
- func (b *Builder) CreateBlockchain(ctx context.Context, params *CreateParams) (*Blockchain, error)
- func (b *Builder) Deploy(ctx context.Context, blockchain *Blockchain, network *network.Network) error
- func (b *Builder) GenerateGenesis(params *GenesisParams) ([]byte, error)
- func (b *Builder) GetBlockchain(blockchainID string) (*Blockchain, error)
- func (b *Builder) ListBlockchains() []*Blockchain
- func (b *Builder) ValidateConfig(config []byte) error
- type CreateParams
- type GenesisAccount
- type GenesisParams
- type GenesisValidator
- type L1Params
- type L2Config
- type L2Params
- type L3Config
- type L3Params
- type Metrics
- func (m *Metrics) GetSnapshot() map[string]interface{}
- func (m *Metrics) RecordBlock(blockTime time.Time)
- func (m *Metrics) RecordTransaction(success bool)
- func (m *Metrics) UpdateNetwork(peers int, latency time.Duration)
- func (m *Metrics) UpdateResources(cpu float64, memory, disk uint64)
- func (m *Metrics) UpdateTPS(tps float64)
- type Net
- type VMType
- type Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Blockchain ¶
type Blockchain struct {
ID string
Name string
Type BlockchainType
VMType VMType
ChainID types.ID
Genesis []byte
ChainConfig []byte
Status BlockchainStatus
CreatedAt time.Time
DeployedAt *time.Time
NetworkID string
}
Blockchain represents a Lux blockchain
type BlockchainStatus ¶
type BlockchainStatus string
BlockchainStatus defines the status of a blockchain
const ( StatusCreated BlockchainStatus = "created" StatusDeploying BlockchainStatus = "deploying" StatusDeployed BlockchainStatus = "deployed" StatusRunning BlockchainStatus = "running" StatusStopped BlockchainStatus = "stopped" StatusError BlockchainStatus = "error" )
type BlockchainType ¶
type BlockchainType string
BlockchainType defines the type of blockchain
const ( TypeL1 BlockchainType = "L1" TypeL2 BlockchainType = "L2" TypeL3 BlockchainType = "L3" )
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder handles blockchain creation and deployment
func NewBuilder ¶
NewBuilder creates a new blockchain builder
func (*Builder) CreateBlockchain ¶
func (b *Builder) CreateBlockchain(ctx context.Context, params *CreateParams) (*Blockchain, error)
CreateBlockchain creates a new blockchain
func (*Builder) Deploy ¶
func (b *Builder) Deploy(ctx context.Context, blockchain *Blockchain, network *network.Network) error
Deploy deploys a blockchain to a network
func (*Builder) GenerateGenesis ¶
func (b *Builder) GenerateGenesis(params *GenesisParams) ([]byte, error)
GenerateGenesis generates a genesis file for a blockchain
func (*Builder) GetBlockchain ¶
func (b *Builder) GetBlockchain(blockchainID string) (*Blockchain, error)
GetBlockchain returns a blockchain by ID
func (*Builder) ListBlockchains ¶
func (b *Builder) ListBlockchains() []*Blockchain
ListBlockchains returns all blockchains
func (*Builder) ValidateConfig ¶
ValidateConfig validates a chain configuration
type CreateParams ¶
type CreateParams struct {
Name string
Type BlockchainType
VMType VMType
ChainID *big.Int
Genesis []byte
ChainConfig []byte
VMConfig map[string]interface{}
Allocations map[common.Address]GenesisAccount
ValidatorSet []Validator
InitialSupply *big.Int
L2Config *L2Config
L3Config *L3Config
}
CreateParams defines parameters for creating a blockchain
type GenesisAccount ¶
type GenesisAccount struct {
Balance *big.Int `json:"balance"`
Code []byte `json:"code,omitempty"`
Storage map[common.Hash]common.Hash `json:"storage,omitempty"`
}
GenesisAccount defines an account in genesis
type GenesisParams ¶
type GenesisParams struct {
VMType VMType
ChainID *big.Int
Allocations map[common.Address]GenesisAccount
ValidatorSet []Validator
InitialSupply *big.Int
}
GenesisParams defines parameters for genesis generation
type GenesisValidator ¶ added in v1.3.8
GenesisValidator defines a validator in the genesis Uses simplified fields for genesis configuration
type L2Config ¶
type L2Config struct {
SequencerType string
DALayer string
SettlementChain string
BridgeContract string
}
L2Config defines L2-specific configuration
type L2Params ¶
type L2Params struct {
VMType VMType
Genesis []byte
ChainConfig []byte
SequencerType string
DALayer string
SettlementChain string
}
L2Params defines parameters for L2 creation
type L3Params ¶
type L3Params struct {
VMType VMType
Genesis []byte
ChainConfig []byte
L2Chain string
AppType string
AppConfig map[string]interface{}
}
L3Params defines parameters for L3 creation
type Metrics ¶
type Metrics struct {
// Block metrics
BlocksProduced uint64
LastBlockTime time.Time
AverageBlockTime time.Duration
// Transaction metrics
TxProcessed uint64
TxFailed uint64
TPS float64
// Network metrics
PeersConnected int
NetworkLatency time.Duration
// Resource metrics
CPUUsage float64
MemoryUsage uint64
DiskUsage uint64
// contains filtered or unexported fields
}
Metrics tracks blockchain performance metrics
func (*Metrics) GetSnapshot ¶
GetSnapshot returns a snapshot of current metrics
func (*Metrics) RecordBlock ¶
RecordBlock records a new block
func (*Metrics) RecordTransaction ¶
RecordTransaction records a transaction
func (*Metrics) UpdateNetwork ¶
UpdateNetwork updates network metrics
func (*Metrics) UpdateResources ¶
UpdateResources updates resource usage metrics
type Net ¶ added in v1.3.8
type Net struct {
NetID interface{} `json:"netId"` // ids.ID
BlockchainID interface{} // ids.ID
OwnerAddress *common.Address
RPC string
BootstrapValidators []interface{} // []Validator
}
Net represents a blockchain network with validator management capabilities As above, so below - unified across all network layers (primary, L1, L2, L3)
func (*Net) InitializeProofOfAuthority ¶ added in v1.3.8
func (s *Net) InitializeProofOfAuthority( log interface{}, network interface{}, privateKey string, aggregatorLogger interface{}, validatorManagerAddress string, v2_0_0 bool, signatureAggregatorEndpoint string, ) error
InitializeProofOfAuthority initializes a PoA validator manager
func (*Net) InitializeProofOfStake ¶ added in v1.3.8
func (s *Net) InitializeProofOfStake( log interface{}, network interface{}, privateKey string, aggregatorLogger interface{}, posParams interface{}, managerAddress string, signatureAggregatorEndpoint string, ) error
InitializeProofOfStake initializes a PoS validator manager