Documentation
¶
Index ¶
- Constants
- Variables
- type APIServer
- type Asset
- type AssetIdentifier
- type AssetMetadata
- type AssetRegistry
- type AssetType
- type Block
- func (b *Block) Accept() error
- func (b *Block) Bytes() []byte
- func (b *Block) Height() uint64
- func (b *Block) ID() string
- func (b *Block) Parent() ids.ID
- func (b *Block) Reject() error
- func (b *Block) Status() choices.Status
- func (b *Block) Time() uint64
- func (b *Block) Verify(context.Context) error
- type BlockBody
- type BlockChain
- func (bc *BlockChain) AcceptBlock(b *Block) error
- func (bc *BlockChain) BuildBlock() (block.Block, error)
- func (bc *BlockChain) GetBlock(blockID ids.ID) (block.Block, error)
- func (bc *BlockChain) IsSynced() bool
- func (bc *BlockChain) LastAccepted() (ids.ID, error)
- func (bc *BlockChain) ParseBlock(blockBytes []byte) (block.Block, error)
- func (bc *BlockChain) SetPreference(blockID ids.ID) error
- type BlockHeader
- type CChainClient
- type CGG21KeyGen
- type CGG21Reshare
- type CGG21Sign
- type Config
- type ExecutorConfig
- type ExecutorEngine
- type Factory
- type Genesis
- type GenesisConfig
- type Health
- type IntentPool
- type IntentType
- type KeyGenProtocol
- type KeyGenRequest
- type KeyShare
- type MPCConfig
- type MPCManager
- func (m *MPCManager) CleanupSession(sessionID ids.ID)
- func (m *MPCManager) HasPendingOperations() bool
- func (m *MPCManager) HealthStatus() string
- func (m *MPCManager) InitiateKeyGen(data []byte) error
- func (m *MPCManager) Run(shutdown <-chan struct{}, wg *sync.WaitGroup)
- func (m *MPCManager) SignXChainTx(tx interface{}) (interface{}, error)
- func (m *MPCManager) StoreKeyGenResult(sessionID ids.ID, result []byte) error
- func (m *MPCManager) StoreSignature(sessionID ids.ID, signature []byte) error
- func (m *MPCManager) UpdateKeyShares(sessionID ids.ID, newShares []byte) error
- func (m *MPCManager) VerifyBlockSignature(message []byte, signature []byte, signerBitmap []byte) error
- type MPCOpType
- type MPCOperation
- type MPCSession
- type MPCSessionType
- type MPCWallet
- type Mempool
- type Message
- type NFTHandler
- type NetworkHandler
- type PChainClient
- type PublicKey
- type ReshareProtocol
- type SessionState
- type Settlement
- type SettlementStatus
- type SettlementType
- type SignProtocol
- type TeleportAsset
- type TeleportConfig
- type TeleportEngine
- type TeleportIntent
- type TeleportOpType
- type TeleportOperation
- type TeleportProof
- type TeleportTransfer
- type Transaction
- type TransferStatus
- type TxType
- type VM
- func (vm *VM) BuildBlock(context.Context) (block.Block, error)
- func (vm *VM) CreateHandlers(context.Context) (map[string]interface{}, error)
- func (vm *VM) CreateStaticHandlers(context.Context) (map[string]interface{}, error)
- func (vm *VM) GetBlock(ctx context.Context, blockID ids.ID) (block.Block, error)
- func (vm *VM) GetBlockSignature(blockID ids.ID) ([bls.SignatureLen]byte, error)
- func (vm *VM) GetLastStateSummary(context.Context) (block.StateSummary, error)
- func (vm *VM) GetMessageSignature(messageID ids.ID) ([bls.SignatureLen]byte, error)
- func (vm *VM) GetOngoingSyncStateSummary(context.Context) (block.StateSummary, error)
- func (vm *VM) GetStateSummary(ctx context.Context, summaryHeight uint64) (block.StateSummary, error)
- func (vm *VM) HealthCheck(context.Context) (interface{}, error)
- func (vm *VM) Initialize(_ context.Context, ctx *quasar.Context, db database.Database, ...) error
- func (vm *VM) LastAccepted(context.Context) (ids.ID, error)
- func (vm *VM) ParseBlock(ctx context.Context, blockBytes []byte) (block.Block, error)
- func (vm *VM) ParseStateSummary(ctx context.Context, summaryBytes []byte) (block.StateSummary, error)
- func (vm *VM) SetPreference(ctx context.Context, blockID ids.ID) error
- func (vm *VM) SetState(ctx context.Context, state quasar.State) error
- func (vm *VM) Shutdown(context.Context) error
- func (vm *VM) StateSyncEnabled(context.Context) (bool, error)
- func (vm *VM) Version(context.Context) (string, error)
- func (vm *VM) WaitForEvent(ctx context.Context) (core.Message, error)
- type ValidatorNFT
- type ValidatorOpType
- type ValidatorOperation
- type ValidatorSet
- func (vs *ValidatorSet) AddNFTValidator(nodeID ids.NodeID, nftAssetID ids.ID, weight uint64) error
- func (vs *ValidatorSet) AddValidator(nodeID ids.NodeID, weight uint64, startTime, endTime uint64) error
- func (vs *ValidatorSet) Count() int
- func (vs *ValidatorSet) GetValidatorSet(height uint64) []interface{}
- func (vs *ValidatorSet) ProcessUpdate(data []byte) error
- func (vs *ValidatorSet) RemoveNFTValidator(nodeID ids.NodeID, nftAssetID ids.ID) error
- func (vs *ValidatorSet) RemoveValidator(nodeID ids.NodeID) error
- type ValidatorState
- type XChainClient
- type XChainSettlement
- func (xs *XChainSettlement) GetPendingSettlements() []*Settlement
- func (xs *XChainSettlement) GetSettlement(id ids.ID) (*Settlement, error)
- func (xs *XChainSettlement) ProcessIncomingAssets(ctx context.Context, sourceChain ids.ID, assetID ids.ID, amount uint64, ...) (*Settlement, error)
- func (xs *XChainSettlement) ProcessOutgoingAssets(ctx context.Context, destChain ids.ID, assetID ids.ID, amount uint64, ...) (*Settlement, error)
- type XChainSettlementConfig
- type ZKProver
- type ZKVerifier
Constants ¶
const Version = "v0.1.0"
Version
Variables ¶
var ( // MPCVMID is the ID of the MPCVM MPCVMID = ids.ID{'m', 'p', 'c', 'v', 'm'} )
Functions ¶
This section is empty.
Types ¶
type APIServer ¶
type APIServer struct {
// contains filtered or unexported fields
}
API Server
func NewAPIServer ¶
func (*APIServer) CreateHandlers ¶
func (*APIServer) CreateStaticHandlers ¶
type Asset ¶
type Asset struct {
ID ids.ID
Symbol string
Name string
Type AssetType
ContractAddress string
TokenID string
Metadata map[string]interface{}
}
Asset represents a teleportable asset
type AssetIdentifier ¶
type AssetIdentifier struct {
ChainID ids.ID
AssetID ids.ID
ContractAddress common.Address
TokenID *big.Int // For NFTs
}
AssetIdentifier uniquely identifies an asset across chains
type AssetMetadata ¶
type AssetMetadata struct {
Name string
Symbol string
Description string
ImageURI string
ExternalURI string
Attributes map[string]interface{}
ValidatorPower *big.Int // For validator NFTs
}
AssetMetadata contains metadata about an asset
type AssetRegistry ¶
type AssetRegistry struct {
// contains filtered or unexported fields
}
func NewAssetRegistry ¶
func NewAssetRegistry(db database.Database) *AssetRegistry
func (*AssetRegistry) GetAsset ¶
func (ar *AssetRegistry) GetAsset(assetID ids.ID) (*Asset, error)
GetAsset retrieves an asset by its ID
func (*AssetRegistry) UpdateAssetLocation ¶
UpdateAssetLocation updates the current location of an asset
type Block ¶
type Block struct {
ParentID ids.ID
Timestamp uint64
BlockID ids.ID
// Block content
Header *BlockHeader
Body *BlockBody
// contains filtered or unexported fields
}
Block represents a block in the M-Chain
type BlockBody ¶
type BlockBody struct {
// Regular transactions
Transactions []*Transaction
// Teleport operations
TeleportOps []*TeleportOperation
// MPC operations
MPCOps []*MPCOperation
// Validator updates
ValidatorOps []*ValidatorOperation
// Cross-chain messages
WarpPayloads [][]byte
}
BlockBody contains the block transactions and operations
type BlockChain ¶
type BlockChain struct {
// contains filtered or unexported fields
}
BlockChain manages the blockchain state
func NewBlockChain ¶
func NewBlockChain(blockDB, stateDB database.Database, genesis *Genesis, config Config) *BlockChain
func (*BlockChain) AcceptBlock ¶
func (bc *BlockChain) AcceptBlock(b *Block) error
func (*BlockChain) BuildBlock ¶
func (bc *BlockChain) BuildBlock() (block.Block, error)
func (*BlockChain) IsSynced ¶
func (bc *BlockChain) IsSynced() bool
func (*BlockChain) LastAccepted ¶
func (bc *BlockChain) LastAccepted() (ids.ID, error)
func (*BlockChain) ParseBlock ¶
func (bc *BlockChain) ParseBlock(blockBytes []byte) (block.Block, error)
func (*BlockChain) SetPreference ¶
func (bc *BlockChain) SetPreference(blockID ids.ID) error
type BlockHeader ¶
type BlockHeader struct {
ParentHash common.Hash
StateRoot common.Hash
TxRoot common.Hash
ReceiptRoot common.Hash
TeleportRoot common.Hash // Root of teleport operations
ValidatorRoot common.Hash // Root of validator set changes
Height uint64
Timestamp uint64
Extra []byte
// MPC signatures
MPCSignature []byte
SignerBitmap []byte // Bitmap of which validators signed
// Warp messages
WarpMessages []*warp.UnsignedMessage
}
BlockHeader contains the block header information
type CChainClient ¶
type CChainClient interface {
GetHeight(ctx context.Context) (uint64, error)
GetBlockByNumber(ctx context.Context, blockNumber uint64) (interface{}, error)
GetTransactionReceipt(ctx context.Context, txHash string) (interface{}, error)
}
CChainClient interface for interacting with C-Chain
type CGG21KeyGen ¶
type CGG21KeyGen struct {
// contains filtered or unexported fields
}
CGG21KeyGen implements the Canetti-Gennaro-Goldfeder 2021 key generation protocol
func (*CGG21KeyGen) Run ¶
func (kg *CGG21KeyGen) Run(session *MPCSession)
Run executes the key generation protocol
type CGG21Reshare ¶
type CGG21Reshare struct {
// contains filtered or unexported fields
}
CGG21Reshare implements the CGG21 resharing protocol
type CGG21Sign ¶
type CGG21Sign struct {
// contains filtered or unexported fields
}
CGG21Sign implements the CGG21 signing protocol
type Config ¶
type Config struct {
// General
MempoolSize int `json:"mempoolSize"`
BlockBuildInterval time.Duration `json:"blockBuildInterval"`
// MPC
MPCEnabled bool `json:"mpcEnabled"`
MPCConfig MPCConfig `json:"mpcConfig"`
// ZK
ZKEnabled bool `json:"zkEnabled"`
// Teleport
TeleportEnabled bool `json:"teleportEnabled"`
IntentPoolSize int `json:"intentPoolSize"`
ExecutorConfig ExecutorConfig `json:"executorConfig"`
// Warp
WarpConfig interface{} `json:"warpConfig"`
// P2P
P2PConfig interface{} `json:"p2pConfig"`
}
Config contains the configuration for the MVM
type ExecutorConfig ¶
type ExecutorConfig struct {
MaxConcurrentExecutions int `json:"maxConcurrentExecutions"`
ExecutionTimeout time.Duration `json:"executionTimeout"`
}
ExecutorConfig contains executor-specific configuration
type ExecutorEngine ¶
type ExecutorEngine struct {
// contains filtered or unexported fields
}
func NewExecutorEngine ¶
func NewExecutorEngine(wallet *MPCWallet, assetRegistry *AssetRegistry, zkProver *ZKProver, config ExecutorConfig) *ExecutorEngine
type Genesis ¶
type Genesis struct {
Config GenesisConfig `json:"config"`
}
Genesis
func ParseGenesis ¶
type GenesisConfig ¶
type GenesisConfig struct {
}
type Health ¶
type Health struct {
Healthy bool `json:"healthy"`
BlockchainSync bool `json:"blockchainSync"`
MPCStatus string `json:"mpcStatus"`
TeleportStatus string `json:"teleportStatus"`
}
Health
type IntentPool ¶
type IntentPool struct {
// contains filtered or unexported fields
}
func NewIntentPool ¶
func NewIntentPool(maxSize int) *IntentPool
func (*IntentPool) AddIntent ¶
func (ip *IntentPool) AddIntent(intent *TeleportIntent) error
func (*IntentPool) Len ¶
func (ip *IntentPool) Len() int
func (*IntentPool) RemoveIntent ¶
func (ip *IntentPool) RemoveIntent(intentID ids.ID)
type IntentType ¶
type IntentType uint8
IntentType defines the type of teleport intent
const ( IntentTypeTransfer IntentType = iota IntentTypeSwap IntentTypeStake // For staking NFTs on P-Chain IntentTypeBridge )
type KeyGenProtocol ¶
type KeyGenProtocol struct {
// contains filtered or unexported fields
}
func NewKeyGenProtocol ¶
func NewKeyGenProtocol(manager *MPCManager) *KeyGenProtocol
type KeyGenRequest ¶
type MPCConfig ¶
type MPCConfig struct {
Threshold int `json:"threshold"`
SessionTimeout time.Duration `json:"sessionTimeout"`
KeyGenTimeout time.Duration `json:"keyGenTimeout"`
SignTimeout time.Duration `json:"signTimeout"`
MaxSessions int `json:"maxSessions"`
MaxConcurrentSessions int `json:"maxConcurrentSessions"`
}
MPCConfig contains MPC-specific configuration
type MPCManager ¶
type MPCManager struct {
// contains filtered or unexported fields
}
MPCManager manages MPC operations for the M-Chain
func NewMPCManager ¶
func NewMPCManager(db database.Database, config MPCConfig) *MPCManager
NewMPCManager creates a new MPC manager
func (*MPCManager) CleanupSession ¶
func (m *MPCManager) CleanupSession(sessionID ids.ID)
CleanupSession cleans up a session
func (*MPCManager) HasPendingOperations ¶
func (m *MPCManager) HasPendingOperations() bool
HasPendingOperations returns true if there are pending MPC operations
func (*MPCManager) HealthStatus ¶
func (m *MPCManager) HealthStatus() string
HealthStatus returns the health status of the MPC manager
func (*MPCManager) InitiateKeyGen ¶
func (m *MPCManager) InitiateKeyGen(data []byte) error
InitiateKeyGen starts a new key generation session
func (*MPCManager) Run ¶
func (m *MPCManager) Run(shutdown <-chan struct{}, wg *sync.WaitGroup)
Run starts the MPC manager background tasks
func (*MPCManager) SignXChainTx ¶
func (m *MPCManager) SignXChainTx(tx interface{}) (interface{}, error)
SignXChainTx signs an X-Chain transaction using MPC
func (*MPCManager) StoreKeyGenResult ¶
func (m *MPCManager) StoreKeyGenResult(sessionID ids.ID, result []byte) error
StoreKeyGenResult stores the result of key generation
func (*MPCManager) StoreSignature ¶
func (m *MPCManager) StoreSignature(sessionID ids.ID, signature []byte) error
StoreSignature stores a signature result
func (*MPCManager) UpdateKeyShares ¶
func (m *MPCManager) UpdateKeyShares(sessionID ids.ID, newShares []byte) error
UpdateKeyShares updates key shares after resharing
func (*MPCManager) VerifyBlockSignature ¶
func (m *MPCManager) VerifyBlockSignature(message []byte, signature []byte, signerBitmap []byte) error
VerifyBlockSignature verifies an MPC signature on a block
type MPCOperation ¶
type MPCOperation struct {
Type MPCOpType
SessionID ids.ID
Participants []ids.NodeID
Threshold uint32
// Operation-specific data
Data []byte
// Results
Result []byte
Signatures [][]byte
}
MPCOperation represents an MPC operation in a block
type MPCSession ¶
type MPCSession struct {
SessionID ids.ID
Type MPCSessionType
KeyID ids.ID
Participants []ids.NodeID
Threshold uint32
State SessionState
StartTime time.Time
LastUpdate time.Time
Result []byte
Error error
// contains filtered or unexported fields
}
MPCSession represents an active MPC session
type MPCSessionType ¶
type MPCSessionType uint8
MPCSessionType defines the type of MPC session
const ( SessionTypeKeyGen MPCSessionType = iota SessionTypeSign SessionTypeRefresh )
type MPCWallet ¶
type MPCWallet struct {
// contains filtered or unexported fields
}
func NewMPCWallet ¶
func NewMPCWallet(manager *MPCManager) *MPCWallet
type Mempool ¶
type Mempool struct {
// contains filtered or unexported fields
}
Mempool manages pending transactions
func NewMempool ¶
type NFTHandler ¶
type NFTHandler struct {
// contains filtered or unexported fields
}
NFTHandler manages NFT-specific teleport operations
func NewNFTHandler ¶
func NewNFTHandler(registry *AssetRegistry, zkProver *ZKProver) *NFTHandler
NewNFTHandler creates a new NFT handler
func (*NFTHandler) ActivateValidatorNFT ¶
func (nh *NFTHandler) ActivateValidatorNFT(assetID ids.ID, validatorTxID ids.ID)
ActivateValidatorNFT marks a validator NFT as active
func (*NFTHandler) GetValidatorNFT ¶
func (nh *NFTHandler) GetValidatorNFT(assetID ids.ID) (*ValidatorNFT, error)
GetValidatorNFT returns validator NFT information
type NetworkHandler ¶
NetworkHandler handles network communication
func NewNetworkHandler ¶
func NewNetworkHandler(vm *VM, appSender core.AppSender) NetworkHandler
type PChainClient ¶
type PChainClient interface {
GetHeight(ctx context.Context) (uint64, error)
// TODO: Fix GetValidatorOutput type
// GetValidatorSet(ctx context.Context, height uint64, subnetID ids.ID) (map[ids.NodeID]*api.GetValidatorOutput, error)
GetCurrentValidators(ctx context.Context, subnetID ids.ID) ([]interface{}, error)
}
PChainClient interface for interacting with P-Chain
type PublicKey ¶
type PublicKey struct {
KeyID ids.ID
PublicKey *ecdsa.PublicKey
Threshold uint32
TotalParties uint32
CreatedAt time.Time
}
PublicKey represents an MPC public key
type ReshareProtocol ¶
type ReshareProtocol struct {
// contains filtered or unexported fields
}
func NewReshareProtocol ¶
func NewReshareProtocol(manager *MPCManager) *ReshareProtocol
type SessionState ¶
type SessionState uint8
SessionState defines the state of an MPC session
const ( SessionStatePending SessionState = iota SessionStateActive SessionStateCompleted SessionStateFailed SessionStateAborted )
type Settlement ¶
type Settlement struct {
ID ids.ID
Type SettlementType
AssetID ids.ID
Amount uint64
SourceChain ids.ID
DestChain ids.ID
Recipient common.Address
TeleportProof *TeleportProof
Status SettlementStatus
CreatedAt time.Time
CompletedAt time.Time
XChainTxID ids.ID
}
Settlement represents a pending X-Chain settlement
type SettlementStatus ¶
type SettlementStatus uint8
const ( SettlementStatusPending SettlementStatus = iota SettlementStatusInProgress SettlementStatusCompleted SettlementStatusFailed )
type SettlementType ¶
type SettlementType uint8
const ( SettlementTypeMint SettlementType = iota SettlementTypeBurn )
type SignProtocol ¶
type SignProtocol struct {
// contains filtered or unexported fields
}
func NewSignProtocol ¶
func NewSignProtocol(manager *MPCManager) *SignProtocol
type TeleportAsset ¶
type TeleportAsset struct {
ID ids.ID
Type AssetType
OriginChain ids.ID
CurrentChain ids.ID
ContractAddress common.Address
TokenID *big.Int // For NFTs
Metadata AssetMetadata
TotalSupply *big.Int
Decimals uint8
}
TeleportAsset represents an asset that can be teleported
type TeleportConfig ¶
type TeleportConfig struct {
MaxTransferAmount uint64 `json:"maxTransferAmount"`
MinTransferAmount uint64 `json:"minTransferAmount"`
TransferFeePercent uint64 `json:"transferFeePercent"`
SettlementBatchSize int `json:"settlementBatchSize"`
SettlementTimeout int64 `json:"settlementTimeout"`
MaxPendingTransfers int `json:"maxPendingTransfers"`
ProofValidationDelay int64 `json:"proofValidationDelay"`
}
TeleportConfig contains teleport-specific configuration
type TeleportEngine ¶
type TeleportEngine struct {
// contains filtered or unexported fields
}
TeleportEngine orchestrates cross-chain transfers via the Teleport Protocol
func NewTeleportEngine ¶
func NewTeleportEngine( intentPool *IntentPool, executorEngine *ExecutorEngine, assetRegistry *AssetRegistry, zkVerifier *ZKVerifier, xchainSettlement *XChainSettlement, config TeleportConfig, ) *TeleportEngine
NewTeleportEngine creates a new Teleport Protocol engine
func (*TeleportEngine) HealthStatus ¶
func (te *TeleportEngine) HealthStatus() string
HealthStatus returns the health status of the teleport engine
func (*TeleportEngine) ProcessIntent ¶
func (te *TeleportEngine) ProcessIntent(ctx context.Context, intent *TeleportIntent) (*TeleportTransfer, error)
ProcessIntent processes a new teleport intent
func (*TeleportEngine) Run ¶
func (te *TeleportEngine) Run(shutdown <-chan struct{}, wg *sync.WaitGroup)
Run starts the teleport engine background services
type TeleportIntent ¶
type TeleportIntent struct {
ID ids.ID
Version uint8
IntentType IntentType
SourceAsset AssetIdentifier
DestAsset AssetIdentifier
Amount *big.Int
Sender common.Address
Recipient common.Address
MaxSlippage *big.Int
Deadline time.Time
Signature []byte
Metadata map[string]interface{}
}
TeleportIntent represents a user's intent to transfer assets
type TeleportOpType ¶
type TeleportOpType uint8
TeleportOpType defines the type of teleport operation
const ( TeleportOpTypeInitiate TeleportOpType = iota TeleportOpTypeSettle TeleportOpTypeComplete TeleportOpTypeRefund )
type TeleportOperation ¶
type TeleportOperation struct {
Type TeleportOpType
TransferID ids.ID
IntentID ids.ID
Status TransferStatus
// Settlement info
SettlementType SettlementType
XChainTxID *ids.ID
// Proofs
ZKProof []byte
ValidatorSigs [][]byte
}
TeleportOperation represents a teleport operation in a block
func (*TeleportOperation) Hash ¶
func (op *TeleportOperation) Hash() common.Hash
Hash returns the hash of a teleport operation
type TeleportProof ¶
type TeleportProof struct {
// Cross-chain transfer proof
TransferProof []byte
// State transition proofs
SourceStateProof []byte
DestStateProof []byte
// Asset registry proof
AssetValidityProof []byte
// Execution proof (for intents)
ExecutionProof []byte
// Aggregated validator signatures
ValidatorSigs [][]byte
// Metadata
ProofType string
GeneratedAt time.Time
}
TeleportProof contains the ZK proof for a teleport operation
type TeleportTransfer ¶
type TeleportTransfer struct {
ID ids.ID
Intent *TeleportIntent
Status TransferStatus
SourceChain ids.ID
DestChain ids.ID
Asset *TeleportAsset
Amount *big.Int
Sender common.Address
Recipient common.Address
ExecutorID ids.ID
Proofs *TeleportProof
CreatedAt time.Time
CompletedAt time.Time
Error error
}
TeleportTransfer represents an active cross-chain transfer
type Transaction ¶
type Transaction struct {
Type TxType
Nonce uint64
From common.Address
To common.Address
Value []byte // Encoded amount
Data []byte
Signature []byte
// Teleport-specific fields
IntentID *ids.ID
SourceChain *ids.ID
DestChain *ids.ID
}
Transaction represents a transaction in the M-Chain
func (*Transaction) Hash ¶
func (tx *Transaction) Hash() common.Hash
Hash returns the hash of a transaction
type TransferStatus ¶
type TransferStatus uint8
TransferStatus tracks the status of a transfer
const ( TransferStatusPending TransferStatus = iota TransferStatusExecuting TransferStatusSettling TransferStatusCompleted TransferStatusFailed TransferStatusRefunded )
type VM ¶
type VM struct {
// contains filtered or unexported fields
}
VM implements the MPC-Chain Virtual Machine
func (*VM) BuildBlock ¶
BuildBlock implements the block.ChainVM interface
func (*VM) CreateHandlers ¶
CreateHandlers implements the common.VM interface
func (*VM) CreateStaticHandlers ¶
CreateStaticHandlers implements the common.VM interface
func (*VM) GetBlockSignature ¶
GetBlockSignature returns the BLS signature for a block
func (*VM) GetLastStateSummary ¶
GetLastStateSummary implements block.StateSyncableVM
func (*VM) GetMessageSignature ¶
GetMessageSignature returns the BLS signature for a Warp message
func (*VM) GetOngoingSyncStateSummary ¶
GetOngoingSyncStateSummary implements block.StateSyncableVM
func (*VM) GetStateSummary ¶
func (vm *VM) GetStateSummary(ctx context.Context, summaryHeight uint64) (block.StateSummary, error)
GetStateSummary implements block.StateSyncableVM
func (*VM) HealthCheck ¶
HealthCheck implements the common.VM interface
func (*VM) Initialize ¶
func (vm *VM) Initialize( _ context.Context, ctx *quasar.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) ParseBlock ¶
ParseBlock implements the block.ChainVM interface
func (*VM) ParseStateSummary ¶
func (vm *VM) ParseStateSummary(ctx context.Context, summaryBytes []byte) (block.StateSummary, error)
ParseStateSummary implements block.StateSyncableVM
func (*VM) SetPreference ¶
SetPreference implements the block.ChainVM interface
func (*VM) StateSyncEnabled ¶
StateSyncEnabled implements block.StateSyncableVM
type ValidatorNFT ¶
type ValidatorNFT struct {
NFTAssetID ids.ID
ValidatorNodeID ids.NodeID
StakeAmount uint64
StakeStartTime time.Time
StakeEndTime time.Time
DelegationFee uint32
RewardsOwner ids.ID
Active bool
}
ValidatorNFT represents an NFT that can be used as a validator on P-Chain
type ValidatorOpType ¶
type ValidatorOpType uint8
ValidatorOpType defines the type of validator operation
const ( ValidatorOpTypeAdd ValidatorOpType = iota ValidatorOpTypeRemove ValidatorOpTypeUpdate ValidatorOpTypeNFTStake ValidatorOpTypeNFTUnstake )
type ValidatorOperation ¶
type ValidatorOperation struct {
Type ValidatorOpType
NodeID ids.NodeID
Weight uint64
// For NFT validators
NFTAssetID *ids.ID
// Timing
StartTime uint64
EndTime uint64
}
ValidatorOperation represents a validator set change
type ValidatorSet ¶
type ValidatorSet struct {
// contains filtered or unexported fields
}
ValidatorSet manages the validator set
func NewValidatorSet ¶
func NewValidatorSet(db database.Database, state ValidatorState) *ValidatorSet
func (*ValidatorSet) AddNFTValidator ¶
func (*ValidatorSet) AddValidator ¶
func (*ValidatorSet) Count ¶
func (vs *ValidatorSet) Count() int
func (*ValidatorSet) GetValidatorSet ¶
func (vs *ValidatorSet) GetValidatorSet(height uint64) []interface{}
func (*ValidatorSet) ProcessUpdate ¶
func (vs *ValidatorSet) ProcessUpdate(data []byte) error
func (*ValidatorSet) RemoveNFTValidator ¶
func (*ValidatorSet) RemoveValidator ¶
func (vs *ValidatorSet) RemoveValidator(nodeID ids.NodeID) error
type ValidatorState ¶
type ValidatorState interface{}
type XChainClient ¶
type XChainClient interface {
GetUTXOs(ctx context.Context, addrs []string) ([]*lux.UTXO, error)
IssueTx(ctx context.Context, tx []byte) (ids.ID, error)
GetTx(ctx context.Context, txID ids.ID) ([]byte, error)
GetBlockByHeight(ctx context.Context, height uint64) ([]byte, error)
GetBalance(address ids.ShortID, assetID ids.ID) (uint64, error)
}
XChainClient interface for interacting with X-Chain
type XChainSettlement ¶
type XChainSettlement struct {
// contains filtered or unexported fields
}
XChainSettlement handles all X-Chain mint/burn operations for the Teleport Protocol
func NewXChainSettlement ¶
func NewXChainSettlement( client XChainClient, mpcWallet *MPCWallet, zkProver *ZKProver, config XChainSettlementConfig, ) *XChainSettlement
NewXChainSettlement creates a new X-Chain settlement manager
func (*XChainSettlement) GetPendingSettlements ¶
func (xs *XChainSettlement) GetPendingSettlements() []*Settlement
GetPendingSettlements returns all pending settlements
func (*XChainSettlement) GetSettlement ¶
func (xs *XChainSettlement) GetSettlement(id ids.ID) (*Settlement, error)
GetSettlement returns a settlement by ID
func (*XChainSettlement) ProcessIncomingAssets ¶
func (xs *XChainSettlement) ProcessIncomingAssets( ctx context.Context, sourceChain ids.ID, assetID ids.ID, amount uint64, recipient common.Address, proof *TeleportProof, ) (*Settlement, error)
ProcessIncomingAssets handles assets coming into the Lux ecosystem This MINTS new assets on the X-Chain backed by the locked assets on the source chain
func (*XChainSettlement) ProcessOutgoingAssets ¶
func (xs *XChainSettlement) ProcessOutgoingAssets( ctx context.Context, destChain ids.ID, assetID ids.ID, amount uint64, sender common.Address, proof *TeleportProof, ) (*Settlement, error)
ProcessOutgoingAssets handles assets leaving the Lux ecosystem This BURNS assets on the X-Chain to release them on the destination chain
type XChainSettlementConfig ¶
type XChainSettlementConfig struct {
Endpoint string
BatchSize int
BatchInterval time.Duration
ConfirmationBlocks uint64
MaxRetries int
RetryDelay time.Duration
}
XChainSettlementConfig contains X-Chain settlement configuration
type ZKProver ¶
type ZKProver struct {
// contains filtered or unexported fields
}
func NewZKProver ¶
func (*ZKProver) VerifyProof ¶
VerifyProof verifies a zero-knowledge proof
type ZKVerifier ¶
type ZKVerifier struct {
// contains filtered or unexported fields
}
ZK Components
func NewZKVerifier ¶
func NewZKVerifier(db database.Database) *ZKVerifier
func (*ZKVerifier) VerifyProof ¶
func (z *ZKVerifier) VerifyProof(proofType string, proof []byte, publicInputs interface{}) error