Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
Free 30-min Web3 Consultation
Book Consultation
Smart Contract Security Audits
View Audit Services
Custom DeFi Protocol Development
Explore DeFi
Full-Stack Web3 dApp Development
View App Services
LABS
Guides

Setting Up Privacy-Preserving Oracles for Asset Valuation

A technical guide for developers on implementing oracle networks that deliver verified asset price data without exposing sensitive commercial information.
Chainscore © 2026
introduction
TUTORIAL

Setting Up Privacy-Preserving Oracles for Asset Valuation

This guide explains how to implement privacy-preserving oracles to fetch sensitive financial data, such as private portfolio values, for on-chain applications without exposing the underlying information.

Privacy-preserving oracles are specialized data feeds that enable smart contracts to use sensitive off-chain information without revealing it on the public ledger. For asset valuation, this is critical. A protocol might need to verify a user's total private portfolio value exceeds a threshold to grant a loan, but broadcasting individual holdings would compromise financial privacy. Traditional oracles like Chainlink publish data openly, which is unsuitable for this use case. Instead, privacy oracles use cryptographic techniques such as zero-knowledge proofs (ZKPs) or trusted execution environments (TEEs) to attest that a condition is met without disclosing the raw data.

The core architecture involves three main components: a data source (e.g., a private API from a brokerage), a privacy layer that computes a verifiable attestation, and an on-chain verifier. A common approach is to use a TEE, like Intel SGX, to create a secure enclave. The oracle node fetches the private portfolio value from the source inside this enclave, which is isolated from the node operator. The enclave then generates a cryptographically signed message attesting that "Portfolio Value > $X," which the smart contract can verify. The actual dollar amount never leaves the protected environment.

To implement a basic version, you can use a framework like Phala Network or Oasis Network, which provide TEE-based confidential smart contract platforms. Here's a conceptual flow: First, deploy a confidential contract on Phala that acts as your oracle. This contract, running inside a TEE, is authorized to call a private API using an embedded API key. It fetches the current valuation, performs the required logic (e.g., checking a collateral ratio), and outputs a signed result. The on-chain part of your application only needs to verify the signature from the known TEE enclave, not process the data.

For developers, the key integration step is verifying the attestation on-chain. Using a library like phala-blockchain's PhatContract, your mainnet Solidity contract would include a function to check the attestation signature. The code would verify that the signature comes from a pre-approved enclave MRENCLAVE measurement, ensuring the computation is trustworthy. This moves the sensitive logic off-chain into a confidential environment while keeping the final, permissioned result on-chain. Always use audited oracle infrastructure for production, as the security of the TEE and the data source's reliability are paramount.

Use cases extend beyond DeFi loans. Privacy-preserving oracles are essential for institutional adoption, enabling compliance checks (like KYC/AML) without exposing customer data, verifying real-world asset ownership for tokenization, or running private auctions. The main trade-offs are complexity and cost: TEE setups require specialized hardware and introduce trust in the hardware manufacturer, while ZKP-based solutions can have high computational overhead. Choosing between them depends on your application's latency requirements, trust assumptions, and the complexity of the computation you need to keep private.

prerequisites
PRIVACY-PRESERVING ORACLES

Prerequisites and Setup

This guide outlines the technical foundation required to implement privacy-preserving oracles for confidential asset valuation.

Privacy-preserving oracles are a specialized infrastructure designed to fetch and deliver external data—such as asset prices—to a blockchain's private execution environment, like a zk-rollup or a confidential smart contract. Unlike public oracles, they must operate without revealing the sensitive data they transmit or the logic of the contracts consuming it. The core prerequisite is a blockchain ecosystem that supports confidential computation, such as Aztec Network, Aleo, or a zkEVM chain with private state capabilities. You will also need a basic understanding of zero-knowledge proofs (ZKPs) and how they enable private state transitions.

Before writing any code, you must set up your development environment. This involves installing the necessary toolchains for your target platform. For Aztec, you would install the aztec CLI via npm and set up a local sandbox. For Aleo, you would install leo and snarkos. A critical step is funding your development wallet with testnet tokens to deploy contracts and pay for private transaction fees. You should also familiarize yourself with the specific privacy model of your chosen chain, as this dictates how data is encrypted on-chain and who can decrypt it.

