Skip to content

Commit 94b7428

Browse files
Merge pull request #141 from oasisprotocol/uniyalabhishek/feature/privana-docs-migration
feat: add Privana Docusaurus docs site
2 parents 745099d + 179e7e0 commit 94b7428

26 files changed

Lines changed: 3746 additions & 0 deletions

.github/workflows/ci-docs.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# NOTE: This name appears in GitHub's Checks API and in workflow's status badge.
2+
name: ci-docs
3+
4+
on:
5+
push:
6+
branches: [master]
7+
pull_request:
8+
branches: [master]
9+
10+
jobs:
11+
ci-docs:
12+
# NOTE: This name appears in GitHub's Checks API.
13+
name: ci-docs
14+
runs-on: ubuntu-latest
15+
defaults:
16+
run:
17+
working-directory: docs
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Setup Bun
22+
uses: oven-sh/setup-bun@v2
23+
24+
- name: Setup Node
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: 20.x
28+
29+
- name: Install dependencies
30+
run: bun install --frozen-lockfile
31+
32+
- name: Build website
33+
run: bun run build
34+
35+
- name: Deploy to GitHub Pages
36+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
37+
uses: peaceiris/actions-gh-pages@v4
38+
with:
39+
github_token: ${{ secrets.GITHUB_TOKEN }}
40+
publish_dir: ./docs/build
41+
force_orphan: true
42+
cname: docs.privana.finance
43+
user_name: github-actions[bot]
44+
user_email: 41898282+github-actions[bot]@users.noreply.github.com

docs/.gitignore

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Docusaurus build artefacts
2+
/.docusaurus
3+
/build
4+
/node_modules
5+
6+
# Caches
7+
/.cache-loader
8+
9+
# Local env
10+
.env.local
11+
.env.development.local
12+
.env.test.local
13+
.env.production.local
14+
15+
# Logs
16+
npm-debug.log*
17+
yarn-debug.log*
18+
yarn-error.log*
19+
pnpm-debug.log*
20+
21+
# TypeScript
22+
*.tsbuildinfo

