Skip to main content

Overview

@0xio/pvac (v1.0.2) provides standalone FHE (Fully Homomorphic Encryption) primitives for DApps that need to work with encrypted balances on Octra Network. It runs entirely client-side via WASM: no wallet extension dependency for cryptographic operations. The primitives are built on the Ristretto255 group (curve25519-dalek): exponential-ElGamal ciphers, Bulletproofs-style range proofs, and Pedersen commitments.
PVAC’s confidentiality rests on the discrete-log hardness assumption (Ristretto255). It is not lattice-based and is not post-quantum / quantum-safe.
Use @0xio/pvac for FHE crypto, and @0xio/sdk for wallet signing. They work together:

Installation

Quick Start

API Reference

Encryption

Cipher Arithmetic

Proofs

Private DEX Example

Subtracting a Public Amount

To subtract a known amount from an encrypted balance (e.g., after a swap):
This is mathematically identical to fhe_sub_const. Both produce enc(balance - amount).

Network Proof Rules

Each network states which proof rules it accepts. 0xio wallets read them before any private action and again right before signing.
  • Where: octra_pvacMigrationStatus for the address. proof_math is "wide" or "prior" and sets the challenge arithmetic. proof_key (true or false) says whether proofs are bound to the registered encryption key.
  • Fallback: when the answer has no proof_math, only the devnet runtime the Octra reference client lists (read from octra_runtimeVersion) counts, and it means wide arithmetic without key binding.
  • No rules: a network that states neither gets no private operation from the wallet. The user sees that private actions are paused, and nothing is sent.
  • Rules changed: when the rules read right before signing differ from the ones the proofs were built under, nothing is sent and the action is prepared again.
  • Key binding: on a proof_key network every key switch carries owner_cipher and owner_proof, a proof that the sender owns the key being registered.
  • Migration: when the network opens its cipher proof route, a balance held under an older key migrates with a cipher_proof payload instead of the older migration format.
A proof built under one setting fails under the other. If your dApp builds proofs itself, check the same status first: a proof that does not match the network’s rules is refused.

Platform Support

Approval Popup

When your DApp calls wallet.callContract(), the 0xio extension shows an approval popup:
  • Amount = native value sent to the contract. amount is raw micro-OCT (1 OCT = 1000000) and is passed to the wallet as is; amountOct takes OCT and is converted by the SDK. Set amount: 0 if none.
  • Fee = OU (operational units / gas). Shown separately below the amount.
If you see a non-zero amount and expect 0, check your amount parameter.