The next prerequisite is selecting or building the oracle mechanism itself. You have two primary architectural patterns: a trusted relay or a zk-proof of data authenticity. A trusted relay, often run by the dApp team, fetches data off-chain, encrypts it, and submits it directly to the private contract. The more advanced method uses a zk-proof, such as a zkSNARK, to cryptographically prove that the delivered data (e.g., a price feed) is correct according to a predefined public data source, without revealing the data itself in the public mempool.

For a practical example, consider setting up a simple trusted relay for Aztec. Your off-chain relayer would need the Aztec.js SDK to interact with the network. The relayer script would: 1. Fetch a price from a public API like CoinGecko. 2. Use the Aztec encryption library to encrypt the price with the public key of the target private contract. 3. Call a public function on your contract, passing the encrypted payload as calldata. The contract can then decrypt and use the value internally, with the plaintext data never appearing on the public chain.

Key dependencies for such a setup include Node.js, the chain-specific SDK (e.g., @aztec/aztec.js), and libraries for HTTP requests and scheduling. Your relayer must be run as a persistent service, which introduces operational considerations like API key management, error handling, and monitoring. For production systems, using a decentralized oracle network like API3's dAPIs or Pyth Network with zk-proof capabilities is recommended, as they provide cryptographically verified data with high availability, removing the need to manage your own relay infrastructure.

Finally, ensure you understand the security model. The trust assumptions shift from the oracle's data integrity to the correctness of the encryption and the relayer's honesty (if using a trusted model). Always audit the contract logic that processes the private data and consider the privacy leakage through transaction patterns. Testing is done on a local sandbox first, then on a public testnet like Aztec's Sepolia testnet, before any mainnet deployment.

key-concepts-text
CORE CONCEPTS: TEES AND ZERO-KNOWLEDGE PROOFS

Setting Up Privacy-Preserving Oracles for Asset Valuation

Learn how to combine Trusted Execution Environments (TEEs) and Zero-Knowledge Proofs (ZKPs) to create oracles that deliver verifiable asset prices without exposing sensitive financial data.

Privacy-preserving oracles solve a critical DeFi dilemma: how to verify sensitive financial data like asset valuations on-chain without leaking the underlying data to the public. Traditional oracles broadcast price feeds transparently, which can expose trading strategies and create front-running opportunities. By leveraging cryptographic primitives like Zero-Knowledge Proofs (ZKPs) and hardware-based Trusted Execution Environments (TEEs), developers can build oracles that prove the correctness of a computation (e.g., a fair market price) while keeping the raw input data confidential. This is essential for institutional adoption and complex financial instruments where data privacy is paramount.

A common architectural pattern uses a TEE, such as Intel SGX or AMD SEV, as a secure enclave to fetch and compute data from private sources. Inside this isolated environment, the oracle logic aggregates prices from multiple exchanges, applies a median or TWAP calculation, and then generates a zk-SNARK or zk-STARK proof. This proof attests that the output price was correctly derived from the undisclosed inputs according to a predefined algorithm. The proof is then published on-chain, where any verifier can confirm its validity in constant time, trusting the computation without seeing the source data. This decouples trust from a single data provider.

To implement this, you need to define the proving circuit for your valuation logic. Using a framework like Circom or Halo2, you create a circuit that represents the computation (e.g., (price_a + price_b + price_c) / 3). The TEE acts as the prover. A basic workflow in pseudocode involves: 1) The enclave fetches encrypted price data, 2) It computes the result, 3) It generates a witness and a ZKP, 4) It outputs the proof and the public output (the price). On-chain, a verifier smart contract, pre-loaded with the circuit's verification key, checks the proof and accepts the price if valid.

Key considerations for production systems include the trust assumptions of your TEE provider (mitigated by attestation proofs) and the cost of proof generation/gas for verification. For high-frequency data, zk-STARKs offer faster prover times and post-quantum security, though with larger proof sizes. Projects like Aleo and Aztec provide tooling for privacy-preserving applications. Always use attested TEEs from a decentralized network (e.g., Oasis Network, Phala Network) to avoid single points of failure and ensure the enclave's code matches the expected, audited binary.

This architecture enables novel use cases beyond simple price feeds. It can be used for confidential risk scoring of loan portfolios, private auction mechanisms where bids are hidden, or verifying regulatory compliance without exposing user data. By combining TEEs for confidential computation with ZKPs for verifiable integrity, developers can build the next generation of DeFi primitives that are both transparent in their correctness and private in their operation, unlocking institutional-grade financial applications on public blockchains.

PRIVACY-PRESERVING ORACLE ARCHITECTURES

Town Crier vs. DECO: Protocol Comparison