docs/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Privana documentation
2+
3+
Source for [docs.privana.finance](https://docs.privana.finance). Built with [Docusaurus 3](https://docusaurus.io/).
4+
5+
The Markdown content lives under [`docs/`](./docs/). The Docusaurus app shell (config, theme, sidebar) lives in this directory.
6+
7+
## Local development
8+
9+
Requires [Bun](https://bun.sh/) and Node ≥ 20.
10+
11+
```bash
12+
bun install # install deps from bun.lock
13+
bun start # dev server with hot reload at http://localhost:3000
14+
```
15+
16+
Other useful scripts:
17+
18+
```bash
19+
bun run build # production build → ./build/
20+
bun run serve # serve the production build locally
21+
bun run typecheck # run tsc against docusaurus.config.ts and sidebars.ts
22+
bun run clear # clear Docusaurus cache when something is misbehaving
23+
```

docs/bun.lock

Lines changed: 2841 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
id: deep-dive
3+
title: "Architecture Deep Dive"
4+
sidebar_position: 2
5+
description: "The full Privana architecture, from the layers that make it up to the components that handle your trades and policies."
6+
---
7+
8+
The full Privana architecture, from the layers that make it up to the components that handle your trades and policies.
9+
10+
The Privana architecture has four principal layers: integrators (the Privana app and third-party applications), the SDK interface, the liquidity infrastructure, and the core service. Here's how they fit together.
11+
12+
```mermaid
13+
flowchart TB
14+
A["<b>Integrators</b> — Privana app + third-party applications<br/>Any Web3 product can build on Privana via the SDK"]
15+
B["<b>Privana SDK</b> — REST & WebSocket API (runs inside ROFL)<br/>Key encumbrance · session access · private trading · yield · automation"]
16+
C["<b>Core Service</b> (inside Oasis Sapphire TEE)<br/><b>Accounting Block:</b> confidential balance tracking, deposit monitoring, KYT, finality reconciliation<br/><b>Microservices Block:</b> trading microservice, yield microservice (modular — more services planned)"]
17+
D["<b>Liquidity Infrastructure</b> — TEE-managed pooled vaults on Ethereum, Base, and HyperEVM<br/>Seeded with inventory · all user deposits flow here · privacy through pooling"]
18+
A --> B
19+
B --> C
20+
C --> D
21+
```
22+
23+
### The accounting block
24+
25+
The accounting block is a set of Oasis Sapphire confidential smart contracts that function as the system's internal state. It maintains a confidential mapping of deposit addresses to asset balances and handles deposit monitoring, balance registration, transaction screening (KYT), balance validation before trades, routing of validated intents to the correct microservice, finality reconciliation after trade execution, and withdrawal processing across all supported chains.
26+
27+
### The microservices block
28+
29+
The microservices block implements the execution logic for DeFi operations. For the MVP, two microservices are provided: trading and yield (covered in the [Private Swaps](../features/private-swaps.md) and [Idle Yield](../features/idle-yield.md) sections). The modular architecture is designed for horizontal expansion — additional microservices like perpetuals trading or lending can be added without modifying the core accounting logic, and each new service automatically inherits the same key-encumbrance and privacy guarantees.
30+
31+
### Remote attestation
32+
33+
Attestation reports, signed by Intel's hardware root of trust, allow you to verify remotely that the enclave is running exactly the code it claims to be running. This means you don't need to trust Privana's word about what code is executing — you can cryptographically verify it. This is a stronger guarantee than an audit alone can provide.
34+
35+
### What Privana enables beyond DeFi
36+
37+
Because Privana exposes a composable SDK, it's not limited to DeFi applications. Any Web3 product that needs privacy, session-based access, or automated policy execution can integrate it. The Oasis team is also developing a gaming application that uses Privana to let players transact with real assets without signing each action — time-bounded access-control policies create a seamless experience comparable to Web2 gaming.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
id: fallback-recovery
3+
title: "Fallback & Recovery"
4+
sidebar_position: 3
5+
description: "What happens if the enclave goes offline permanently, or if Privana ceases to exist? The answer is built into the system — not a service promise."
6+
---
7+
8+
What happens if the enclave goes offline permanently, or if Privana ceases to exist? The answer is built into the system — not a service promise.
9+
10+
Privana uses a fallback system informed by the sentinel-wallet design described in the Liquefaction research paper:
11+
12+
```js
13+
// The Ethereum-based liveness monitor
14+
Ethereum contract monitors Oasis Sapphire liveness
15+
→ Checks for valid response from enclave every ~24 hours
16+
→ If NO response for 7 days:
17+
→ Challenge period opens (publicly visible on-chain)
18+
→ Backup TEE committee reconstructs vault keys
19+
from Shamir secret shares (distributed — no single party alone)
20+
→ Keys are released to the ACCESS MANAGER
21+
(this is you — the vault owner)
22+
→ You can then sweep your assets directly
23+
24+
// No trust in Privana required for recovery
25+
// Recovery process is deterministic and on-chain
26+
```
27+
28+
The fallback is a **smart contract on Ethereum**, not a process Privana controls. It triggers automatically if the enclave becomes unresponsive for a week. A distributed reconstruction process — using Shamir secret shares held by multiple independent parties — allows the vault keys to be recovered by you, without Privana's involvement.
29+
30+
:::tip[The important point]
31+
32+
Your assets are never permanently locked. Even if Privana ceases operations, your funds are recoverable within a week via the on-chain fallback mechanism. This is a **system guarantee**, not a service-level agreement.
33+
34+
:::
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
id: oasis-sapphire
3+
title: "Oasis Sapphire"
4+
sidebar_position: 1
5+
description: "Oasis Sapphire is the confidential blockchain Privana runs on — an EVM platform whose smart contracts execute inside Intel SGX enclaves."
6+
---
7+
8+
Oasis Sapphire is the confidential blockchain that everything in Privana runs on. It provides the hardware-secured foundation that makes private, non-custodial DeFi possible.
9+
10+
**[Oasis Sapphire](https://docs.oasis.io/dapp/sapphire/)** is a smart contract platform built on the [Oasis Network](https://oasis.net/) that runs the Ethereum Virtual Machine (EVM) entirely within Intel SGX enclaves. This means smart contract logic *and* its state are confidential by default — transactions are encrypted, contract storage is encrypted, and even the validators running the network cannot read what's happening inside a contract.
11+
12+
Sapphire provides several properties that are critical to Privana:
13+
14+
### Confidential State
15+
16+
Contract storage is encrypted on-chain and in memory. State is accessible only to the executing TEE. This is what keeps your balances, policies, and trade history private. [Learn more →](https://docs.oasis.io/dapp/sapphire/)
17+
18+
### Rollback Protection
19+
20+
Keys inside the enclave cannot be "rewound" to a previous state — preventing attacks where someone rolls back enclave state to re-use a spent nonce. Sapphire handles this at the platform level.
21+
22+
### Off-Chain Simulation
23+
24+
Sapphire functions can be invoked via free, off-chain queries that simulate transactions without modifying storage. Both on-chain and off-chain invocations run inside the TEE and require signed authentication — enabling cost-efficient policy evaluation.
25+
26+
### EVM Compatibility
27+
28+
Sapphire supports standard Solidity smart contracts. Developers don't need specialized TEE knowledge to build on it — the confidentiality layer is handled by the platform.
29+
30+
### ROFL: Runtime Off-chain Logic
31+
32+
Privana also uses **[ROFL](https://docs.oasis.io/build/rofl/)** (Runtime Off-chain Logic) — containers running inside a TEE that are attested on-chain by Oasis Sapphire. The Privana SDK exposes its REST and WebSocket API through ROFL, meaning the entire communication channel between the Privana app and the Privana service runs inside attested, TEE-secured containers. Sapphire can seamlessly verify that EVM transactions originate from a specific ROFL instance.
33+
34+
### Cross-chain signing
35+
36+
Here's what makes this architecture powerful for users: an Oasis Sapphire contract running inside a TEE can **sign valid transactions for any external chain**. Your Ethereum swap is signed inside an Oasis Sapphire enclave and submitted directly to Ethereum — never passing through a public Ethereum mempool. The target chain receives a completed, signed transaction. There is no window in which bots can see your intent.
37+
38+
For more technical detail, see the [Oasis Sapphire developer documentation](https://docs.oasis.io/dapp/sapphire/) and the [Oasis Protocol overview](https://oasis.net/).
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
id: research-basis
3+
title: "Research Basis"
4+
sidebar_position: 5
5+
description: "Privana's architecture is grounded in peer-reviewed cryptographic research published by Cornell Tech."
6+
---
7+
8+
Privana's architecture is grounded in peer-reviewed cryptographic research published by Cornell Tech.
9+
10+
### Primary Research Paper
11+
12+
**"Liquefaction: Privately Liquefying Blockchain Assets"**
13+
Austgen, Fábrega, Kelkar, Vilardell, Allen, Babel, Yu, and Juels — Cornell Tech
14+
arXiv: [2412.02634](https://arxiv.org/abs/2412.02634), December 2024
15+
16+
This paper introduces key encumbrance as a primitive, formalizes the SEAO assumption that conventional wallets rely on, and proves security properties of TEE-based policy governance. The paper demonstrates that TEE-based key encumbrance can break the Single-Entity Address-Ownership assumption, enabling private renting, sharing, and pooling of blockchain assets and privileges. Privana is the Oasis Network's production implementation of the Liquefaction framework.
17+
18+
### Key concepts from the research
19+
20+
#### Key Encumbrance
21+
22+
The core primitive. A private key generated and held within a TEE, governed by programmable access-control policies. Enables automation without custody transfer.
23+
24+
#### SEAO Assumption
25+
26+
Single-Entity Address-Ownership — the assumption that one blockchain address is controlled by a single entity. Key encumbrance breaks this in a controlled, beneficial way.
27+
28+
#### Asset-Time Segmentation
29+
30+
The principle that a given asset is exclusively controlled by one sub-policy at any given time. Prevents deadlock and double-spend between competing policies.
31+
32+
#### Overlay Smart Contracts
33+
34+
Because encumbered keys are managed off-chain (in TEEs), smart-contract-like logic can be applied to chains that have no native smart contract support — Bitcoin, Dogecoin, Litecoin, etc.
35+
36+
### Additional references
37+
38+
The FlexVaults whitepaper cites several additional works relevant to the security model: Kelkar et al. on Complete Knowledge proofs (ACM CCS, 2024), Jean-Louis et al. on privacy flaws in TEE-based platforms (ePrint 2023/378), and Van Schaik et al. on SGX security (IEEE S&P, 2024). For readers interested in the full security analysis, the [Liquefaction paper](https://arxiv.org/abs/2412.02634) is the recommended starting point.
39+
40+
For Oasis-specific technical resources: [Sapphire developer documentation](https://docs.oasis.io/dapp/sapphire/), [ROFL documentation](https://docs.oasis.io/build/rofl/), and the [Oasis Protocol overview](https://oasis.net/).
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
id: trust-model
3+
title: "Trust Model"
4+
sidebar_position: 4
5+
description: "No system is trustless. Privana minimizes trust requirements — but you should understand exactly what assumptions remain."
6+
---
7+
8+
No system is trustless. Privana minimizes trust requirements — but you should understand exactly what assumptions remain.
9+
10+
| Component | Trust Assumption | Mitigation |
11+
| --- | --- | --- |
12+
| Intel SGX | Hardware integrity of the enclave | Industry standard; used by Fireblocks, Azure confidential computing. Side-channel research is ongoing — see [Research Basis](./research-basis.md). |
13+
| Oasis Sapphire | Correct implementation of confidential contracts; blockchain liveness | Open-source, audited. Decentralized validator network. Native rollback protections. [Sapphire docs →](https://docs.oasis.io/dapp/sapphire/) |
14+
| Privana service code | Enclave code does what it claims | Remote attestation allows cryptographic verification of the exact running code. |
15+
| Privana / Oasis team | Cannot access vault keys | Architecture enforces this — SGX prevents privileged access. Not a promise; a hardware constraint. |
16+
| Pooled vault model | Users trust the vault's accounting logic to protect all balances correctly | Accounting logic runs inside TEE on Oasis Sapphire. Trust is bounded by TEE + blockchain security model. |
17+
| Yield protocols | Smart contract risk (Aave at launch) | Only vetted protocols. Yield is opt-in. Automatic unwinding if a protocol is delisted. |
18+
| DEX execution (Seq. 3) | LiFi aggregator executes as expected | Standard on-chain DEX risk. Slippage protection and spread thresholds enforced in policy. |
19+
20+
Two risks Privana cannot eliminate: (1) vulnerabilities in Intel SGX itself — a class of hardware-level attacks that exist for all TEE platforms, and (2) smart contract bugs in the external yield protocols you choose to use. Both are disclosed openly, and the system mitigates them through conservative platform selection, audits, and protocol vetting.
21+
22+
### Complete Knowledge proofs
23+
24+
The Liquefaction framework discusses **Complete Knowledge (CK) proofs** — cryptographic proofs that a user has unencumbered access to a private key. While Privana implements constructive (beneficial) applications of key encumbrance rather than adversarial ones, CK proofs could become a valuable complement — for example, allowing centralized exchanges to verify that a depositor's keys are not encumbered. The Oasis team is monitoring developments in CK proof practicality, particularly as mobile-TEE attestation hardware matures.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
id: key-encumbrance
3+
title: "Key Encumbrance"
4+
sidebar_position: 3
5+
description: "Define wallet rules once and let the hardware enclave enforce them. Key encumbrance gives you DeFi automation without surrendering your private key."
6+
---
7+
8+
Traditional wallets require you to manually approve every transaction. Key encumbrance lets you define rules once, and the hardware enclave enforces them automatically — without ever exposing your keys.
9+
10+
In a standard DeFi wallet, you control a private key and must sign every action yourself. This makes automation impossible without handing your key to a third party — which defeats the purpose of self-custody.
11+
12+
**Key encumbrance** breaks this trade-off. It's a concept from the [Liquefaction research paper](https://arxiv.org/abs/2412.02634) by Austgen et al. at Cornell Tech. The idea: a private key is generated and held inside a TEE, and it is governed by **programmable access-control policies** that define exactly what the key is allowed to sign. The key has never existed outside the enclave. It is "encumbered" — it can only act within the bounds of the policies you set.
13+
14+
Instead of signing each transaction yourself, you define a policy once. The enclave then executes on your behalf, but only within those bounds. You can revoke or update the policy at any time.
15+
16+
```js
17+
// Example policy: delegate yield routing, keep direct swap control
18+
{
19+
asset: "USDC",
20+
spend_limit: 1000 USDC/day, // max automated spend
21+
destination_lock: ["aave-v3"], // only this protocol
22+
expires: 30 days, // time-bound — auto-expires
23+
revocable: true // you can always cancel
24+
}
25+
26+
// The enclave enforces these limits in hardware.
27+
// No one — including Privana — can execute outside these rules.
28+
```
29+
30+
### Asset-Time Segmentation
31+
32+
Privana enforces a principle called **Asset-Time Segmentation**: at any given time, a specific asset position is exclusively controlled by one actor — either you directly, or a delegation you've granted. Two policies can never simultaneously claim the same assets. This prevents conflicts and ensures you can always exit — a yield delegation cannot prevent you from withdrawing your funds.
33+
34+
### What this changes
35+
36+
Key encumbrance breaks what cryptographers call the **SEAO assumption** — Single-Entity Address-Ownership. With a standard wallet, one address equals one person who controls it absolutely. With key encumbrance, an address can be governed by complex policy rules: multiple delegations, time bounds, asset limits — all enforced in hardware, all without transferring custody. This is what makes automated, private DeFi possible without giving up control.
37+
38+
:::info[A helpful analogy]
39+
40+
Think of key encumbrance like a power of attorney with strict, hardware-enforced limits. You've given instructions — but those instructions are locked into hardware that even the person holding the power of attorney can't change. And you can revoke it the moment you want.
41+
42+
:::

0 commit comments

Comments
 (0)