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) Marshal() ([]byte, error)
- func (b *Block) Parent() ids.ID
- func (b *Block) ParentID() ids.ID
- func (b *Block) Publish()
- func (b *Block) Reject(ctx context.Context) error
- func (b *Block) Status() uint8
- func (b *Block) Timestamp() time.Time
- func (b *Block) ToSummary() *BlockSummary
- func (b *Block) Verify(ctx context.Context) error
- func (b *Block) Write(database.Database) error
- type BlockSummary
- type Factory
- type Genesis
- type Groth16Proof
- type Groth16VerifyingKey
- type Mempool
- func (mp *Mempool) AddTransaction(tx *Transaction) error
- func (mp *Mempool) GetPendingTransactions(limit int) []*Transaction
- func (mp *Mempool) HasTransaction(txID ids.ID) bool
- func (mp *Mempool) PruneExpired(currentHeight uint64)
- func (mp *Mempool) RemoveTransaction(txID ids.ID)
- func (mp *Mempool) Size() int
- func (mp *Mempool) WaitForEvent(ctx context.Context) (vmcore.Message, error)
- type MempoolTx
- type NullifierDB
- type PLONKProof
- type PLONKVerifyingKey
- type ProofVerifier
- func (pv *ProofVerifier) GetCacheSize() int
- func (pv *ProofVerifier) GetStats() (verifyCount, cacheHits, cacheMisses uint64)
- func (pv *ProofVerifier) VerifyBlockProof(block *Block) error
- func (pv *ProofVerifier) VerifyTransactionProof(tx *Transaction) error
- func (pv *ProofVerifier) VerifyingKeysLoaded() bool
- type Root
- type SetupParams
- type ShieldedOutput
- type Transaction
- type TransactionType
- type TransparentInput
- type TransparentOutput
- type TxHeap
- type UTXO
- type UTXODB
- type VM
- func (vm *VM) BuildBlock(ctx context.Context) (vmchain.Block, error)
- func (vm *VM) BuildVertex(ctx context.Context) (vertex.Vertex, error)
- func (vm *VM) Connected(ctx context.Context, nodeID ids.NodeID, nodeVersion *vmchain.VersionInfo) error
- func (vm *VM) CreateHandlers(context.Context) (map[string]http.Handler, error)
- func (vm *VM) CrossChainRequest(ctx context.Context, chainID ids.ID, requestID uint32, deadline time.Time, ...) error
- func (vm *VM) CrossChainRequestFailed(ctx context.Context, chainID ids.ID, requestID uint32, appErr *warp.Error) error
- func (vm *VM) CrossChainResponse(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) FeePolicy() fee.Policy
- func (vm *VM) GetBlock(ctx context.Context, blkID ids.ID) (vmchain.Block, error)
- func (vm *VM) GetBlockIDAtHeight(ctx context.Context, height uint64) (ids.ID, error)
- func (vm *VM) Gossip(ctx context.Context, nodeID ids.NodeID, msg []byte) error
- func (vm *VM) HealthCheck(ctx context.Context) (vmchain.HealthResult, error)
- func (vm *VM) Initialize(ctx context.Context, init vmcore.Init) error
- func (vm *VM) LastAccepted(ctx context.Context) (ids.ID, error)
- func (vm *VM) NewHTTPHandler(ctx context.Context) (http.Handler, error)
- func (vm *VM) ParseBlock(ctx context.Context, blockBytes []byte) (vmchain.Block, error)
- func (vm *VM) ParseVertex(ctx context.Context, b []byte) (vertex.Vertex, error)
- func (vm *VM) Request(ctx context.Context, nodeID ids.NodeID, requestID uint32, deadline time.Time, ...) error
- func (vm *VM) RequestFailed(ctx context.Context, nodeID ids.NodeID, requestID uint32, appErr *warp.Error) error
- func (vm *VM) Response(ctx context.Context, nodeID ids.NodeID, requestID uint32, response []byte) error
- func (vm *VM) SetPreference(ctx context.Context, blkID ids.ID) error
- func (vm *VM) SetState(ctx context.Context, state uint32) error
- func (vm *VM) Shutdown(ctx context.Context) error
- func (vm *VM) StrictPQ() bool
- func (vm *VM) Version(ctx context.Context) (string, error)
- func (vm *VM) WaitForEvent(ctx context.Context) (vmcore.Message, error)
- func (vm *VM) ZKPrecompiles() *precompiles.MapRegistry
- type Vertex
- func (v *Vertex) Accept(ctx context.Context) error
- func (v *Vertex) Bytes() []byte
- func (v *Vertex) Conflicts(other *Vertex) bool
- func (v *Vertex) ConflictsVertex(other vertex.Vertex) bool
- func (v *Vertex) Epoch() uint32
- func (v *Vertex) Height() uint64
- func (v *Vertex) ID() ids.ID
- func (v *Vertex) Parents() []ids.ID
- func (v *Vertex) Publish()
- func (v *Vertex) Reject(ctx context.Context) error
- func (v *Vertex) Status() choices.Status
- func (v *Vertex) Txs() []ids.ID
- func (v *Vertex) Verify(ctx context.Context) error
- func (v *Vertex) Write(database.Database) error
- type ZConfig
- type ZKProof
Constants ¶
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 ¶
var ( // ErrNotOnTip refuses a block that does not extend the chain: one whose // parent is neither the accepted tip nor a block verified above it. ErrNotOnTip = errors.New("zkvm: block does not extend the accepted tip") )
var VMID = ids.ID{'z', 'k', 'v', 'm'}
VMID is the unique identifier for ZKVM (Z-Chain)
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
// Aggregated proof for the block (optional)
BlockProof *ZKProof `json:"blockProof,omitempty"`
// Cached values
ID_ ids.ID
// contains filtered or unexported fields
}
Block represents a block in the ZK UTXO chain
func (*Block) Accept ¶
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.
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) ToSummary ¶
func (b *Block) ToSummary() *BlockSummary
ToSummary converts a block to a summary
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 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 ¶
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 ¶
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 ¶
HasTransaction checks if a transaction is in the mempool
func (*Mempool) PruneExpired ¶
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 ¶
RemoveTransaction removes a transaction from the mempool
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 ¶
NewNullifierDB creates a new 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 PLONKProof ¶
type PLONKProof struct {
// Commitments (7 G1 points)
LCommit bn254.G1Affine // Wire L commitment
RCommit bn254.G1Affine // Wire R commitment
OCommit bn254.G1Affine // Wire O commitment
ZCommit bn254.G1Affine // Permutation polynomial commitment
TLow bn254.G1Affine // Quotient polynomial low
TMid bn254.G1Affine // Quotient polynomial mid
THigh bn254.G1Affine // Quotient polynomial high
// Opening proof components
WzOpening bn254.G1Affine // Opening at z
WzwOpening bn254.G1Affine // Opening at z*omega
// Evaluation proofs (scalars)
AEval fr.Element // a(z) evaluation
BEval fr.Element // b(z) evaluation
CEval fr.Element // c(z) evaluation
SigmaEval fr.Element // sigma permutation evaluation
ZEval fr.Element // z(z*omega) evaluation
}
PLONKProof represents a PLONK proof structure
type PLONKVerifyingKey ¶
type PLONKVerifyingKey struct {
// SRS elements
G1 bn254.G1Affine // Generator in G1
G2 bn254.G2Affine // Generator in G2
G2Alpha bn254.G2Affine // [alpha]_2
// Selector commitments
QLCommit bn254.G1Affine // Left selector
QRCommit bn254.G1Affine // Right selector
QMCommit bn254.G1Affine // Multiplication selector
QOCommit bn254.G1Affine // Output selector
QCCommit bn254.G1Affine // Constant selector
// Permutation commitments
S1Commit bn254.G1Affine // Sigma_1 permutation
S2Commit bn254.G1Affine // Sigma_2 permutation
S3Commit bn254.G1Affine // Sigma_3 permutation
// Domain parameters
N uint64 // Circuit size (power of 2)
K1, K2 fr.Element // Coset generators
Omega fr.Element // Root of unity
}
PLONKVerifyingKey represents a PLONK verifying key
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 ¶
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) VerifyBlockProof ¶
func (pv *ProofVerifier) VerifyBlockProof(block *Block) error
VerifyBlockProof verifies an aggregated block proof.
There is ONE verification path. It used to take a batch path when accel.Available() and more than one transaction — a second, inline copy of the Groth16 checks that consulted neither the proof cache nor the dummy-key refusal — so whether a node accepted a block turned on whether that node had an accelerator, and validators with and without one rejected each other.
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 (*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.
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, error)
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 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
type UTXODB ¶
type UTXODB struct {
// contains filtered or unexported fields
}
UTXODB manages the UTXO set
func (*UTXODB) GetUTXO ¶
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 ¶
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 ¶
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 ¶
BuildVertex drains the mempool, batches non-conflicting txs, and returns a vertex.
func (*VM) CreateHandlers ¶
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) FeePolicy ¶ added in v1.2.6
FeePolicy exposes the chain's declared fee policy for diagnostics and the boot-time Validate gate.
func (*VM) GetBlockIDAtHeight ¶
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) HealthCheck ¶
HealthCheck performs a health check
func (*VM) Initialize ¶
Initialize initializes the VM
func (*VM) NewHTTPHandler ¶
NewHTTPHandler mounts the same routes by path.
func (*VM) ParseBlock ¶
ParseBlock parses a block from bytes.
func (*VM) ParseVertex ¶
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 ¶
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) StrictPQ ¶ added in v1.3.10
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) WaitForEvent ¶
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 ¶
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.
func (*Vertex) ConflictsVertex ¶
ConflictsVertex performs the same check against the vertex.Vertex interface.
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) Verify ¶
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.
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.