zkvm

package
v1.7.39 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: BSD-3-Clause Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const MaxTxSize = 1 << 20

MaxTxSize bounds a transaction on the way in, so a peer cannot make this node hold what it would never build.

Variables

View Source
var VMID = ids.ID{'z', 'k', 'v', 'm'}

VMID is the unique identifier for ZKVM (Z-Chain)

View Source
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"`
	Txs            []*Transaction `json:"transactions"`
	StateRoot      []byte         `json:"stateRoot"` // Merkle tree root of UTXO set

	// Cached values
	ID_ ids.ID
	// contains filtered or unexported fields
}

Block represents a block in the ZK UTXO chain

func (*Block) Accept

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

Accept applies the block. Everything below is staged and committed in one batch with the block and the tip, so a spend that cannot be recorded takes the whole block with it.

This used to mark the block accepted and move lastAccepted before writing anything, then issue a Put per nullifier and per output, each returning early. A failure partway left some notes spent and some outputs created, under a tip the chain had already advanced — a shielded pool half applied, with no way back and no way to apply the block again. Whether it still extends the tip is the store's to decide, under the lock that commits. Asking here read the tip, released it, and only then asked for the lock, so a tip that moved in between was answered with a reading taken before it moved.

func (*Block) Bytes

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

Bytes returns the block's canonical encoding, computed once.

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) Marshal added in v1.7.4

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

func (*Block) Parent

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

Parent is an alias for ParentID for compatibility

func (*Block) ParentID

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

ParentID returns the parent block ID

func (*Block) Publish added in v1.7.35

func (b *Block) Publish()

Publish marks the block accepted and releases the transactions it carried. It runs after the commit, so a transaction is only dropped from the mempool once the block that spends it is durable.

func (*Block) Reject

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

Reject rejects the block

func (*Block) Status

func (b *Block) Status() uint8

Status returns the block status

func (*Block) Timestamp

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

Timestamp returns the block timestamp

func (*Block) ToSummary

func (b *Block) ToSummary() *BlockSummary

ToSummary converts a block to a summary

func (*Block) Verify

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

Verify verifies the block.

func (*Block) Write added in v1.7.35

func (b *Block) Write(database.Database) error

Write records the block's spends and its outputs, and advances the committed state root. The three stores were built over this same view at Initialize, so what they write here commits with the block or not at all.

type BlockSummary

type BlockSummary struct {
	ID        ids.ID `json:"id"`
	Height    uint64 `json:"height"`
	Timestamp int64  `json:"timestamp"`
	TxCount   int    `json:"txCount"`
	StateRoot []byte `json:"stateRoot"`
}

BlockSummary represents a lightweight block summary

type Factory

type Factory = chain.Factory[VM]

Factory creates Z-Chain VM instances.

type Genesis

type Genesis struct {
	Timestamp  int64          `json:"timestamp"`
	InitialTxs []*Transaction `json:"initialTransactions,omitempty"`

	// Initial setup parameters
	SetupParams *SetupParams `json:"setupParams,omitempty"`
}

Genesis represents genesis data

func ParseGenesis

func ParseGenesis(genesisBytes []byte) (*Genesis, error)

ParseGenesis parses genesis bytes (supports both JSON and Codec formats)

type Groth16Proof

type Groth16Proof struct {
	Ar  bn254.G1Affine // Proof component A
	Bs  bn254.G2Affine // Proof component B
	Krs bn254.G1Affine // Proof component C
}

Groth16Proof represents a Groth16 proof structure

type Groth16VerifyingKey

type Groth16VerifyingKey struct {
	Alpha bn254.G1Affine   // Alpha in G1
	Beta  bn254.G2Affine   // Beta in G2
	Gamma bn254.G2Affine   // Gamma in G2
	Delta bn254.G2Affine   // Delta in G2
	K     []bn254.G1Affine // K[i] for public inputs
}

Groth16VerifyingKey represents a Groth16 verifying key

type Mempool

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

Mempool manages pending transactions

func NewMempool

func NewMempool(maxSize int, log log.Logger) *Mempool

NewMempool creates a new mempool

func (*Mempool) AddTransaction

func (mp *Mempool) AddTransaction(tx *Transaction) error

