LPsLux Proposals
Zero-Knowledge Proofs
LP-8000

Z-Chain - Core ZKVM Specification

Review

Core specification for the Z-Chain (ZKVM), Lux Network's zero-knowledge proof and privacy chain

Category
Core
Created
2025-12-11

Abstract

LP-8000 specifies the Z-Chain (Zero-Knowledge Virtual Machine), Lux Network's specialized blockchain for zero-knowledge proofs, privacy-preserving transactions, and fully homomorphic encryption (FHE). The Z-Chain implements hardware-accelerated proof systems with cross-platform support.

Motivation

A dedicated ZK chain provides:

  1. Privacy: Enable private transactions and data
  2. Scalability: ZK rollups for scaling
  3. Verifiable Computation: Trustless off-chain compute
  4. FHE Operations: Encrypted data processing

Specification

Chain Parameters

ParameterValue
Chain IDZ
VM IDzkvm
VM Namezkvm
Block Time2 seconds
ConsensusQuasar

Implementation

Go Package: github.com/luxfi/node/vms/zkvm

import (
    zvm "github.com/luxfi/node/vms/zkvm"
    "github.com/luxfi/node/utils/constants"
)

// VM ID constant
var ZKVMID = constants.ZKVMID // ids.ID{'z', 'k', 'v', 'm'}

// Create Z-Chain VM
factory := &zvm.Factory{}
vm, err := factory.New(logger)

Directory Structure

node/vms/zkvm/
├── accel/            # Hardware acceleration
│   ├── accel.go      # Acceleration interface
│   ├── accel_mlx.go  # Apple MLX backend
│   ├── accel_cgo.go  # CGO/CUDA backend
│   ├── accel_fpga.go # FPGA backend
│   └── accel_go.go   # Pure Go fallback
├── circuits/         # ZK circuit definitions
├── fhe/              # FHE operations
├── provers/          # Proof systems
├── verifiers/        # Proof verification
├── factory.go        # VM factory
├── vm.go             # Main VM implementation
└── *_test.go         # Tests

Proof Systems

SystemTypeUse Case
Groth16SNARKProduction proofs
PLONKSNARKUniversal setup
STARKSTARKQuantum-resistant
Halo2SNARKRecursive proofs

Hardware Acceleration

Acceleration Interface

type Accelerator interface {
    Name() string
    IsAvailable() bool
    MSM(points []Point, scalars []FieldElement, config MSMConfig) (Point, error)
    NTT(values []FieldElement, config NTTConfig) ([]FieldElement, error)
    Poseidon(inputs []FieldElement) (FieldElement, error)
    Benchmark() (*BenchmarkResult, error)
}

Platform Support

PlatformBackendPerformance
Apple SiliconMLX10x speedup
NVIDIA GPUCUDA (CGO)50x speedup
FPGACustom IP100x speedup
CPUPure GoBaseline

Acceleration Selection

func GetAccelerator() Accelerator {
    // Priority: FPGA > CUDA > MLX > Go
    if fpga := NewFPGAAccelerator(); fpga.IsAvailable() {
        return fpga
    }
    if cuda := NewCGOAccelerator(); cuda.IsAvailable() {
        return cuda
    }
    if mlx := NewMLXAccelerator(); mlx.IsAvailable() {
        return mlx
    }
    return NewGoAccelerator()
}

Transaction Types

TypeDescription
SubmitProofSubmit ZK proof
VerifyProofVerify ZK proof
PrivateTransferPrivacy-preserving transfer
FHEComputeFHE computation
RegisterCircuitRegister new circuit
BatchVerifyBatch proof verification

ZK Operations

Proof Submission

type ZKProof struct {
    CircuitID   ids.ID
    ProofType   ProofSystem
    PublicInput []FieldElement
    Proof       []byte
    Metadata    []byte
}

// Submit proof for verification
func (z *ZKVM) SubmitProof(proof *ZKProof) (ids.ID, error) {
    // Verify proof
    valid, err := z.verifier.Verify(proof)
    if err != nil || !valid {
        return ids.Empty, ErrInvalidProof
    }

    // Store on chain
    return z.state.StoreProof(proof)
}

Circuit Registration

type Circuit struct {
    ID          ids.ID
    Name        string
    System      ProofSystem
    VerifyKey   []byte
    ProvingKey  []byte    // Optional for public circuits
    Constraints uint64
    Public      uint32
    Private     uint32
}

Privacy Features