A technical comparison of two foundational approaches to building privacy-preserving oracles for confidential data feeds.

Feature / MetricTown Crier (SGX-based)DECO (TLS-based)

Core Privacy Technology

Intel SGX Enclave

TLS 1.3 Session & Zero-Knowledge Proofs

Trust Assumption

Hardware (Intel) & Remote Attestation

Cryptographic (ZK Proofs) & Decentralized Committee

Data Source Compatibility

HTTPS websites (pre-defined)

Any TLS 1.3 server (dynamic)

Confidential Query Support

Latency (Proof Generation)

< 2 seconds

2-5 seconds

On-Chain Verification Cost

~500k gas

~1.5M gas

Active Development Status

Research prototype (inactive)

Active (Chainlink DECO)

Primary Use Case

Provenance for private data

Private computation on web data

data-attestation-design
DATA ATTESTATION

Setting Up Privacy-Preserving Oracles for Asset Valuation

A guide to building an oracle system that provides verifiable asset valuations while protecting sensitive financial data from public exposure.

Privacy-preserving oracles are critical for DeFi applications that require sensitive financial data—like real-world asset (RWA) valuations, private portfolio balances, or proprietary trading signals—to be used in smart contracts without leaking that data on-chain. Traditional oracles, such as Chainlink, broadcast data publicly, which is unsuitable for confidential inputs. A data attestation scheme solves this by having a trusted entity cryptographically sign a statement about the data (the attestation) without revealing the data itself. The contract can then verify the signature's authenticity, trusting the attestation's validity based on the signer's reputation or stake.

The core cryptographic primitive for this is zero-knowledge proofs (ZKPs). A prover (the oracle node) can generate a proof that a private input x (e.g., an asset's NAV) satisfies a public function f(x) = y, revealing only the output y (e.g., a "valuation is > $1M" boolean) to the verifier (the blockchain). Frameworks like zkSNARKs (via Circom or Halo2) or zkSTARKs are used. For example, an oracle could attest that "Portfolio Value >= Collateral Requirement" is true by providing a zk-SNARK proof, allowing a lending contract to release funds without knowing the exact portfolio value.

Implementing this requires a defined architecture. A typical setup involves: 1) an off-chain client that fetches and signs the raw data, 2) a proving service (often separate for computational efficiency) that generates the ZK proof, and 3) an on-chain verifier contract. The attestation payload must be standardized. Using EIP-712 for typed structured data signing is recommended, as it provides human-readable clarity and replay protection. The signed message should include critical metadata: a schema hash, the oracle's address, a nonce, and the hashed output commitment of the private data.

Security and trust assumptions must be explicit. This model shifts trust from transparent data feeds to the attestation signer and the correctness of the ZK circuit. The signer's identity or stake must be verifiable on-chain, often through a registry or oracle stake-slashing contract. Furthermore, the ZK circuit code must be publicly auditable to ensure it correctly represents the claimed computation. For asset valuation, the circuit might verify that a signed price feed from an authorized API (like Bloomberg or Reuters) falls within a specific range, proving the valuation's legitimacy without disclosing the source data.

A practical implementation step involves writing the verification contract. Using a library like snarkjs for Ethereum, you deploy a verifier smart contract with a verifyProof function. The oracle's off-chain service would call a price API, generate a proof using a pre-compiled circuit, and submit the proof and public output to this contract. The contract checks the proof and the EIP-712 signature from a whitelisted oracle address. Only upon successful verification would the contract accept the attested valuation and trigger downstream logic, such as minting a tokenized asset or adjusting loan terms.

PRACTICAL IMPLEMENTATIONS

Smart Contract Integration Examples

Core Oracle Request Pattern

This example shows the fundamental pattern for requesting a private asset valuation from an oracle. The contract stores the oracle's address, emits an event when a request is made, and defines a callback function that only the oracle can trigger with the verified result.

solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

interface IPrivacyOracle {
    function requestValuation(bytes32 queryId, string calldata assetIdentifier) external payable;
}