AddTransaction adds a transaction to the mempool.

The id is derived here, not read from the caller. An HTTP client decoding straight into a Transaction supplies whatever id it likes, and a proposer that carried that id would compute a block id its own peers do not — the block it built would not be the block they see.

func (*Mempool) GetPendingTransactions

func (mp *Mempool) GetPendingTransactions(limit int) []*Transaction

GetPendingTransactions returns pending transactions sorted by priority

func (*Mempool) HasTransaction

func (mp *Mempool) HasTransaction(txID ids.ID) bool

HasTransaction checks if a transaction is in the mempool

func (*Mempool) PruneExpired

func (mp *Mempool) PruneExpired(currentHeight uint64)

PruneExpired drops transactions the chain has passed. Nothing else does: a transaction that can never enter a block occupies a slot forever, and a pool full of those refuses every honest arrival that pays the same floor.

func (*Mempool) RemoveTransaction

func (mp *Mempool) RemoveTransaction(txID ids.ID)

RemoveTransaction removes a transaction from the mempool

func (*Mempool) Size

func (mp *Mempool) Size() int

Size returns the number of transactions in the mempool

func (*Mempool) WaitForEvent added in v1.7.35

func (mp *Mempool) WaitForEvent(ctx context.Context) (vmcore.Message, error)

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

type MempoolTx

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

MempoolTx represents a transaction in the mempool

type NullifierDB

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

NullifierDB is the spent set: the whole of what stops a shielded note being spent twice.

func NewNullifierDB

func NewNullifierDB(db database.Database, log log.Logger) (*NullifierDB, error)

NewNullifierDB creates a new nullifier database

func (*NullifierDB) Close

func (ndb *NullifierDB) Close()

Close closes the nullifier database

func (*NullifierDB) GetNullifierCount

func (ndb *NullifierDB) GetNullifierCount() uint64

GetNullifierCount returns the number of spent nullifiers, counted off the set itself. Every record is loaded at startup and nullifiers are never pruned, so the set is the whole of them; a total kept alongside would be a second write that has to agree with the first, and this cannot disagree with what it describes.

func (*NullifierDB) MarkNullifierSpent

func (ndb *NullifierDB) MarkNullifierSpent(nullifier []byte, height uint64) error

MarkNullifierSpent records a spend.

func (*NullifierDB) Spent added in v1.7.36

func (ndb *NullifierDB) Spent(nullifier []byte) (uint64, bool, error)

Spent reports whether a nullifier has been spent and at what height.

It is ONE question with one answer, because the two it used to be — IsNullifierSpent returning a bool and GetNullifierHeight returning a height — could not report a failed read at all. `_, err := Get(key); return err == nil` answers "not spent" for a set that could not be read, and that answer is what lets an already-spent note be spent again. A read that failed is an error here, and verifyTransaction refuses the transaction rather than admitting it.

A miss falls through to the records and returns what it finds without memoising it. Memoising would be a write on a path that holds only the read lock, and a read lock promises every other reader that nothing is changing: two callers missing at once would write the same map at the same time, which is a runtime throw, not a returned error. The write lock is not the answer either — it would serialise every reader of a path consensus and RPC both sit on, to save a lookup the set already answers.

type ProofVerifier

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

ProofVerifier verifies zero-knowledge proofs. When verifying keys are all zeros (dummy), proof verification is disabled and VerifyProof returns an error. This is fail-closed by design.

func NewProofVerifier

func NewProofVerifier(config ZConfig, bind [32]byte, log log.Logger) (*ProofVerifier, error)

NewProofVerifier creates a new proof verifier

func (*ProofVerifier) GetCacheSize

func (pv *ProofVerifier) GetCacheSize() int

GetCacheSize returns the current size of the proof cache

func (*ProofVerifier) GetStats

func (pv *ProofVerifier) GetStats() (verifyCount, cacheHits, cacheMisses uint64)

GetStats returns verifier statistics

func (*ProofVerifier) VerifyTransactionProof

func (pv *ProofVerifier) VerifyTransactionProof(tx *Transaction) error

VerifyTransactionProof verifies a transaction's zero-knowledge proof. Returns an error if verifying keys are dummy (all zeros).

func (*ProofVerifier) VerifyingKeysLoaded

