quantumvm

package
v1.7.36 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2026 License: BSD-3-Clause Imports: 27 Imported by: 0

README

Q-chain Virtual Machine (QVM)

The Q-chain Virtual Machine (QVM) hosts the Q lane of Lux's parallel-witness finality model (LP-020 Quasar). When the operator-selected witness set includes WitnessQ (policies PolicyPQ or PolicyQuantum), Q-Chain runs a Corona 2-round threshold ceremony per consensus round and emits the resulting threshold signature as the round's Q-witness. Q-Chain is one of three parallel finality producers (P, Q, Z); adding it does not change finality latency, only parallel verification cost.

The VM also provides per-validator ML-DSA-65 (FIPS 204) identity signatures and a quantum stamp for individual transactions.

Features

Q-witness production (Quasar parallel-witness finality)
  • Corona threshold (Module-LWE, the two-round Corona construction, eprint 2024/1113): 2-round threshold signing per consensus round, t = ⌊2n/3⌋ + 1 of n validators, combined public key rooted in qchain_ceremony_root.
  • Per-validator ML-DSA-65 (FIPS 204): identity signatures over round digests, used by the Z lane (chains/zkvm) to produce the Groth16 rollup.
  • Quantum stamp: time-windowed transaction-level binding.
Performance Optimization
  • Parallel Transaction Processing: Process multiple transactions concurrently
  • Configurable Batch Sizes: Optimize throughput based on network conditions
  • Worker Pool Architecture: Efficient resource utilization with pooled workers
Configuration

The QVM can be configured through the config.Config structure:

type Config struct {
    MaxParallelTxs          int           // Maximum parallel transactions
    QuantumAlgorithmVersion uint32        // 1=ML-DSA-44, 2=ML-DSA-65, 3=ML-DSA-87
    QuantumStampEnabled     bool          // Enable quantum stamp validation
    QuantumStampWindow      time.Duration // Validity window for quantum stamps
    ParallelBatchSize       int           // Batch size for parallel processing
    CoronaEnabled           bool          // Enable Corona key support
    GPUBatchThreshold       int           // Batch size at which GPU verification takes over
}

There is no fee schedule. Q-Chain has no user-payable blockspace (LP-0130 §6): finality-cert inclusion is a validator obligation paid through P-Chain reward distribution, so IssueTx refuses every user transaction whatever it offers, and state advances only through consensus-internal cert aggregation.

Architecture

Core Components
  1. VM (vm.go): Main virtual machine implementation
  2. Factory (factory.go): VM factory for creating QVM instances
  3. Config (config/config.go): Configuration management
  4. Quantum Signer (quantum/signer.go): Quantum signature implementation
Transaction Flow
  1. Transactions are submitted to the transaction pool
  2. Worker threads process transactions in parallel batches
  3. Quantum signatures are verified using the quantum signer
  4. Valid transactions are included in blocks
  5. Blocks are signed at the CONSENSUS layer (Quasar BLS + Corona), never on the wire — the block id is the hash of its own bytes, so a signature inside it would give two honest nodes two ids for one block
RPC API

The QVM exposes the following RPC endpoints:

  • qvm.getBlock: Retrieve a block by ID
  • qvm.generateCoronaKey: Generate a new Corona key pair
  • qvm.verifyQuantumSignature: Verify a quantum signature
  • qvm.getPendingTransactions: Get pending transactions
  • qvm.getHealth: Get VM health status
  • qvm.getConfig: Get current configuration

Security Features

Quantum Signatures

The QVM uses ML-DSA (FIPS 204, NIST module-lattice DSA) for per-validator quantum-resistant signatures:

  • ML-DSA-44/65/87 supported (NIST Level 2/3/5)
  • Quantum stamp: time-windowed binding of message + nonce + timestamp, prevents stamp replay
  • GPU batch verification via accel.DilithiumVerifyBatch (accel.Available(), threshold 64+ signatures)
Validator key material