contract BasicValuationClient {
    address public oracle;
    mapping(bytes32 => uint256) public valuations;
    
    event ValuationRequested(bytes32 indexed queryId, string asset);
    event ValuationReceived(bytes32 indexed queryId, uint256 value, uint256 timestamp);
    
    constructor(address _oracle) {
        oracle = _oracle;
    }
    
    function requestAssetValue(string calldata assetTicker) external payable {
        bytes32 queryId = keccak256(abi.encodePacked(assetTicker, block.timestamp, msg.sender));
        IPrivacyOracle(oracle).requestValuation{value: msg.value}(queryId, assetTicker);
        emit ValuationRequested(queryId, assetTicker);
    }
    
    // Callback function called by the oracle
    function fulfillValuation(bytes32 queryId, uint256 value) external {
        require(msg.sender == oracle, "Only oracle can fulfill");
        valuations[queryId] = value;
        emit ValuationReceived(queryId, value, block.timestamp);
    }
}

Key Components:

  • requestAssetValue: Initiates the request, paying the oracle fee.
  • fulfillValuation: The callback where the oracle submits the proof-backed result.
  • queryId: A unique identifier linking request and response.
ORACLE ARCHITECTURE COMPARISON

Security and Operational Risk Matrix

Risk assessment for different oracle designs in privacy-preserving asset valuation systems.

Risk FactorSingle-Source OracleMulti-Source AggregationDecentralized Oracle Network (DON)

Data Manipulation Risk

Critical

High

Low

Single Point of Failure

Privacy Leakage (Source)

High

Medium

Low

Liveness / Uptime SLA

99.5%

99.9%

99.95%

Latency to Finality

< 1 sec

2-5 sec

5-15 sec

Operational Cost (Monthly)

$1k-5k

$5k-15k

$15k-50k+

Censorship Resistance

Cryptoeconomic Security

$50M+ Staked

PRIVACY-PRESERVING ORACLES

Frequently Asked Questions

Common technical questions and solutions for developers implementing privacy-preserving oracles for sensitive financial data like asset valuations.

A privacy-preserving oracle is a specialized oracle service that fetches and delivers off-chain data (like asset prices) to a blockchain without revealing the raw data or the requester's intent on-chain. It uses cryptographic techniques to maintain confidentiality.

Key differences from a standard oracle:

  • Data Confidentiality: The actual price or data point is not published in plaintext on the blockchain. Instead, proofs or encrypted results are submitted.
  • Request Privacy: The identity of the smart contract or user requesting the data can be hidden, preventing front-running or information leakage.
  • Computation Off-Chain: Heavy cryptographic operations (like generating Zero-Knowledge Proofs (ZKPs)) are performed off-chain, with only a small, verifiable proof posted on-chain.

For example, while Chainlink's standard oracle publishes a price feed publicly, a privacy-preserving version might allow a lending protocol to verify a user's collateral value is sufficient via a ZKP, without exposing the exact value.

conclusion
IMPLEMENTATION SUMMARY

Conclusion and Next Steps

You have configured a privacy-preserving oracle system for secure, off-chain asset valuation. This guide covered the core components and integration steps.

The system you've built leverages zero-knowledge proofs (ZKPs) and trusted execution environments (TEEs) to fetch and compute sensitive price data without exposing the raw inputs. By using a service like Chainlink Functions with a DECO-style proof or an Aztec zkOracle, you ensure that only the verified result—such as a volume-weighted average price (VWAP)—is published on-chain. This protects your strategy from front-running and minimizes the data leakage that traditional oracles can introduce.

For production deployment, your next steps should focus on robustness and cost optimization. Consider implementing a fallback oracle mechanism, perhaps using a committee of TEE-based oracles like Supra or Phala Network for redundancy. Audit the cryptographic assumptions of your chosen ZK circuit or TEE attestation. Furthermore, analyze the gas cost of proof verification on your target chain (e.g., Ethereum, Arbitrum, zkSync Era) and model the operational costs of frequent updates to ensure economic sustainability.

To extend this architecture, explore more complex valuation models. Instead of a single price feed, your off-chain compute could calculate risk-adjusted valuations using volatility data from multiple sources, or compute a custom index for a basket of assets. The privacy-preserving oracle pattern is also applicable beyond DeFi: consider it for verifiable randomness in gaming, private identity attestations, or confidential supply chain data in enterprise blockchains. The core principle remains: sensitive logic executes confidentially off-chain, with only a verifiably correct output committed on-chain.

Continue your development by reviewing the formal documentation for the specific protocols you integrated. For ZK oracles, study the circuit logic and trust assumptions. For TEE-based systems, understand the remote attestation process and the provider's security model. Engage with the developer communities on forums like the Chainlink Discord or the Aztec forum to stay updated on new features and best practices for maintaining a secure, reliable data pipeline for your applications.

How to Set Up Privacy-Preserving Oracles for Asset Valuation | ChainScore Guides