func (pv *ProofVerifier) VerifyingKeysLoaded() bool

VerifyingKeysLoaded returns true if real (non-dummy) verifying keys are loaded.

type Root added in v1.7.36

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

Root is the committed state root and the fold that produces the next one.

It was a "sparse Merkle tree": 256 levels, a node cache, GetMerkleProof and VerifyMerkleProof. None of it was reachable — the root is the SHA-256 fold below and always was — and the unreachable half held a map written under a READ lock, which in Go is a fatal throw rather than a bug you get to debug. A type named for a structure it does not have costs exactly that.

func NewRoot added in v1.7.36

func NewRoot(db database.Database, log log.Logger) (*Root, error)

NewRoot opens the committed state root.

func (*Root) After added in v1.7.36

func (r *Root) After(txs []*Transaction) []byte

After returns the state root that results from applying txs on top of the committed root, as SHA-256 over

committed ‖ every output commitment (tx order) ‖ every nullifier (tx order)

It is PURE: nothing is mutated, so computing a root is safe inside Block.Verify. Verifying the same block twice, or verifying a block that is later rejected and then verifying its competitor, all yield the root that block's proposer computed. Only Finalize advances the committed root, and only Accept calls Finalize.

There is exactly ONE root function. A hardware-conditional digest (a GPU Poseidon path with a SHA-256 fallback) would make the consensus-committed root depend on whether the node has an accelerator, so validators with and without one would reject each other's blocks.

func (*Root) Close added in v1.7.36

func (r *Root) Close()

Close releases the root.

func (*Root) Finalize added in v1.7.36

func (r *Root) Finalize(next []byte) error

Finalize advances the committed root. It is the only mutation, and Accept is its only caller.

func (*Root) Get added in v1.7.36

func (r *Root) Get() []byte

Get returns the committed state root.

type SetupParams

type SetupParams struct {
	// Groth16 CRS
	PowersOfTau  []byte `json:"powersOfTau,omitempty"`
	VerifyingKey []byte `json:"verifyingKey,omitempty"`

	// PLONK setup
	PlonkSRS []byte `json:"plonkSRS,omitempty"`

	// FHE parameters
	FHEPublicParams []byte `json:"fhePublicParams,omitempty"`
}

SetupParams contains trusted setup parameters

type ShieldedOutput

type ShieldedOutput struct {
	// Commitment to the note (amount and address)
	Commitment []byte `json:"commitment"`

	// Encrypted note ciphertext
	EncryptedNote []byte `json:"encryptedNote"`

	// Ephemeral public key for note encryption
	EphemeralPubKey []byte `json:"ephemeralPubKey"`

	// Output proof (rangeproof for amount)
	OutputProof []byte `json:"outputProof"`
}

ShieldedOutput represents a confidential output

type Transaction

type Transaction struct {
	ID      ids.ID          `json:"id"`
	Type    TransactionType `json:"type"`
	Version uint8           `json:"version"`

	// Transparent inputs/outputs (for shield/unshield)
	TransparentInputs  []*TransparentInput  `json:"transparentInputs,omitempty"`
	TransparentOutputs []*TransparentOutput `json:"transparentOutputs,omitempty"`

	// Shielded components
	Nullifiers [][]byte          `json:"nullifiers"` // Spent note nullifiers
	Outputs    []*ShieldedOutput `json:"outputs"`    // New shielded outputs

	// Zero-knowledge proof
	Proof *ZKProof `json:"proof"`

	// Transaction metadata
	Fee    uint64 `json:"fee"`
	Expiry uint64 `json:"expiry"`         // Block height
	Memo   []byte `json:"memo,omitempty"` // Encrypted memo
}

Transaction represents a confidential transaction

func (*Transaction) ComputeID

func (tx *Transaction) ComputeID() ids.ID

ComputeID is the transaction's identity: a hash over everything the transaction means. It is NOT carried on the wire — parseTransaction derives it — because an identity a peer supplies is an identity a peer chooses, and the proof cache is keyed on it: copy an accepted transaction's id, proof and public inputs onto a transaction spending different notes and the cache answers nil before anything binds the proof to what it spends.