Two distinct categories live on Q-Chain validators:

  • Per-validator ML-DSA-65 identity key: MLDSAValidatorKey in quantum/signer.go (kept exposed via the legacy GenerateCoronaKey RPC name). Used for individual round attestations and the Z-witness rollup input.
  • Corona threshold share: per-validator share of the combined Corona key, produced by the Q-Chain DKG ceremony (rooted in qchain_ceremony_root). Lives in luxfi/threshold/protocols/corona.
Parallel Processing Safety
  • Thread-safe transaction pool with mutex protection
  • Isolated worker threads for transaction processing
  • Atomic operations for state updates

Usage

Creating a QVM Instance
factory := &qvm.Factory{
    Config: config.DefaultConfig(),
}

vm, err := factory.New(logger)
if err != nil {
    return err
}
Initializing the VM
err := vm.Initialize(
    ctx,
    chainRuntime,
    db,
    genesisBytes,
    upgradeBytes,
    configBytes,
    toEngine,
    fxs,
    appSender,
)
Building Blocks
block, err := vm.BuildBlock(ctx)
if err != nil {
    return err
}

Testing

The QVM includes comprehensive error handling and logging for production use:

  • Error recovery for parallel processing failures
  • Detailed logging at all levels (Info, Debug, Error)
  • Health check monitoring
  • Metrics collection

Future Enhancements

Planned improvements include:

  • Additional quantum-resistant algorithms (SPHINCS+, Dilithium, Falcon)
  • Enhanced parallel processing with GPU acceleration
  • Cross-chain quantum signature verification
  • Advanced caching strategies for improved performance

License

Copyright (C) 2019-2025, Lux Industries Inc All rights reserved. See the file LICENSE for licensing terms.

Documentation

Index

Constants

View Source
const MaxBlockSize = 2 << 20 // 2 MiB

MaxBlockSize bounds a block on the wire. Without it a peer decides how much memory this node allocates and how much its store holds: parse, verify and commit each walked whatever arrived.

View Source
const MaxFutureSkew = 60 * time.Second

MaxFutureSkew is how far ahead of the verifying node's clock a proposer may stamp a block. Peers' clocks differ, and this is the allowance for that; an uncapped timestamp is a proposer writing chain time, which is what decides whether the NEXT block may be stamped at all.

View Source
const Version = "1.0.0"

Version of the QVM

Variables

View Source
var VMID = ids.ID{'q', 'u', 'a', 'n', 't', 'u', 'm', 'v', 'm'}

VMID is the unique identifier for QuantumVM (Q-Chain)

Functions

This section is empty.

Types

type BaseTransaction

type BaseTransaction struct {
	// contains filtered or unexported fields
}

BaseTransaction provides common transaction functionality

func (*BaseTransaction) Bytes

func (tx *BaseTransaction) Bytes() []byte

Bytes returns the transaction's canonical ZAP wire. It excludes the quantum signature (which signs over exactly these bytes).

func (*BaseTransaction) Execute

func (tx *BaseTransaction) Execute() error

Execute executes the transaction

func (*BaseTransaction) Fee added in v1.2.6

func (tx *BaseTransaction) Fee() uint64

Fee returns the user-paid tx burn (nLUX).

func (*BaseTransaction) GetQuantumSignature

func (tx *BaseTransaction) GetQuantumSignature() *quantum.QuantumSignature

GetQuantumSignature returns the quantum signature

func (*BaseTransaction) ID

func (tx *BaseTransaction) ID() ids.ID

ID returns the transaction ID — the content hash of the canonical ZAP wire (sha256(Bytes())), matching the other VMs in this repo. The prior ids.ToID(Bytes()) required an exactly-32-byte input and silently yielded ids.Empty for the always-≥32-byte wire, collapsing every tx to one pool slot.

func (*BaseTransaction) Timestamp

func (tx *BaseTransaction) Timestamp() time.Time

Timestamp returns the transaction timestamp

func (*BaseTransaction) Verify

func (tx *BaseTransaction) Verify() error

Verify verifies the transaction

type Block

type Block struct {
	// contains filtered or unexported fields
}

Block represents a QVM block with quantum features

func (*Block) Accept

