Use this file to discover all available pages before exploring further.
Privora uses a content-addressable store to manage FHE ciphertexts. This design keeps on-chain storage minimal while supporting large encrypted values.
Use EncryptedRef::load() to fetch data from the store:
use privora_sdk_program::prelude::*;pub fn process(price_ref: EncryptedRef<u8>) -> ProgramResult { // Load fetches the ciphertext from the content store let price: Encrypted<u8> = price_ref.load()?; // Now we can perform operations let doubled = price.add(&price)?; Ok(())}
Use Encrypted::store() to submit results to the store:
// Perform computationlet result = a.add(&b)?;// Store result and get hash referencelet result_ref: EncryptedRef<u8> = result.store()?;// Save the hash to account dataaccount.result_ref = result_ref;
/// Fetch data from the content-addressable store.////// # Arguments/// * `hash` - 32-byte SHA256 hash of the data////// # Returns/// * `Ok(Vec<u8>)` - The ciphertext data/// * `Err` - If data not found or fetch failedpub fn fetch_data(hash: &[u8; 32]) -> Result<Vec<u8>, ProgramError>;
/// Submit data to the content-addressable store.////// # Arguments/// * `data` - The ciphertext bytes to store////// # Returns/// * `Ok([u8; 32])` - The SHA256 hash of the stored data/// * `Err` - If submission failedpub fn submit_data(data: &[u8]) -> Result<[u8; 32], ProgramError>;
Batch operations: Load all needed values, then compute
Minimize round-trips: Don’t load the same value multiple times
Store at end: Submit results after all computation
// Good: Load once, compute, store oncelet a = a_ref.load()?;let b = b_ref.load()?;let c = c_ref.load()?;let result = a.add(&b)?.mul(&c)?;let result_ref = result.store()?;// Bad: Load repeatedlylet result = a_ref.load()?.add(&b_ref.load()?)?.mul(&c_ref.load()?)?;