Every variable-length field is written with its length first and every list with its count. Concatenated raw, a byte could move from the end of one field to the start of the next without the hash noticing — ["ab","c"] and ["a","bc"] are the same bytes — and two transactions sharing an identity is what consensus decides between blocks with.

func (*Transaction) GetNullifiers

func (tx *Transaction) GetNullifiers() [][]byte

GetNullifiers returns all nullifiers in the transaction

func (*Transaction) GetOutputCommitments

func (tx *Transaction) GetOutputCommitments() [][]byte

GetOutputCommitments returns all output commitments

func (*Transaction) Marshal added in v1.7.4

func (tx *Transaction) Marshal() []byte

func (*Transaction) ValidateBasic

func (tx *Transaction) ValidateBasic() error

ValidateBasic performs basic validation

type TransactionType

type TransactionType uint8

TransactionType represents the type of transaction

const (
	TransactionTypeTransfer TransactionType = iota
	TransactionTypeMint
	TransactionTypeBurn
	TransactionTypeShield   // Convert transparent to shielded
	TransactionTypeUnshield // Convert shielded to transparent
)

type TransparentInput

type TransparentInput struct {
	TxID      ids.ID `json:"txId"`
	OutputIdx uint32 `json:"outputIdx"`
	Amount    uint64 `json:"amount"`
	Address   []byte `json:"address"`
}

TransparentInput represents an unshielded input

type TransparentOutput

type TransparentOutput struct {
	Amount  uint64 `json:"amount"`
	Address []byte `json:"address"`
	AssetID ids.ID `json:"assetId"`
}

TransparentOutput represents an unshielded output

type TxHeap

type TxHeap []*MempoolTx

TxHeap implements heap.Interface for priority ordering

func (TxHeap) Len

func (h TxHeap) Len() int

func (TxHeap) Less

func (h TxHeap) Less(i, j int) bool

func (*TxHeap) Pop

func (h *TxHeap) Pop() interface{}

func (*TxHeap) Push

func (h *TxHeap) Push(x interface{})

func (TxHeap) Swap

func (h TxHeap) Swap(i, j int)

type UTXO

type UTXO struct {
	TxID        ids.ID `json:"txId"`
	OutputIndex uint32 `json:"outputIndex"`
	Commitment  []byte `json:"commitment"`  // Output commitment
	Ciphertext  []byte `json:"ciphertext"`  // Encrypted note
	EphemeralPK []byte `json:"ephemeralPK"` // Ephemeral public key
	Height      uint64 `json:"height"`      // Block height when created
}

UTXO represents an unspent transaction output

func (*UTXO) Marshal added in v1.7.4

func (u *UTXO) Marshal() []byte

type UTXODB

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

UTXODB manages the UTXO set

func NewUTXODB

func NewUTXODB(db database.Database, log log.Logger) (*UTXODB, error)

NewUTXODB creates a new UTXO database

func (*UTXODB) AddUTXO

func (udb *UTXODB) AddUTXO(utxo *UTXO) error

AddUTXO adds a new UTXO to the set

func (*UTXODB) Close

func (udb *UTXODB) Close()

Close closes the UTXO database

func (*UTXODB) GetUTXO

func (udb *UTXODB) GetUTXO(commitment []byte) (*UTXO, error)

GetUTXO retrieves a UTXO by commitment.

The body comes from the records every time. Memoising it here would be a write on a path that holds only the read lock, and a read lock promises every other reader that nothing is changing: two RPC clients asking for different commitments would write the same map at the same time, which is a runtime throw, not a returned error. The lock is still held so that a read cannot land between the record delete and the set delete a removal does together.

func (*UTXODB) GetUTXOCount

func (udb *UTXODB) GetUTXOCount() uint64

GetUTXOCount returns the total number of UTXOs.

It counts the set rather than reading a running total kept beside it. A total is a second write, and a node that dies between the two comes back with a number that disagrees with its own records — from which one removal drives an unsigned counter below zero and reports 1.8e19 unspent notes forever. Counting the set cannot disagree with the set.

type VM

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

VM implements the Zero-Knowledge UTXO Chain VM

func (*VM) BuildBlock

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

BuildBlock builds a new block. Reading the tip and registering the block on it happen in one step, so nothing can be accepted in between and leave the proposal hanging off a parent that is no longer the tip.