func (b *Block) Accept(ctx context.Context) error

Accept makes the block the tip: commitBlock admits it, applies it and persists it as one step.

Nothing is dropped from the mempool until that succeeds. Evicting first would lose the transactions of a block that then failed to persist.

func (*Block) Bytes

func (b *Block) Bytes() []byte

Bytes returns the block's canonical ZAP wire (cached).

func (*Block) Height

func (b *Block) Height() uint64

Height returns the block height

func (*Block) ID

func (b *Block) ID() ids.ID

ID returns the block ID

func (*Block) Parent

func (b *Block) Parent() ids.ID

Parent returns the parent block ID

func (*Block) ParentID

func (b *Block) ParentID() ids.ID

ParentID returns the parent block ID (implements consensus Block interface)

func (*Block) Reject

func (b *Block) Reject(context.Context) error

Reject discards the block. Nothing ran — execution belongs to Accept — and its transactions are still in the mempool, because BuildBlock copies from the queue rather than draining it and only Accept removes anything. So there is nothing to undo and nothing to give back.

func (*Block) Status

func (b *Block) Status() uint8

Status reports 0 while the block is only proposed and 1 once it is stored. A stored block is an accepted one: Accept is the only writer, and it commits the block and the tip pointer together.

func (*Block) String

func (b *Block) String() string

String returns a string representation of the block

func (*Block) Timestamp

func (b *Block) Timestamp() time.Time

Timestamp returns the block timestamp (implements block.Block interface)

func (*Block) TimestampUnix

func (b *Block) TimestampUnix() int64

TimestampUnix returns the block timestamp as Unix seconds.

func (*Block) Verify

func (b *Block) Verify(ctx context.Context) error

Verify decides whether the block may be built on, without changing any state.

It sits on its parent in both height and time. Checking only that the parent EXISTS lets a proposer pick height and timestamp freely: it can name genesis as the parent of a height-500 block, rewind chain time to revive expired quantum stamps, or jump forward and expire every stamp in flight at once.

type BlockSummary added in v1.7.35

type BlockSummary struct {
	ID       string `json:"id"`
	ParentID string `json:"parentID"`
	Height   uint64 `json:"height"`
}

BlockSummary is how a block appears over RPC.

type Factory

type Factory struct {
	config.Config
}

Factory implements vms.Factory interface for creating QVM instances

func (*Factory) New

func (f *Factory) New(logger log.Logger) (interface{}, error)

New creates a new QVM instance. The config is normalised and checked once, in Initialize, so a VM built here and a VM built by hand start from the same rules.

type GenerateCoronaKeyArgs added in v1.2.3

type GenerateCoronaKeyArgs struct{}

GenerateCoronaKeyArgs are the arguments for GenerateCoronaKey

type GenerateCoronaKeyReply added in v1.2.3

type GenerateCoronaKeyReply struct {
	PublicKey string `json:"publicKey"`
	Version   uint32 `json:"version"`
	KeySize   int    `json:"keySize"`
}

GenerateCoronaKeyReply is the reply for GenerateCoronaKey

type GetBlockArgs

type GetBlockArgs struct {
	BlockID string `json:"blockID"`
}

GetBlockArgs are the arguments for GetBlock

type GetBlockReply

type GetBlockReply struct {
	Block      BlockSummary `json:"block"`
	Height     uint64       `json:"height"`
	Timestamp  int64        `json:"timestamp"`
	TxCount    int          `json:"txCount"`
	QuantumSig bool         `json:"quantumSig"`
}

GetBlockReply is the reply for GetBlock

type GetConfigArgs

type GetConfigArgs struct{}

GetConfigArgs are the arguments for GetConfig

type GetConfigReply

type GetConfigReply struct {
	MaxParallelTxs          int    `json:"maxParallelTxs"`
	QuantumAlgorithmVersion uint32 `json:"quantumAlgorithmVersion"`
	QuantumStampEnabled     bool   `json:"quantumStampEnabled"`
	CoronaEnabled           bool   `json:"coronaEnabled"`
	ParallelBatchSize       int    `json:"parallelBatchSize"`
}

