OutLayer Documentation
Getting Started
What is OutLayer?#
OutLayer lets you run any off-chain code (random numbers, HTTP requests, AI models, heavy computations) with cryptographic proof that exactly the code you specified ran with the inputs you provided.
Call OutLayer from NEAR smart contracts (yield/resume) or any app via HTTPS. Every execution produces verifiable TEE attestation - no trust required, just math.
Verifiable Execution (TEE)#
Every OutLayer execution runs inside Intel TDX (Trusted Execution Environment) and produces a cryptographic attestation proving:
π Code Integrity - SHA256 of exact WASM binary
π₯ Input Integrity - SHA256 of input data
π€ Output Integrity - Result from that code + input
π‘οΈ Worker Identity - Verified TEE measurements
π― Why this matters: Anyone can independently verify that your code ran correctly. No "trust us" - cryptographic proof signed by Intel hardware.Learn more β
Upgradeable TEE Vault#
Build wallet apps where private keys live inside TEE. Update your code anytime β secrets persist across upgrades thanks to Confidential Key Derivation (CKD).
How it works: Your project gets a unique derived key from DAO-controlled master key. Only your WASM code running in TEE can access it. Change your code β same key, same secrets.
π‘ CKD Documentation β’ DAO Governance β
Two Ways to Use OutLayer#
Choose based on your use case. Both provide the same verifiable execution guarantees.
π Blockchain (NEAR)
- β’ Smart contract callbacks via yield/resume
- β’ Pay with NEAR tokens
- β’ On-chain settlement & refunds
- β’ Best for: DeFi, DAOs, on-chain apps
π HTTPS API
- β’ Direct HTTP calls, instant response
- β’ Pay with USDC (Payment Keys)
- β’ No blockchain knowledge needed
- β’ Best for: Web apps, APIs, backends
Blockchain Flow (NEAR Yield/Resume)#
NEAR's yield/resume allows smart contracts to pause execution, wait for off-chain computation, then resume with the result - all in one logical transaction.
π― Key benefit: From the user's perspective, it's still ONE transaction. They click once, wait a few seconds, and get the final result. No manual follow-up transactions needed.
HTTPS Flow (Direct API)#
Call OutLayer directly via HTTPS - no blockchain transactions, instant response. Ideal for developers who want to monetize their APIs and provide users with cryptographic proof of what code actually ran.
π― Key benefit: Sub-second response, no blockchain knowledge needed. Same verifiable execution, just via HTTP. Pay with USDC via Payment Keys. Optionally send payment to app author via X-Attached-Deposit header.
Why OutLayer Makes This Easy#
β No infrastructure setup - We run the workers, you just write code
β No access control headaches - Your contract stays in control. We just return results, you decide what to do with them in your callback
β No worker delegation - You don't give us permissions on your contract. We can't do anything except call your callback with results
β GitHub-based deployment - Push code to GitHub, reference the repo in your contract call. We compile and execute automatically
β Encrypted secrets support - Need API keys? Store them encrypted on-chain with access control, we inject them as environment variables during execution
Quick Start: 4 Steps#
1οΈβ£ Write Your Code
Create a project that compiles to WebAssembly. Rust recommended, other languages supported.
π Tutorial β’ Examples β’ Building Apps
2οΈβ£ Push to GitHub or Provide WASM URL
Option A: Push to GitHub (public or private with access tokens). OutLayer will clone and compile on-demand.
Option B: Host pre-compiled WASM file anywhere and provide direct URL.
β±οΈ GitHub: first execution compiles (10-30 sec), then cached. WASM URL: instant execution.
3οΈβ£ Call OutLayer
Option A: HTTPS API β call directly from any app
curl -X POST https://api.outlayer.io/call/owner/project \
-H "X-Payment-Key: pk_..." \
-d '{"param": 123}'π HTTPS Guide β’ API Reference
Option B: NEAR transaction
near call outlayer.testnet request_execution '\
{"source": {"GitHub": {"repo": "github.com/you/project", "commit": "main"}}, \
"input_data": "{\"param\":123}"}' \
--accountId you.testnet --deposit 0.1Option C: Smart contract integration
4οΈβ£ Receive Result
HTTPS returns JSON response instantly. NEAR contract receives callback automatically. Excess payment refunded based on actual resources used.
5οΈβ£ Verify Attestation
Every execution produces TEE attestation β cryptographic proof of what code ran with what inputs.
π How Attestation Works β’ View Executions
Secrets#
Store encrypted API keys and credentials with access control. OutLayer decrypts them during execution β your code reads them as environment variables. Update your code anytime β secrets persist across upgrades.
π Protected Secrets (CKD): Generate keys that nobody knows β not even you. Only your WASM code running in TEE can access them. Perfect for wallet apps and signing keys.
π‘ Manage Secrets β’ CKD Docs β’ Learn more β
Payment & Pricing#
Pay per execution based on actual resources used. Unused deposit automatically refunded.
π‘ Pricing details β
Persistent Storage#
Store data between executions with encrypted persistent storage. Data persists across code updates and is only accessible by your code.
π‘ Storage Guide β’ Projects β