func (*VM) BuildVertex

func (vm *VM) BuildVertex(ctx context.Context) (vertex.Vertex, error)

BuildVertex drains the mempool, batches non-conflicting txs, and returns a vertex.

func (*VM) Connected

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

func (*VM) CreateHandlers

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

CreateHandlers returns the VM handlers, one per route. See endpoints.

func (*VM) CrossChainRequest

func (vm *VM) CrossChainRequest(ctx context.Context, chainID ids.ID, requestID uint32, deadline time.Time, request []byte) error

CrossChainRequest implements the common.VM interface

func (*VM) CrossChainRequestFailed

func (vm *VM) CrossChainRequestFailed(ctx context.Context, chainID ids.ID, requestID uint32, appErr *warp.Error) error

CrossChainRequestFailed implements the common.VM interface

func (*VM) CrossChainResponse

func (vm *VM) CrossChainResponse(ctx context.Context, chainID ids.ID, requestID uint32, response []byte) error

CrossChainResponse implements the common.VM interface

func (*VM) Disconnected

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

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, blkID ids.ID) (vmchain.Block, error)

GetBlock retrieves a block by ID

func (*VM) GetBlockIDAtHeight

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

GetBlockIDAtHeight answers from the height index the store writes in the same commit as the block itself, so the index can never name a block the chain did not accept.

func (*VM) Gossip

func (vm *VM) Gossip(ctx context.Context, nodeID ids.NodeID, msg []byte) error

Gossip implements the common.VM interface

func (*VM) HealthCheck

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

HealthCheck performs a health check

func (*VM) Initialize

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

Initialize initializes the VM

func (*VM) LastAccepted

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

func (*VM) NewHTTPHandler

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

NewHTTPHandler mounts the same routes by path.

func (*VM) ParseBlock

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

ParseBlock parses a block from bytes.

func (*VM) ParseVertex

func (vm *VM) ParseVertex(ctx context.Context, b []byte) (vertex.Vertex, error)

ParseVertex deserializes a vertex from bytes.

func (*VM) Request

func (vm *VM) Request(ctx context.Context, nodeID ids.NodeID, requestID uint32, deadline time.Time, request []byte) error

Request implements the common.VM interface

func (*VM) RequestFailed

func (vm *VM) RequestFailed(ctx context.Context, nodeID ids.NodeID, requestID uint32, appErr *warp.Error) error

RequestFailed implements the common.VM interface

func (*VM) Response

func (vm *VM) Response(ctx context.Context, nodeID ids.NodeID, requestID uint32, response []byte) error

Response implements the common.VM interface

func (*VM) SetPreference

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

SetPreference records the block the engine wants the next one built on. Dropping it meant Propose always built on the accepted tip, so a node with two blocks in flight re-proposed a height it had already proposed.

func (*VM) SetState

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

SetState sets the VM state

func (*VM) Shutdown

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

Shutdown shuts down the VM

func (*VM) StrictPQ added in v1.3.10

func (vm *VM) StrictPQ() bool

StrictPQ reports whether this Z-Chain instance is on the strict-PQ security profile. It is the single bit that gates both the shielded- proof verifier and the classical-precompile registration.

func (*VM) Version

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

Version returns the VM version

func (*VM) WaitForEvent