GetConfigReply is the reply for GetConfig. It reports what actually governs the chain — no fee schedule, because Q-Chain charges none (LP-0130 §6).

type GetHealthArgs

type GetHealthArgs struct{}

GetHealthArgs are the arguments for GetHealth

type GetHealthReply

type GetHealthReply struct {
	Healthy         bool   `json:"healthy"`
	Version         string `json:"version"`
	QuantumEnabled  bool   `json:"quantumEnabled"`
	CoronaEnabled   bool   `json:"coronaEnabled"`
	PendingTxCount  int    `json:"pendingTxCount"`
	ParallelWorkers int    `json:"parallelWorkers"`
}

GetHealthReply is the reply for GetHealth

type GetPendingTransactionsArgs

type GetPendingTransactionsArgs struct {
	Limit int `json:"limit"`
}

GetPendingTransactionsArgs are the arguments for GetPendingTransactions

type GetPendingTransactionsReply

type GetPendingTransactionsReply struct {
	Transactions []TransactionSummary `json:"transactions"`
	Count        int                  `json:"count"`
}

GetPendingTransactionsReply is the reply for GetPendingTransactions

type PendingBlock

type PendingBlock struct {
	BlockID    ids.ID
	BlockHash  []byte
	Height     uint64
	Signatures []*quasar.QuasarSig
	Finalized  bool
}

PendingBlock tracks a block gathering signatures. Every signature in the slice has been verified against BlockHash and against the registered key of the validator it names, and no two name the same validator.

type Quasar

type Quasar struct {
	// contains filtered or unexported fields
}

Quasar collects validator signatures for Q-Chain blocks and finalizes a block once the quorum's aggregate signature verifies.

The core underneath signs with the validator's BLS key and, in the same call, attests the same message with that validator's ML-DSA-65 identity key (FIPS 204) — so the post-quantum half rides inside every signature this collects, and VerifyQuasarSig checks both halves or rejects.

func NewQuasar

func NewQuasar(cfg QuasarConfig) (*Quasar, error)

NewQuasar creates the finality bridge and registers this node with the consensus core as its own validator.

Registration is not optional and not deferred, because a bridge that cannot sign for its own identity does nothing at all: SignMessage answers "validator not found", so no signature is ever recorded, so no peer signature ever finds a block to attach to, so the quorum is never reached and finality is unreachable — silently, one warning line per block.

The committee must be able to survive a fault. Below config.CommitteeMin the quorum ⌊2n/3⌋+1 is the entire committee, which the consensus core refuses outright and which would in any case make one absent validator a halt and one dishonest validator the decision.

func (*Quasar) AddSignature added in v1.7.35

func (q *Quasar) AddSignature(blockID ids.ID, sig *quasar.QuasarSig) error

AddSignature admits a peer's signature for a block this node is tracking.

func (*Quasar) AddValidator

func (q *Quasar) AddValidator(validatorID string, weight uint64) error

AddValidator registers a validator with the consensus core. Only a registered validator's signature can verify, so this is what decides whose statements count toward the quorum.

The committee is a SET, and it is the set the threshold was derived from. Registering an id twice hands the core a fresh key for it, which silently invalidates every signature that validator has already contributed; registering more validators than the committee declares makes the threshold a quorum of a committee that no longer exists.

func (*Quasar) Cleanup

func (q *Quasar) Cleanup(minHeight uint64)

Cleanup drops every block tracked below minHeight.

The height is the caller's finalized frontier, so a block beneath it will never gather another signature whether it finalized or not. Keeping only the finalized ones meant the entries that could not be cleaned up were exactly the ones that accumulated: every proposal that lost, timed out, or failed to sign stayed in both maps for the life of the process.

func (*Quasar) Committee added in v1.7.35

func (q *Quasar) Committee() int

Committee returns the committee size the threshold was derived from.

func (*Quasar) GetActiveValidators

func (q *Quasar) GetActiveValidators() int

GetActiveValidators returns the count of registered validators.

func (*Quasar) GetQuasar

func (q *Quasar) GetQuasar() *quasar.Quasar

