Documentation
¶
Overview ¶
Package yvm implements the Y-Chain (Yield-Curve/Years-Proof) Quantum State Ledger A minimal-footprint chain for quantum-safe checkpointing and cross-version asset migration Supports multiple network versions simultaneously via quantum state superposition
Index ¶
- Constants
- Variables
- type AssetMigration
- 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 Entanglement
- type EpochCheckpoint
- type EpochRootTx
- type ForkManager
- func (fm *ForkManager) ClaimMigration(migrationID ids.ID, claimer ids.ShortID) error
- func (fm *ForkManager) CreateForkTransition(transition *ForkTransition) error
- func (fm *ForkManager) GetMigrationPath(fromVersion, toVersion uint32) ([]uint32, error)
- func (fm *ForkManager) GetQuantumState(epoch uint64) (*QuantumState, error)
- func (fm *ForkManager) MigrateAsset(assetID ids.ID, owner ids.ShortID, amount uint64, ...) (*AssetMigration, error)
- func (fm *ForkManager) RegisterVersion(version *NetworkVersion) error
- func (fm *ForkManager) UpdateQuantumState(epoch uint64, chainStates map[string][]byte) error
- type ForkTransition
- type Genesis
- type MigrationRule
- type NetworkVersion
- type QuantumState
- type SPHINCSAggregator
- 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, 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) (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 *snow.Context, db database.Database, ...) error
- func (vm *VM) LastAccepted(ctx context.Context) (ids.ID, error)
- func (vm *VM) ParseBlock(ctx context.Context, blockBytes []byte) (chain.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) SubmitEpochRoot(nodeID ids.NodeID, tx *EpochRootTx) error
- func (vm *VM) Version(ctx context.Context) (string, error)
- type YConfig
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 AssetMigration ¶
type AssetMigration struct {
MigrationID ids.ID `json:"migrationId"`
AssetID ids.ID `json:"assetId"`
Owner ids.ShortID `json:"owner"`
SourceVersion uint32 `json:"sourceVersion"`
TargetVersion uint32 `json:"targetVersion"`
Amount uint64 `json:"amount"`
MigrationProof []byte `json:"migrationProof"`
ClaimedAt *time.Time `json:"claimedAt,omitempty"`
Status string `json:"status"` // pending, migrated, claimed
}
AssetMigration tracks an individual asset migration
type Block ¶
type Block struct {
ParentID ids.ID `json:"parentId"`
BlockHeight uint64 `json:"height"`
BlockTimestamp int64 `json:"timestamp"`
Epoch uint64 `json:"epoch"`
EpochRoots []*EpochRootTx `json:"epochRoots"`
// Fork management
NetworkVersion uint32 `json:"networkVersion,omitempty"`
ForkTransitions []*ForkTransition `json:"forkTransitions,omitempty"`
AssetMigrations []*AssetMigration `json:"assetMigrations,omitempty"`
QuantumState *QuantumState `json:"quantumState,omitempty"`
// Cached values
ID_ ids.ID
// contains filtered or unexported fields
}
Block represents a block in the Y-Chain quantum checkpoint ledger
type Entanglement ¶
type Entanglement struct {
Version1 uint32 `json:"version1"`
Version2 uint32 `json:"version2"`
EntanglementKey []byte `json:"entanglementKey"`
Strength float64 `json:"strength"` // 0.0 to 1.0
}
Entanglement represents entangled states between versions
type EpochCheckpoint ¶
type EpochCheckpoint struct {
Epoch uint64 `json:"epoch"`
Timestamp int64 `json:"timestamp"`
ChainRoots map[string][]byte `json:"chainRoots"`
EpochRootHash []byte `json:"epochRootHash"`
SPHINCSSignature []byte `json:"sphincsSignature"`
BitcoinTxID string `json:"bitcoinTxId,omitempty"`
IPFSHash string `json:"ipfsHash,omitempty"`
}
EpochCheckpoint represents a checkpoint for one epoch
type EpochRootTx ¶
type EpochRootTx struct {
Epoch uint64 `json:"epoch"`
ChainRoots map[string][]byte `json:"chainRoots"`
NodeID ids.NodeID `json:"nodeId"`
SPHINCSig []byte `json:"sphincsSig"`
}
EpochRootTx is the only transaction type on Y-Chain
type ForkManager ¶
type ForkManager struct {
// contains filtered or unexported fields
}
ForkManager manages network versions and transitions
func NewForkManager ¶
func NewForkManager(log log.Logger) *ForkManager
NewForkManager creates a new fork manager
func (*ForkManager) ClaimMigration ¶
ClaimMigration processes a migration claim
func (*ForkManager) CreateForkTransition ¶
func (fm *ForkManager) CreateForkTransition(transition *ForkTransition) error
CreateForkTransition creates a transition between versions
func (*ForkManager) GetMigrationPath ¶
func (fm *ForkManager) GetMigrationPath(fromVersion, toVersion uint32) ([]uint32, error)
GetMigrationPath finds the optimal migration path between versions
func (*ForkManager) GetQuantumState ¶
func (fm *ForkManager) GetQuantumState(epoch uint64) (*QuantumState, error)
GetQuantumState returns the quantum state for an epoch
func (*ForkManager) MigrateAsset ¶
func (fm *ForkManager) MigrateAsset( assetID ids.ID, owner ids.ShortID, amount uint64, fromVersion, toVersion uint32, ) (*AssetMigration, error)
MigrateAsset creates an asset migration between versions
func (*ForkManager) RegisterVersion ¶
func (fm *ForkManager) RegisterVersion(version *NetworkVersion) error
RegisterVersion registers a new network version
func (*ForkManager) UpdateQuantumState ¶
func (fm *ForkManager) UpdateQuantumState(epoch uint64, chainStates map[string][]byte) error
UpdateQuantumState updates the quantum state for an epoch
type ForkTransition ¶
type ForkTransition struct {
FromVersion uint32 `json:"fromVersion"`
ToVersion uint32 `json:"toVersion"`
TransitionEpoch uint64 `json:"transitionEpoch"`
MigrationRules []MigrationRule `json:"migrationRules"`
Status string `json:"status"` // pending, active, completed
}
ForkTransition represents a transition between network versions
type Genesis ¶
type Genesis struct {
Timestamp int64 `json:"timestamp"`
}
Genesis represents the genesis state
type MigrationRule ¶
type MigrationRule struct {
AssetType string `json:"assetType"` // LUX, NFT, Contract, etc.
SourceChain string `json:"sourceChain"`
TargetChain string `json:"targetChain"`
ConversionRatio string `json:"conversionRatio"` // e.g., "1:1", "1000:1"
RequiresClaim bool `json:"requiresClaim"` // Manual claim vs automatic
}
MigrationRule defines how assets migrate between versions
type NetworkVersion ¶
type NetworkVersion struct {
VersionID uint32 `json:"versionId"`
Name string `json:"name"`
ActivationEpoch uint64 `json:"activationEpoch"`
ParentVersion uint32 `json:"parentVersion"`
Features []string `json:"features"`
ChainStates map[string][]byte `json:"chainStates"` // chainID -> state root
}
NetworkVersion represents a specific version/fork of the network
type QuantumState ¶
type QuantumState struct {
ActiveVersions []uint32 `json:"activeVersions"`
StateVector map[uint32]float64 `json:"stateVector"` // version -> probability
Entanglements []Entanglement `json:"entanglements"`
MeasurementTime time.Time `json:"measurementTime"`
}
QuantumState represents the superposition of network states
type SPHINCSAggregator ¶
type SPHINCSAggregator struct {
// contains filtered or unexported fields
}
SPHINCSAggregator handles SPHINCS+ signature aggregation
type VM ¶
type VM struct {
// contains filtered or unexported fields
}
VM implements the Y-Chain Quantum Checkpoint Ledger
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 chain.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 chain.ChainVM interface
func (*VM) LastAccepted ¶
LastAccepted implements the chain.ChainVM interface
func (*VM) ParseBlock ¶
ParseBlock implements the chain.ChainVM interface
func (*VM) SetPreference ¶
SetPreference implements the chain.ChainVM interface
func (*VM) SubmitEpochRoot ¶
func (vm *VM) SubmitEpochRoot(nodeID ids.NodeID, tx *EpochRootTx) error
SubmitEpochRoot allows validators to submit epoch roots
type YConfig ¶
type YConfig struct {
// Epoch configuration
EpochDuration time.Duration `json:"epochDuration"`
// Chains to checkpoint
TrackedChains []string `json:"trackedChains"`
// Bitcoin anchoring (optional)
BitcoinEnabled bool `json:"bitcoinEnabled"`
BitcoinRPC string `json:"bitcoinRPC,omitempty"`
// IPFS archival (optional)
IPFSEnabled bool `json:"ipfsEnabled"`
IPFSGateway string `json:"ipfsGateway,omitempty"`
// Slashing configuration
EnableSlashing bool `json:"enableSlashing"`
SlashingAmount uint64 `json:"slashingAmount"`
// Fork management
EnableForkManagement bool `json:"enableForkManagement"`
SupportedVersions []uint32 `json:"supportedVersions"`
CurrentVersion uint32 `json:"currentVersion"`
}
YConfig contains VM configuration