func (vm *VM) WaitForEvent(ctx context.Context) (vmcore.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 mempool has accepted.

func (*VM) ZKPrecompiles added in v1.3.10

func (vm *VM) ZKPrecompiles() *precompiles.MapRegistry

ZKPrecompiles returns the registered Z-Chain ZK verifier precompiles. On a strict-PQ chain the classical Groth16 (0x80) / PLONK (0x81) addresses resolve to "no precompile" (fail-closed by absence).

type Vertex

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

Vertex represents a DAG vertex in the ZK UTXO chain. Conflict key: set of nullifiers spent in the vertex. Two vertices conflict iff their nullifier sets intersect.

func (*Vertex) Accept

func (v *Vertex) Accept(ctx context.Context) error

Accept applies the vertex through the same store a block goes through: its spends and outputs are staged and committed in one batch with the vertex and the tip. A vertex is not a block — it has several parents and no timestamp — but it changes state the same way, and this is that way. Whether it still extends the tip is the store's to decide, under the lock that commits — the tip moves between Verify and here. See Block.Accept.

func (*Vertex) Bytes

func (v *Vertex) Bytes() []byte

func (*Vertex) Conflicts

func (v *Vertex) Conflicts(other *Vertex) bool

Conflicts returns true if this vertex and other share any nullifier.

func (*Vertex) ConflictsVertex

func (v *Vertex) ConflictsVertex(other vertex.Vertex) bool

ConflictsVertex performs the same check against the vertex.Vertex interface.

func (*Vertex) Epoch

func (v *Vertex) Epoch() uint32

func (*Vertex) Height

func (v *Vertex) Height() uint64

func (*Vertex) ID

func (v *Vertex) ID() ids.ID

func (*Vertex) Parent added in v1.7.39

func (v *Vertex) Parent() ids.ID

Parent is the one block this vertex extends, for a store that keeps one tip. A vertex naming several parents extends no single block and names none here, so the store refuses it rather than committing whichever one came first.

func (*Vertex) Parents

func (v *Vertex) Parents() []ids.ID

func (*Vertex) Publish added in v1.7.35

func (v *Vertex) Publish()

Publish marks the vertex accepted and releases the transactions it carried, once those spends are durable.

func (*Vertex) Reject

func (v *Vertex) Reject(ctx context.Context) error

func (*Vertex) Status

func (v *Vertex) Status() choices.Status

func (*Vertex) Txs

func (v *Vertex) Txs() []ids.ID

func (*Vertex) Verify

func (v *Vertex) Verify(ctx context.Context) error

Verify holds a vertex to what a block is held to. It used to check the transactions and NOTHING ELSE — not the parents, not the height — so a vertex naming no parent at height 1<<40 verified, and accepting it set the store's height to 1<<40, pruned every block in flight, and left the linear chain unable to propose a child ever again.

func (*Vertex) Write added in v1.7.35

func (v *Vertex) Write(database.Database) error

Write records the vertex's spends and its outputs.

type ZConfig

type ZConfig struct {
	// VerifyingKeys supplies real (non-dummy) verifying keys per circuit
	// type (keyed by the TransactionType string), in-memory at genesis.
	// When empty, loadVerifyingKeys installs all-zero dummy keys (proof
	// verification disabled, fail-closed). On a strict-PQ chain, supplying
	// a real bn254 verifying key here is REFUSED at construction
	// (errStrictPQRealVKForbidden) — shielded value uses STARK/FRI only.
	VerifyingKeys map[string][]byte `json:"verifyingKeys"`

	// StrictPQ HARD-DISABLES the classical (bn254 pairing-based) shielded
	// proof systems on this chain. When true, the shielded-tx ProofVerifier
	// REFUSES groth16/plonk/bulletproofs and accepts ONLY the post-quantum
	// STARK/FRI system (delegated to precompile/starkfri, which fails
	// closed until the prover binding exists). Loading a real (non-dummy)
	// bn254 verifying key on a strict-PQ chain is an ERROR. This is the
	// Lux primary-network posture: a CRQC that breaks bn254 cannot forge a
	// shield/unshield proof to mint or steal shielded value.
	StrictPQ bool `json:"strictPQ"`

	// MaxTxPerBlock bounds a block from either direction: what a proposer
	// assembles and what Verify accepts off the wire. One number, so a peer
	// cannot send a block larger than this node would ever build.
	MaxTxPerBlock uint32 `json:"maxTxPerBlock"`

	// ProofCacheSize bounds the verified-proof cache.
	ProofCacheSize uint32 `json:"proofCacheSize"`
}

ZConfig contains VM configuration. Every field here is read; a knob that changes nothing reads as a control and is not one.

type ZKProof

type ZKProof struct {
	ProofType    string   `json:"proofType"` // groth16, plonk, etc.
	ProofData    []byte   `json:"proofData"`
	PublicInputs [][]byte `json:"publicInputs"`
}

ZKProof represents a zero-knowledge proof

Directories

Path Synopsis
cmd
plugin command
Package fhe provides GPU-accelerated FHE operations for the zkvm.
Package fhe provides GPU-accelerated FHE operations for the zkvm.

Jump to

Keyboard shortcuts

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