Documentation
¶
Index ¶
- Variables
- func ComputeCommitment(note *Note) []byte
- func ComputeNullifier(note *Note, spendingKey []byte) []byte
- func EncryptNote(note *Note, recipientPubKey []byte, ephemeralPrivKey []byte) ([]byte, []byte, error)
- func NewPrivacyHandler(vm *VM) http.Handler
- func NewProofHandler(vm *VM) http.Handler
- func NewRPCHandler(vm *VM) http.Handler
- type AddressManager
- func (am *AddressManager) CanDecryptNote(ephemeralPubKey []byte, address []byte) bool
- func (am *AddressManager) Close()
- func (am *AddressManager) DeriveNullifier(address []byte, note *Note) ([]byte, error)
- func (am *AddressManager) GenerateAddress() (*PrivateAddress, error)
- func (am *AddressManager) GetAddress(address []byte) (*PrivateAddress, error)
- func (am *AddressManager) GetAddressCount() uint64
- func (am *AddressManager) GetAddressesByViewingKey(viewingKey []byte) ([]*PrivateAddress, error)
- func (am *AddressManager) SignTransaction(tx *Transaction, signingAddresses [][]byte) error
- 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) ParentID() ids.ID
- 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
- type BlockSummary
- type FHEData
- type FHEProcessor
- func (fp *FHEProcessor) AddCiphertexts(ct1, ct2 []byte) ([]byte, error)
- func (fp *FHEProcessor) DecryptValue(ciphertext []byte, privateKey []byte) (uint64, error)
- func (fp *FHEProcessor) EncryptValue(value uint64) ([]byte, error)
- func (fp *FHEProcessor) GetStats() uint64
- func (fp *FHEProcessor) MultiplyCiphertext(ct []byte, scalar uint64) ([]byte, error)
- func (fp *FHEProcessor) ProcessFHEComputation(circuitID string, encryptedInputs [][]byte) ([]byte, []byte, error)
- func (fp *FHEProcessor) VerifyFHEOperations(tx *Transaction) error
- type Factory
- type Genesis
- type Health
- type Mempool
- func (mp *Mempool) AddTransaction(tx *Transaction) error
- func (mp *Mempool) Clear()
- func (mp *Mempool) GetPendingTransactions(limit int) []*Transaction
- func (mp *Mempool) HasNullifier(nullifier []byte) bool
- 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
- type MempoolTx
- type Note
- type NullifierDB
- func (ndb *NullifierDB) Close()
- func (ndb *NullifierDB) GetNullifierCount() uint64
- func (ndb *NullifierDB) GetNullifierHeight(nullifier []byte) (uint64, error)
- func (ndb *NullifierDB) GetNullifiersByHeight(height uint64) [][]byte
- func (ndb *NullifierDB) IsNullifierSpent(nullifier []byte) bool
- func (ndb *NullifierDB) MarkNullifierSpent(nullifier []byte, height uint64) error
- func (ndb *NullifierDB) PruneOldNullifiers(minHeight uint64) error
- func (ndb *NullifierDB) RemoveNullifier(nullifier []byte) error
- type PrivateAddress
- type ProofVerifier
- type SetupParams
- type ShieldedOutput
- type StateTree
- func (st *StateTree) ApplyTransaction(tx *Transaction) error
- func (st *StateTree) Close()
- func (st *StateTree) ComputeRoot() ([]byte, error)
- func (st *StateTree) Finalize(newRoot []byte) error
- func (st *StateTree) GetMerkleProof(commitment []byte) ([][]byte, error)
- func (st *StateTree) GetRoot() []byte
- func (st *StateTree) VerifyMerkleProof(commitment []byte, proof [][]byte, root []byte) bool
- type Transaction
- type TransactionType
- type TransparentInput
- type TransparentOutput
- type TxHeap
- type UTXO
- type UTXODB
- func (udb *UTXODB) AddUTXO(utxo *UTXO) error
- func (udb *UTXODB) Close()
- func (udb *UTXODB) GetAllCommitments() [][]byte
- func (udb *UTXODB) GetUTXO(commitment []byte) (*UTXO, error)
- func (udb *UTXODB) GetUTXOCount() uint64
- func (udb *UTXODB) GetUTXOsByHeight(height uint64) ([]*UTXO, error)
- func (udb *UTXODB) PruneOldUTXOs(minHeight uint64) error
- func (udb *UTXODB) RemoveUTXO(commitment []byte) error
- 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, appErr *warp.Error) error
- func (vm *VM) AppResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, response []byte) error
- func (vm *VM) BuildBlock(ctx context.Context) (block.Block, error)
- func (vm *VM) Connected(ctx context.Context, nodeID ids.NodeID, nodeVersion interface{}) error
- func (vm *VM) CreateHandlers(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 *warp.Error) 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, blkID ids.ID) (block.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 interface{}, db interface{}, genesisBytes []byte, ...) error
- func (vm *VM) LastAccepted(ctx context.Context) (ids.ID, error)
- func (vm *VM) NewHTTPHandler(ctx context.Context) (interface{}, error)
- func (vm *VM) ParseBlock(ctx context.Context, blockBytes []byte) (block.Block, 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) Version(ctx context.Context) (string, error)
- func (vm *VM) WaitForEvent(ctx context.Context) (interface{}, error)
- type ZConfig
- type ZKProof
Constants ¶
This section is empty.
Variables ¶
var Codec codec.Manager
var (
Version = &version.Semantic{
Major: 1,
Minor: 0,
Patch: 0,
}
)
Functions ¶
func ComputeCommitment ¶ added in v1.16.56
ComputeCommitment computes a note commitment
func ComputeNullifier ¶ added in v1.16.56
ComputeNullifier computes a nullifier for a note
func EncryptNote ¶ added in v1.16.56
func EncryptNote(note *Note, recipientPubKey []byte, ephemeralPrivKey []byte) ([]byte, []byte, error)
EncryptNote encrypts a note for the recipient
func NewPrivacyHandler ¶ added in v1.16.56
NewPrivacyHandler creates the privacy-specific handler
func NewProofHandler ¶ added in v1.16.56
NewProofHandler creates the proof-specific handler
func NewRPCHandler ¶ added in v1.16.56
NewRPCHandler creates the main RPC handler
Types ¶
type AddressManager ¶ added in v1.16.56
type AddressManager struct {
// contains filtered or unexported fields
}
AddressManager manages private addresses and viewing keys
func NewAddressManager ¶ added in v1.16.56
func NewAddressManager(db database.Database, enablePrivate bool, log log.Logger) (*AddressManager, error)
NewAddressManager creates a new address manager
func (*AddressManager) CanDecryptNote ¶ added in v1.16.56
func (am *AddressManager) CanDecryptNote(ephemeralPubKey []byte, address []byte) bool
CanDecryptNote checks if we have the keys to decrypt a note
func (*AddressManager) Close ¶ added in v1.16.56
func (am *AddressManager) Close()
Close closes the address manager
func (*AddressManager) DeriveNullifier ¶ added in v1.16.56
func (am *AddressManager) DeriveNullifier(address []byte, note *Note) ([]byte, error)
DeriveNullifier derives a nullifier using the spending key
func (*AddressManager) GenerateAddress ¶ added in v1.16.56
func (am *AddressManager) GenerateAddress() (*PrivateAddress, error)
GenerateAddress generates a new private address
func (*AddressManager) GetAddress ¶ added in v1.16.56
func (am *AddressManager) GetAddress(address []byte) (*PrivateAddress, error)
GetAddress retrieves an address by its public address
func (*AddressManager) GetAddressCount ¶ added in v1.16.56
func (am *AddressManager) GetAddressCount() uint64
GetAddressCount returns the total number of addresses
func (*AddressManager) GetAddressesByViewingKey ¶ added in v1.16.56
func (am *AddressManager) GetAddressesByViewingKey(viewingKey []byte) ([]*PrivateAddress, error)
GetAddressesByViewingKey returns all addresses associated with a viewing key
func (*AddressManager) SignTransaction ¶ added in v1.16.56
func (am *AddressManager) SignTransaction(tx *Transaction, signingAddresses [][]byte) error
SignTransaction signs a transaction with the appropriate keys
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) ToSummary ¶ added in v1.16.56
func (b *Block) ToSummary() *BlockSummary
ToSummary converts a block to a summary
type BlockSummary ¶ added in v1.16.56
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 FHEData ¶ added in v1.16.56
type FHEData struct {
// Encrypted computation inputs
EncryptedInputs [][]byte `json:"encryptedInputs"`
// Computation circuit
CircuitID string `json:"circuitId"`
// Encrypted result
EncryptedResult []byte `json:"encryptedResult"`
// Proof of correct computation
ComputationProof []byte `json:"computationProof"`
}
FHEData represents fully homomorphic encryption data
type FHEProcessor ¶ added in v1.16.56
type FHEProcessor struct {
// contains filtered or unexported fields
}
FHEProcessor handles fully homomorphic encryption operations
func NewFHEProcessor ¶ added in v1.16.56
func NewFHEProcessor(config ZConfig, log log.Logger) (*FHEProcessor, error)
NewFHEProcessor creates a new FHE processor
func (*FHEProcessor) AddCiphertexts ¶ added in v1.16.56
func (fp *FHEProcessor) AddCiphertexts(ct1, ct2 []byte) ([]byte, error)
AddCiphertexts performs homomorphic addition
func (*FHEProcessor) DecryptValue ¶ added in v1.16.56
func (fp *FHEProcessor) DecryptValue(ciphertext []byte, privateKey []byte) (uint64, error)
DecryptValue decrypts an FHE ciphertext
func (*FHEProcessor) EncryptValue ¶ added in v1.16.56
func (fp *FHEProcessor) EncryptValue(value uint64) ([]byte, error)
EncryptValue encrypts a value using FHE
func (*FHEProcessor) GetStats ¶ added in v1.16.56
func (fp *FHEProcessor) GetStats() uint64
GetStats returns FHE processing statistics
func (*FHEProcessor) MultiplyCiphertext ¶ added in v1.16.56
func (fp *FHEProcessor) MultiplyCiphertext(ct []byte, scalar uint64) ([]byte, error)
MultiplyCiphertext performs homomorphic multiplication by a plaintext
func (*FHEProcessor) ProcessFHEComputation ¶ added in v1.16.56
func (fp *FHEProcessor) ProcessFHEComputation( circuitID string, encryptedInputs [][]byte, ) ([]byte, []byte, error)
ProcessFHEComputation performs an FHE computation
func (*FHEProcessor) VerifyFHEOperations ¶ added in v1.16.56
func (fp *FHEProcessor) VerifyFHEOperations(tx *Transaction) error
VerifyFHEOperations verifies FHE operations in a transaction
type Genesis ¶ added in v1.16.56
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 ¶ added in v1.16.56
ParseGenesis parses genesis bytes
type Health ¶ added in v1.16.56
type Health struct {
DatabaseHealthy bool `json:"databaseHealthy"`
UTXOCount uint64 `json:"utxoCount"`
NullifierCount uint64 `json:"nullifierCount"`
LastBlockHeight uint64 `json:"lastBlockHeight"`
PendingBlockCount int `json:"pendingBlockCount"`
MempoolSize int `json:"mempoolSize"`
ProofCacheSize int `json:"proofCacheSize"`
}
Health represents VM health status
type Mempool ¶ added in v1.16.56
type Mempool struct {
// contains filtered or unexported fields
}
Mempool manages pending transactions
func NewMempool ¶ added in v1.16.56
NewMempool creates a new mempool
func (*Mempool) AddTransaction ¶ added in v1.16.56
func (mp *Mempool) AddTransaction(tx *Transaction) error
AddTransaction adds a transaction to the mempool
func (*Mempool) Clear ¶ added in v1.16.56
func (mp *Mempool) Clear()
Clear removes all transactions from the mempool
func (*Mempool) GetPendingTransactions ¶ added in v1.16.56
func (mp *Mempool) GetPendingTransactions(limit int) []*Transaction
GetPendingTransactions returns pending transactions sorted by priority
func (*Mempool) HasNullifier ¶ added in v1.16.56
HasNullifier checks if a nullifier is already in the mempool
func (*Mempool) HasTransaction ¶ added in v1.16.56
HasTransaction checks if a transaction is in the mempool
func (*Mempool) PruneExpired ¶ added in v1.16.56
PruneExpired removes expired transactions
func (*Mempool) RemoveTransaction ¶ added in v1.16.56
RemoveTransaction removes a transaction from the mempool
type MempoolTx ¶ added in v1.16.56
type MempoolTx struct {
// contains filtered or unexported fields
}
MempoolTx represents a transaction in the mempool
type Note ¶ added in v1.16.56
type Note struct {
Value *big.Int `json:"value"` // Encrypted amount
Address []byte `json:"address"` // Recipient address
AssetID ids.ID `json:"assetId"` // Asset type
Randomness []byte `json:"randomness"` // Note randomness
Nullifier []byte `json:"nullifier"` // Computed nullifier
}
Note represents a shielded note (internal representation)
type NullifierDB ¶ added in v1.16.56
type NullifierDB struct {
// contains filtered or unexported fields
}
NullifierDB manages spent nullifiers
func NewNullifierDB ¶ added in v1.16.56
NewNullifierDB creates a new nullifier database
func (*NullifierDB) Close ¶ added in v1.16.56
func (ndb *NullifierDB) Close()
Close closes the nullifier database
func (*NullifierDB) GetNullifierCount ¶ added in v1.16.56
func (ndb *NullifierDB) GetNullifierCount() uint64
GetNullifierCount returns the total number of spent nullifiers
func (*NullifierDB) GetNullifierHeight ¶ added in v1.16.56
func (ndb *NullifierDB) GetNullifierHeight(nullifier []byte) (uint64, error)
GetNullifierHeight returns the height when a nullifier was spent
func (*NullifierDB) GetNullifiersByHeight ¶ added in v1.16.56
func (ndb *NullifierDB) GetNullifiersByHeight(height uint64) [][]byte
GetNullifiersByHeight returns all nullifiers spent at a specific height
func (*NullifierDB) IsNullifierSpent ¶ added in v1.16.56
func (ndb *NullifierDB) IsNullifierSpent(nullifier []byte) bool
IsNullifierSpent checks if a nullifier has been spent
func (*NullifierDB) MarkNullifierSpent ¶ added in v1.16.56
func (ndb *NullifierDB) MarkNullifierSpent(nullifier []byte, height uint64) error
MarkNullifierSpent marks a nullifier as spent
func (*NullifierDB) PruneOldNullifiers ¶ added in v1.16.56
func (ndb *NullifierDB) PruneOldNullifiers(minHeight uint64) error
PruneOldNullifiers removes nullifiers older than a certain height
func (*NullifierDB) RemoveNullifier ¶ added in v1.16.56
func (ndb *NullifierDB) RemoveNullifier(nullifier []byte) error
RemoveNullifier removes a nullifier (used for reorg)
type PrivateAddress ¶ added in v1.16.56
type PrivateAddress struct {
Address []byte `json:"address"` // Public address (32 bytes)
ViewingKey []byte `json:"viewingKey"` // Viewing key for scanning
SpendingKey []byte `json:"spendingKey"` // Spending key (private)
Diversifier []byte `json:"diversifier"` // Address diversifier
IncomingViewKey []byte `json:"incomingViewKey"` // For incoming payments only
CreatedAt int64 `json:"createdAt"`
}
PrivateAddress represents a private address
type ProofVerifier ¶ added in v1.16.56
type ProofVerifier struct {
// contains filtered or unexported fields
}
ProofVerifier verifies zero-knowledge proofs
func NewProofVerifier ¶ added in v1.16.56
func NewProofVerifier(config ZConfig, log log.Logger) (*ProofVerifier, error)
NewProofVerifier creates a new proof verifier
func (*ProofVerifier) ClearCache ¶ added in v1.16.56
func (pv *ProofVerifier) ClearCache()
ClearCache clears the proof verification cache
func (*ProofVerifier) GetCacheSize ¶ added in v1.16.56
func (pv *ProofVerifier) GetCacheSize() int
GetCacheSize returns the current size of the proof cache
func (*ProofVerifier) GetStats ¶ added in v1.16.56
func (pv *ProofVerifier) GetStats() (verifyCount, cacheHits, cacheMisses uint64)
GetStats returns verifier statistics
func (*ProofVerifier) VerifyBlockProof ¶ added in v1.16.56
func (pv *ProofVerifier) VerifyBlockProof(block *Block) error
VerifyBlockProof verifies an aggregated block proof
func (*ProofVerifier) VerifyTransactionProof ¶ added in v1.16.56
func (pv *ProofVerifier) VerifyTransactionProof(tx *Transaction) error
VerifyTransactionProof verifies a transaction's zero-knowledge proof
type SetupParams ¶ added in v1.16.56
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 ¶ added in v1.16.56
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 StateTree ¶ added in v1.16.56
type StateTree struct {
// contains filtered or unexported fields
}
StateTree manages the Merkle tree of the UTXO set
func NewStateTree ¶ added in v1.16.56
NewStateTree creates a new state tree
func (*StateTree) ApplyTransaction ¶ added in v1.16.56
func (st *StateTree) ApplyTransaction(tx *Transaction) error
ApplyTransaction applies a transaction to the state tree
func (*StateTree) Close ¶ added in v1.16.56
func (st *StateTree) Close()
Close closes the state tree
func (*StateTree) ComputeRoot ¶ added in v1.16.56
ComputeRoot computes the new Merkle root after pending changes
func (*StateTree) Finalize ¶ added in v1.16.56
Finalize commits the pending changes and updates the root
func (*StateTree) GetMerkleProof ¶ added in v1.16.56
GetMerkleProof generates a Merkle proof for a commitment
type Transaction ¶ added in v1.16.56
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"`
// FHE operations (optional)
FHEData *FHEData `json:"fheData,omitempty"`
// Transaction metadata
Fee uint64 `json:"fee"`
Expiry uint64 `json:"expiry"` // Block height
Memo []byte `json:"memo,omitempty"` // Encrypted memo
// Signature for transparent components
Signature []byte `json:"signature,omitempty"`
}
Transaction represents a confidential transaction
func (*Transaction) ComputeID ¶ added in v1.16.56
func (tx *Transaction) ComputeID() ids.ID
ComputeID computes the transaction ID
func (*Transaction) GetNullifiers ¶ added in v1.16.56
func (tx *Transaction) GetNullifiers() [][]byte
GetNullifiers returns all nullifiers in the transaction
func (*Transaction) GetOutputCommitments ¶ added in v1.16.56
func (tx *Transaction) GetOutputCommitments() [][]byte
GetOutputCommitments returns all output commitments
func (*Transaction) HasFHEOperations ¶ added in v1.16.56
func (tx *Transaction) HasFHEOperations() bool
HasFHEOperations returns true if the transaction includes FHE operations
func (*Transaction) ValidateBasic ¶ added in v1.16.56
func (tx *Transaction) ValidateBasic() error
ValidateBasic performs basic validation
type TransactionType ¶ added in v1.16.56
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 ¶ added in v1.16.56
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 ¶ added in v1.16.56
type TransparentOutput struct {
Amount uint64 `json:"amount"`
Address []byte `json:"address"`
AssetID ids.ID `json:"assetId"`
}
TransparentOutput represents an unshielded output
type TxHeap ¶ added in v1.16.56
type TxHeap []*MempoolTx
TxHeap implements heap.Interface for priority ordering
type UTXO ¶ added in v1.16.56
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 ¶ added in v1.16.56
type UTXODB struct {
// contains filtered or unexported fields
}
UTXODB manages the UTXO set
func (*UTXODB) GetAllCommitments ¶ added in v1.16.56
GetAllCommitments returns all UTXO commitments (for Merkle tree)
func (*UTXODB) GetUTXOCount ¶ added in v1.16.56
GetUTXOCount returns the total number of UTXOs
func (*UTXODB) GetUTXOsByHeight ¶ added in v1.16.56
GetUTXOsByHeight returns all UTXOs created at a specific height
func (*UTXODB) PruneOldUTXOs ¶ added in v1.16.56
PruneOldUTXOs removes UTXOs older than a certain height
func (*UTXODB) RemoveUTXO ¶ added in v1.16.56
RemoveUTXO removes a UTXO from the set
type VM ¶
type VM struct {
// contains filtered or unexported fields
}
VM implements the Zero-Knowledge UTXO Chain VM
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 *warp.Error) 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 builds a new block
func (*VM) CreateHandlers ¶
CreateHandlers returns the VM handlers
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 *warp.Error) 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) GetBlockIDAtHeight ¶
GetBlockIDAtHeight implements the consensusman.HeightIndexedChainVM interface
func (*VM) HealthCheck ¶
HealthCheck performs a health check
func (*VM) Initialize ¶
func (vm *VM) Initialize( ctx context.Context, chainCtx interface{}, db interface{}, genesisBytes []byte, upgradeBytes []byte, configBytes []byte, msgChan interface{}, fxs []interface{}, appSender interface{}, ) error
Initialize initializes the VM
func (*VM) NewHTTPHandler ¶ added in v1.16.56
NewHTTPHandler returns HTTP handlers for the VM
func (*VM) ParseBlock ¶
ParseBlock parses a block from bytes
func (*VM) SetPreference ¶
Additional interface implementations
type ZConfig ¶ added in v1.16.56
type ZConfig struct {
// Privacy configuration
EnableConfidentialTransfers bool `serialize:"true" json:"enableConfidentialTransfers"`
EnablePrivateAddresses bool `serialize:"true" json:"enablePrivateAddresses"`
// ZK proof configuration
ProofSystem string `serialize:"true" json:"proofSystem"` // groth16, plonk, etc.
CircuitType string `serialize:"true" json:"circuitType"` // transfer, mint, burn
VerifyingKeyPath string `serialize:"true" json:"verifyingKeyPath"`
TrustedSetupPath string `serialize:"true" json:"trustedSetupPath"`
// FHE configuration
EnableFHE bool `serialize:"true" json:"enableFHE"`
FHEScheme string `serialize:"true" json:"fheScheme"` // BFV, CKKS, etc.
SecurityLevel uint32 `serialize:"true" json:"securityLevel"` // 128, 192, 256
// Performance
MaxUTXOsPerBlock uint32 `serialize:"true" json:"maxUtxosPerBlock"`
ProofVerificationTimeout time.Duration `serialize:"true" json:"proofVerificationTimeout"`
ProofCacheSize uint32 `serialize:"true" json:"proofCacheSize"`
}
ZConfig contains VM configuration