Private Transfers

type PrivateTransfer struct {
    Commitment  [32]byte  // Pedersen commitment
    Nullifier   [32]byte  // Nullifier to prevent double-spend
    Proof       []byte    // ZK proof of valid transfer
    EncOutput   []byte    // Encrypted output for recipient
}

Encrypted Data

type EncryptedData struct {
    Ciphertext  []byte
    Nonce       [24]byte
    Tag         [16]byte
    PublicKey   [32]byte
}

FHE Operations

type FHEConfig struct {
    Scheme      FHEScheme  // CKKS, BFV, BGV
    SecurityBits uint32
    PolyDegree   uint32
    ScaleBits    uint32
}

type FHEOperation struct {
    OpType      FHEOpType  // Add, Mul, Rotate
    Inputs      [][]byte   // Encrypted inputs
    Output      []byte     // Encrypted output
    Proof       []byte     // Correctness proof
}

API Endpoints

RPC Methods

MethodDescription
zk.submitProofSubmit ZK proof
zk.verifyProofVerify ZK proof
zk.getCircuitGet circuit info
zk.registerCircuitRegister circuit
zk.privateTransferPrivate transfer
zk.fheComputeFHE computation

REST Endpoints

POST /ext/bc/Z/zk/proof/submit
POST /ext/bc/Z/zk/proof/verify
GET  /ext/bc/Z/zk/circuits/{circuitId}
POST /ext/bc/Z/zk/circuits/register
POST /ext/bc/Z/zk/private/transfer
POST /ext/bc/Z/zk/fhe/compute

Precompiled Contracts

AddressFunctionGas Cost
0x8000Groth16 Verify200,000
0x8001PLONK Verify250,000
0x8002STARK Verify500,000
0x8003Poseidon Hash10,000
0x8004Pedersen Commit20,000
0x8005FHE Add50,000
0x8006FHE Mul100,000

Configuration

{
  "zkvm": {
    "defaultProofSystem": "groth16",
    "maxCircuitSize": 1000000,
    "maxProofSize": 1048576,
    "parallelVerification": true,
    "maxVerifyWorkers": 8,
    "acceleratorPriority": ["fpga", "cuda", "mlx", "go"],
    "fheEnabled": true,
    "privacyEnabled": true
  }
}

Performance

OperationTimeAccelerated
Groth16 Verify5ms0.5ms (FPGA)
PLONK Verify10ms1ms (FPGA)
MSM (64 points)50ms0.5ms (CUDA)
NTT (2^16)100ms1ms (CUDA)
Poseidon Hash0.1ms0.01ms
FHE Add10ms1ms
FHE Mul50ms5ms

Rationale

Design decisions for Z-Chain:

  1. Dedicated Chain: ZK operations require specialized resources
  2. Multi-Backend: Support various hardware accelerators
  3. Multiple Proof Systems: Different tradeoffs for different use cases
  4. FHE Support: Enable encrypted computation

Backwards Compatibility

LP-8000 supersedes LP-0046. Both old and new numbers resolve to this document.

Test Cases

See github.com/luxfi/node/vms/zkvm/*_test.go:

func TestZKVMFactory(t *testing.T)
func TestGroth16Verification(t *testing.T)
func TestPLONKVerification(t *testing.T)
func TestMSMAcceleration(t *testing.T)
func TestNTTAcceleration(t *testing.T)
func TestPoseidonHash(t *testing.T)
func TestPrivateTransfer(t *testing.T)
func TestFHEOperations(t *testing.T)
func TestGoAccelerator_Benchmark(t *testing.T)

Reference Implementation

Repository: github.com/luxfi/node Package: vms/zkvm Dependencies:

  • vms/zkvm/accel
  • vms/zkvm/circuits
  • vms/zkvm/provers
  • vms/zkvm/fhe

Security Considerations

  1. Trusted Setup: Groth16 requires trusted setup ceremony
  2. Side-Channel: Constant-time implementations
  3. Nullifier Security: Prevent double-spending attacks
  4. FHE Parameters: Correct parameter selection for security level
LPTitleRelationship
LP-0046Z-Chain ZKVMSuperseded by this LP
LP-8100Proof SystemsSub-specification
LP-8200Hardware AccelerationSub-specification
LP-8300Privacy TransactionsSub-specification
LP-8400FHE OperationsSub-specification
LP-8500ZK RollupsSub-specification

Copyright and related rights waived via CC0.