GetQuasar returns the underlying Quasar core engine

func (*Quasar) GetThreshold

func (q *Quasar) GetThreshold() int

GetThreshold returns how many validators must sign a block.

func (*Quasar) IsFinalized

func (q *Quasar) IsFinalized(blockID ids.ID) bool

IsFinalized checks if a block has been finalized

func (*Quasar) SignBlock

func (q *Quasar) SignBlock(ctx context.Context, blockID ids.ID, blockHash []byte, height uint64) (*quasar.QuasarSig, error)

SignBlock signs a block with this node's validator key and records the signature. Signing the same block again returns the signature already recorded: one validator makes one statement about one block.

func (*Quasar) TryFinalize

func (q *Quasar) TryFinalize(ctx context.Context, blockID ids.ID) (*quasar.AggregatedSignature, bool, error)

TryFinalize finalizes a block once the quorum's signatures aggregate into a signature that verifies over the block.

Reaching the count is necessary and not sufficient: the aggregate is built and checked, and only a check that passes finalizes anything.

func (*Quasar) VerifyAggregate added in v1.7.35

func (q *Quasar) VerifyAggregate(ctx context.Context, message []byte, agg *quasar.AggregatedSignature) bool

VerifyAggregate reports whether an aggregated signature checks out over a message: the aggregate itself against the aggregated keys of the DISTINCT registered validators it names, at or above the threshold.

func (*Quasar) VerifySignature added in v1.7.35

func (q *Quasar) VerifySignature(message []byte, sig *quasar.QuasarSig) bool

VerifySignature reports whether one validator signature checks out over a message.

type QuasarBridge

type QuasarBridge = Quasar

QuasarBridge is the Q-Chain finality bridge.

func NewQuasarBridge

func NewQuasarBridge(cfg QuasarBridgeConfig) (*QuasarBridge, error)

NewQuasarBridge creates a new Quasar bridge (alias for NewQuasar)

type QuasarBridgeConfig

type QuasarBridgeConfig = QuasarConfig

QuasarBridgeConfig is an alias for QuasarConfig

type QuasarConfig

type QuasarConfig struct {
	ValidatorID string
	Committee   int
	Logger      log.Logger
}

QuasarConfig configures the finality bridge. The committee size is the only quorum input: the threshold follows from it, so the two cannot be set to disagree.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service provides QVM RPC service

func (*Service) GenerateCoronaKey added in v1.2.3

func (s *Service) GenerateCoronaKey(r *http.Request, args *GenerateCoronaKeyArgs, reply *GenerateCoronaKeyReply) error

GenerateCoronaKey generates a new Corona key pair

func (*Service) GetBlock

func (s *Service) GetBlock(r *http.Request, args *GetBlockArgs, reply *GetBlockReply) error

GetBlock returns a block by ID

func (*Service) GetConfig

func (s *Service) GetConfig(r *http.Request, args *GetConfigArgs, reply *GetConfigReply) error

GetConfig returns the QVM configuration

func (*Service) GetHealth

func (s *Service) GetHealth(r *http.Request, args *GetHealthArgs, reply *GetHealthReply) error

GetHealth returns the health status of the QVM

func (*Service) GetPendingTransactions

func (s *Service) GetPendingTransactions(r *http.Request, args *GetPendingTransactionsArgs, reply *GetPendingTransactionsReply) error

GetPendingTransactions returns pending transactions

func (*Service) VerifyQuantumSignature

func (s *Service) VerifyQuantumSignature(r *http.Request, args *VerifyQuantumSignatureArgs, reply *VerifyQuantumSignatureReply) error

VerifyQuantumSignature verifies a quantum signature

type Transaction

type Transaction interface {
	ID() ids.ID
	Bytes() []byte
	Verify() error
	Execute() error
	GetQuantumSignature() *quantum.QuantumSignature
	Timestamp() time.Time
	// Fee returns the user-paid tx burn in nLUX. Q-Chain's policy is the
	// committee-only sentinel, which refuses every amount (LP-0130 §6).
	Fee() uint64
}

