Documentation
¶
Index ¶
- Constants
- Variables
- 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 BridgeConfig
- type BridgeRegistry
- type BridgeRequest
- type BridgeValidator
- type ChainClient
- type CompletedBridge
- type Genesis
- 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) (snowman.Block, error)
- func (vm *VM) Connected(ctx context.Context, nodeID ids.NodeID, nodeVersion *version.Application) error
- func (vm *VM) CreateHandlers(ctx context.Context) (map[string]http.Handler, error)
- func (vm *VM) CreateStaticHandlers(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 *common.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, id ids.ID) (snowman.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 *snow.Context, db database.Database, ...) error
- func (vm *VM) LastAccepted(ctx context.Context) (ids.ID, error)
- func (vm *VM) ParseBlock(ctx context.Context, bytes []byte) (snowman.Block, error)
- func (vm *VM) SetPreference(ctx context.Context, id ids.ID) error
- func (vm *VM) SetState(ctx context.Context, state snow.State) error
- func (vm *VM) Shutdown(ctx context.Context) error
- func (vm *VM) Version(ctx context.Context) (string, error)
Constants ¶
const CodecVersion = 0
Variables ¶
var (
Codec codec.Manager
)
var (
Version = &version.Semantic{
Major: 1,
Minor: 0,
Patch: 0,
}
)
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block struct {
ParentID ids.ID `json:"parentId"`
BlockHeight uint64 `json:"height"`
BlockTimestamp int64 `json:"timestamp"`
BridgeRequests []*BridgeRequest `json:"bridgeRequests"`
// MPC signatures for this block
MPCSignatures map[ids.NodeID][]byte `json:"mpcSignatures"`
// Cached values
ID_ ids.ID
// contains filtered or unexported fields
}
Block represents a block in the Bridge chain
type BridgeConfig ¶
type BridgeConfig struct {
// MPC configuration for secure cross-chain operations
MPCThreshold int `json:"mpcThreshold"` // t: Threshold (t+1 parties needed)
MPCTotalParties int `json:"mpcTotalParties"` // n: Total number of MPC nodes
// Bridge parameters
MinConfirmations uint32 `json:"minConfirmations"` // Confirmations required before bridging
BridgeFee uint64 `json:"bridgeFee"` // Fee in LUX for bridge operations
// Supported chains
SupportedChains []string `json:"supportedChains"` // Chain IDs that can be bridged
// Security settings
MaxBridgeAmount uint64 `json:"maxBridgeAmount"` // Maximum amount per bridge transaction
DailyBridgeLimit uint64 `json:"dailyBridgeLimit"` // Daily limit for bridge operations
RequireValidatorStake uint64 `json:"requireValidatorStake"` // 100M LUX required
}
BridgeConfig contains VM configuration
type BridgeRegistry ¶
type BridgeRegistry struct {
Validators map[ids.NodeID]*BridgeValidator
CompletedBridges map[ids.ID]*CompletedBridge
DailyVolume map[string]uint64 // chainID -> volume
// contains filtered or unexported fields
}
BridgeRegistry tracks bridge operations and validators
type BridgeRequest ¶
type BridgeRequest struct {
ID ids.ID `json:"id"`
SourceChain string `json:"sourceChain"`
DestChain string `json:"destChain"`
Asset ids.ID `json:"asset"`
Amount uint64 `json:"amount"`
Recipient []byte `json:"recipient"`
SourceTxID ids.ID `json:"sourceTxId"`
Confirmations uint32 `json:"confirmations"`
Status string `json:"status"` // pending, signing, completed, failed
MPCSignatures [][]byte `json:"mpcSignatures"`
CreatedAt time.Time `json:"createdAt"`
}
BridgeRequest represents a cross-chain bridge request
type BridgeValidator ¶
type BridgeValidator struct {
NodeID ids.NodeID
StakeAmount uint64
MPCPublicKey []byte
Active bool
TotalBridged uint64
SuccessRate float64
}
BridgeValidator represents a bridge validator node
type ChainClient ¶
type ChainClient interface {
GetTransaction(ctx context.Context, txID ids.ID) (interface{}, error)
GetConfirmations(ctx context.Context, txID ids.ID) (uint32, error)
SendTransaction(ctx context.Context, tx interface{}) (ids.ID, error)
ValidateAddress(address []byte) error
}
ChainClient interface for interacting with different chains
type CompletedBridge ¶
type CompletedBridge struct {
RequestID ids.ID
SourceTxID ids.ID
DestTxID ids.ID
CompletedAt time.Time
MPCSignature []byte
}
CompletedBridge represents a completed bridge operation
type Genesis ¶
type Genesis struct {
Timestamp int64 `json:"timestamp"`
}
Genesis represents the genesis state
type VM ¶
type VM struct {
// contains filtered or unexported fields
}
VM implements the Bridge VM for cross-chain interoperability
func (*VM) AppRequest ¶
func (vm *VM) AppRequest(ctx context.Context, nodeID ids.NodeID, requestID uint32, deadline time.Time, request []byte) error
AppRequest implements the common.VM interface
func (*VM) AppRequestFailed ¶
func (vm *VM) AppRequestFailed(ctx context.Context, nodeID ids.NodeID, requestID uint32, appErr *common.AppError) error
AppRequestFailed implements the common.VM interface
func (*VM) AppResponse ¶
func (vm *VM) AppResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, response []byte) error
AppResponse implements the common.VM interface
func (*VM) BuildBlock ¶
BuildBlock implements the snowman.ChainVM interface
func (*VM) Connected ¶
func (vm *VM) Connected(ctx context.Context, nodeID ids.NodeID, nodeVersion *version.Application) error
Connected implements the common.VM interface
func (*VM) CreateHandlers ¶
CreateHandlers implements the common.VM interface
func (*VM) CreateStaticHandlers ¶
CreateStaticHandlers implements the common.VM 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 common.VM interface
func (*VM) CrossChainAppRequestFailed ¶
func (vm *VM) CrossChainAppRequestFailed(ctx context.Context, chainID ids.ID, requestID uint32, appErr *common.AppError) error
CrossChainAppRequestFailed implements the common.VM interface
func (*VM) CrossChainAppResponse ¶
func (vm *VM) CrossChainAppResponse(ctx context.Context, chainID ids.ID, requestID uint32, response []byte) error
CrossChainAppResponse implements the common.VM interface
func (*VM) Disconnected ¶
Disconnected implements the common.VM interface
func (*VM) GetBlockIDAtHeight ¶
GetBlockIDAtHeight implements the snowman.HeightIndexedChainVM interface
func (*VM) HealthCheck ¶
HealthCheck implements the common.VM interface
func (*VM) Initialize ¶
func (vm *VM) Initialize( ctx context.Context, chainCtx *snow.Context, db database.Database, genesisBytes []byte, upgradeBytes []byte, configBytes []byte, toEngine chan<- common.Message, fxs []*common.Fx, appSender common.AppSender, ) error
Initialize implements the snowman.ChainVM interface
func (*VM) LastAccepted ¶
LastAccepted implements the snowman.ChainVM interface
func (*VM) ParseBlock ¶
ParseBlock implements the snowman.ChainVM interface
func (*VM) SetPreference ¶
SetPreference implements the snowman.ChainVM interface