Transaction represents a QVM transaction

type TransactionPool

type TransactionPool struct {
	// contains filtered or unexported fields
}

TransactionPool manages pending transactions

func NewTransactionPool

func NewTransactionPool(maxSize int, logger log.Logger) *TransactionPool

NewTransactionPool creates a new transaction pool

func (*TransactionPool) AddTransaction

func (p *TransactionPool) AddTransaction(tx Transaction) error

AddTransaction adds a transaction to the pool

func (*TransactionPool) Close

func (p *TransactionPool) Close()

Close closes the transaction pool

func (*TransactionPool) GetPendingTransactions

func (p *TransactionPool) GetPendingTransactions(limit int) []Transaction

GetPendingTransactions returns pending transactions up to the limit

func (*TransactionPool) PendingCount

func (p *TransactionPool) PendingCount() int

PendingCount returns the number of pending transactions

func (*TransactionPool) RemoveTransaction

func (p *TransactionPool) RemoveTransaction(txID ids.ID) error

RemoveTransaction removes a transaction from the pool

func (*TransactionPool) WaitForEvent added in v1.7.35

func (p *TransactionPool) WaitForEvent(ctx context.Context) (luxvm.Message, error)

WaitForEvent blocks until there is a transaction to build a block from, or the caller gives up.

type TransactionSummary added in v1.7.35

type TransactionSummary struct {
	ID        string `json:"id"`
	Timestamp int64  `json:"timestamp"`
}

TransactionSummary is how a pending transaction appears over RPC.

type TransactionWorker

type TransactionWorker struct {
	// contains filtered or unexported fields
}

TransactionWorker processes transactions in parallel

func (*TransactionWorker) ProcessBatch

func (w *TransactionWorker) ProcessBatch(txs []Transaction) (valid, rejected []Transaction)

ProcessBatch VERIFIES a batch, reporting what survived and what did not. Both halves matter: the survivors go in the block, and the rest have to leave the pool — a transaction whose quantum stamp has aged out will never verify again, and left in place it holds its slot for good.

It does not execute anything. Effects belong to Accept, on every node, once: running them here ran them on a block the network may never accept, ran them twice when the builder rebuilt, and ran them nowhere at all on a node that received the block rather than building it.

Uses GPU batch ML-DSA verification when available and the batch is large enough.

type VM

type VM struct {
	config.Config

	NetworkID uint32
	// contains filtered or unexported fields
}

VM implements the Q-chain Virtual Machine with quantum features

func (*VM) BuildBlock

func (vm *VM) BuildBlock(ctx context.Context) (chain.Block, error)

BuildBlock builds a new block with pending transactions. Implements chain.ChainVM.

func (*VM) Connected

func (vm *VM) Connected(ctx context.Context, nodeID ids.NodeID, nodeVersion *version.Application) error

Connected notifies the VM that a validator has connected

func (*VM) CreateHandlers

func (vm *VM) CreateHandlers(ctx context.Context) (map[string]http.Handler, error)

CreateHandlers returns HTTP handlers for the VM

func (*VM) CreateStaticHandlers

func (vm *VM) CreateStaticHandlers(ctx context.Context) (map[string]http.Handler, error)

CreateStaticHandlers returns static HTTP handlers

func (*VM) Disconnected

func (vm *VM) Disconnected(ctx context.Context, nodeID ids.NodeID) error

Disconnected notifies the VM that a validator has disconnected

func (*VM) FeePolicy added in v1.2.6

func (vm *VM) FeePolicy() fee.Policy

FeePolicy exposes the chain's declared fee policy for diagnostics and the boot-time Validate gate.

func (*VM) GetBlock

func (vm *VM) GetBlock(ctx context.Context, blockID ids.ID) (chain.Block, error)

GetBlock retrieves a block by its ID. Implements chain.ChainVM.

func (*VM) GetBlockIDAtHeight

func (vm *VM) GetBlockIDAtHeight(ctx context.Context, height uint64) (ids.ID, error)

GetBlockIDAtHeight answers what block this node accepted at a height, from the index Accept writes in the same commit as the block itself. A peer catching up asks by height; the index is what lets the answer be one read rather than a walk back from the tip.

func (*VM) GetQuasarBridge

func (vm *VM) GetQuasarBridge() *QuasarBridge

GetQuasarBridge returns the Quasar threshold-signature bridge.

func (*VM) HealthCheck

func (vm *VM) HealthCheck(ctx context.Context) (chain.HealthResult, error)

HealthCheck returns the health status of the VM. Implements chain.ChainVM, whose signature carries an error the VM has no way to produce.

func (*VM) Initialize

func (vm *VM) Initialize(ctx context.Context, init luxvm.Init) error

Initialize initializes the VM. Implements chain.ChainVM.

func (*VM) IssueTx added in v1.2.6

func (vm *VM) IssueTx(tx Transaction) error

IssueTx is the user-tx admission point on Q-Chain, and it admits nothing. Under NoUserTxPolicy every amount is refused (LP-0130 §6), so there is no path from here into the pool — Q-Chain state advances only through consensus-internal cert aggregation, which reaches txPool.AddTransaction directly and never passes this way.

func (*VM) LastAccepted

func (vm *VM) LastAccepted(ctx context.Context) (ids.ID, error)

LastAccepted returns the last accepted block ID. Implements chain.ChainVM.

func (*VM) NewHTTPHandler

func (vm *VM) NewHTTPHandler(ctx context.Context) (http.Handler, error)

NewHTTPHandler returns the VM's HTTP handler. Implements chain.ChainVM.

func (*VM) ParseBlock

func (vm *VM) ParseBlock(ctx context.Context, blockBytes []byte) (chain.Block, error)

ParseBlock parses a block from bytes. Implements chain.ChainVM.

func (*VM) SetPreference

func (vm *VM) SetPreference(ctx context.Context, blockID ids.ID) error

SetPreference sets the preferred block. Implements chain.ChainVM. Q-Chain finalizes on a verified threshold signature rather than preference, so this is a no-op until preference-based fork choice is wired in.

func (*VM) SetState

func (vm *VM) SetState(ctx context.Context, state uint32) error

SetState sets the VM state. Implements chain.ChainVM.

func (*VM) Shutdown

func (vm *VM) Shutdown(ctx context.Context) error

Shutdown gracefully shuts down the VM

func (*VM) StampBlock

func (vm *VM) StampBlock(blockID ids.ID, pChainHeight uint64, message []byte) (interface{}, error)

StampBlock attests to a message for the finality bridge: a Quasar validator signature when the bridge is up, an ML-DSA signature otherwise.

func (*VM) VerifyStamp

func (vm *VM) VerifyStamp(message []byte, stamp interface{}) error

VerifyStamp checks a stamp against the message it claims to attest.

The message is the argument that makes this a verification. Without it there was nothing to check a signature against, so each arm could only look at the stamp's own shape — and shape is what the sender chose: a two-byte aggregate declaring three signers passed, and so did a one-byte BLS signature. A self-declared signer count is not evidence of anything.

func (*VM) Version

func (vm *VM) Version(ctx context.Context) (string, error)

Version returns the version of the VM

func (*VM) WaitForEvent

func (vm *VM) WaitForEvent(ctx context.Context) (luxvm.Message, error)

WaitForEvent blocks until there is a transaction to build a block from, or the VM stops. Waiting only on the context would mean BuildBlock is never called and the chain never leaves genesis, however many transactions the pool has accepted.

type VerifyQuantumSignatureArgs

type VerifyQuantumSignatureArgs struct {
	Message   string          `json:"message"`
	Signature json.RawMessage `json:"signature"`
}

VerifyQuantumSignatureArgs are the arguments for VerifyQuantumSignature

type VerifyQuantumSignatureReply

type VerifyQuantumSignatureReply struct {
	Valid     bool   `json:"valid"`
	Algorithm uint32 `json:"algorithm"`
}

VerifyQuantumSignatureReply is the reply for VerifyQuantumSignature

Directories

Path Synopsis
cmd
plugin command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL