diff --git a/README.md b/README.md index 5ca6ebe..af82078 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,20 @@ # descro -A decentralized escrow protocol on Solana for physical goods trading. Fully permissionless and resolver-agnostic — any wallet or program that implements the resolver interface can adjudicate disputes. +A decentralized escrow protocol on Solana for physical goods trading. Fully permissionless and resolver-agnostic: any wallet or program that implements the resolver interface can adjudicate disputes. ## 🌍 Vision & Concept -Buying and selling physical goods peer-to-peer runs on trust — and today that trust is either placed in a centralized platform that takes a cut and can freeze your funds, or in nothing at all, leaving buyers and sellers to hope the other side follows through. descro removes that single point of control: funds sit in an on-chain vault that only releases according to rules enforced by the protocol itself, not by a company. +Buying and selling physical goods peer-to-peer runs on trust. Today that trust is either placed in a centralized platform that takes a cut and can freeze your funds, or in nothing at all, leaving buyers and sellers to hope the other side follows through. descro removes that single point of control: funds sit in an on-chain vault that only releases according to rules enforced by the protocol itself, not by a company. -Instead of building one monolithic marketplace, descro splits the problem into a minimal **protocol layer** (escrow logic + a resolver registry) and lets anyone build the **application layer** on top — from a slick, KYC'd consumer app to a raw wallet-to-wallet trade between two people who've never met. +Instead of building one monolithic marketplace, descro splits the problem into a minimal **protocol layer** (escrow logic + a resolver registry) and lets anyone build the **application layer** on top, from a slick, KYC'd consumer app to a raw wallet-to-wallet trade between two people who've never met. -- ⚖️ **Resolver-agnostic by design** — disputes aren't adjudicated by descro itself. Any wallet or program that implements the resolver interface can be plugged in: a single trusted authority, a multisig, a jury DAO, or an algorithmic (MAD-style) resolver. -- 🔓 **Fully permissionless** — no whitelist, no gatekeeping. Anyone can create an escrow, register as a resolver, or build a client against the protocol. -- 🔒 **Non-custodial by construction** — SOL lives in a program-owned vault, not a company's balance sheet. Nobody, including descro itself, can move funds without satisfying the on-chain rules. -- 🧩 **Progressive decentralization** — a central platform (own resolver, KYC, familiar UX) can onboard mainstream users first, while the same trades quietly build up a decentralized backend anyone can tap into directly, with free choice of resolver, once critical mass is reached. -- ⚡ **Built for Solana** — sub-cent transaction fees and ~400ms finality mean the on-chain plumbing can stay invisible to end users while still being fully verifiable. -- 🧱 **Minimal, composable core** — the escrow program only knows about escrow state and SOL; dispute resolution is entirely external via CPI, so the protocol doesn't need to be trusted to "get justice right," only to enforce the interface correctly. -- 🛡️ **Trust-minimized stats** — resolver reputation (fee, resolution history) lives in an on-chain registry that only the escrow program can update, so it can't be gamed by a resolver inflating its own track record. +- ⚖️ **Resolver-agnostic by design**: disputes aren't adjudicated by descro itself. Any wallet or program that implements the resolver interface can be plugged in, whether that's a single trusted authority, a multisig, a jury DAO, or an algorithmic (MAD-style) resolver. +- 🔓 **Fully permissionless**: no whitelist, no gatekeeping. Anyone can create an escrow, register as a resolver, or build a client against the protocol. +- 🔒 **Non-custodial by construction**: SOL lives in a program-owned vault, not a company's balance sheet. Nobody, including descro itself, can move funds without satisfying the on-chain rules. +- 🧩 **Progressive decentralization**: a central platform (own resolver, KYC, familiar UX) can onboard mainstream users first, while the same trades quietly build up a decentralized backend anyone can tap into directly, with free choice of resolver, once critical mass is reached. +- ⚡ **Built for Solana**: sub-cent transaction fees and ~400ms finality mean the on-chain plumbing can stay invisible to end users while still being fully verifiable. +- 🧱 **Minimal, composable core**: the escrow program only knows about escrow state and SOL; dispute resolution is entirely external via CPI, so the protocol doesn't need to be trusted to "get justice right," only to enforce the interface correctly. +- 🛡️ **Trust-minimized stats**: resolver reputation (fee, resolution history) lives in an on-chain registry that only the escrow program can update, so it can't be gamed by a resolver inflating its own track record. ## Overview @@ -30,7 +30,7 @@ PROTOCOL LAYER └─────────────────┘ └──────────────────────┘ ``` -The protocol only defines the interface. Any resolver that implements it is compatible — from a single authority wallet to a jury DAO voting contract. +The protocol only defines the interface. Any resolver that implements it is compatible, from a single authority wallet to a jury DAO voting contract. ## Programs @@ -43,8 +43,8 @@ The protocol only defines the interface. Any resolver that implements it is comp Holds trade state and SOL. Two PDAs per escrow: -- **EscrowAccount** `["escrow", seller_pubkey, escrow_id_le_bytes]` — trade state -- **Vault** `["vault", escrow_account_pubkey]` — system-owned, holds SOL only +- **EscrowAccount** `["escrow", seller_pubkey, escrow_id_le_bytes]`: trade state +- **Vault** `["vault", escrow_account_pubkey]`: system-owned, holds SOL only **Instruction flow:** @@ -57,7 +57,7 @@ create_escrow (seller) cancel (seller, only from AwaitingDeposit) ``` -The `dispute_resolver` field in the escrow can be any pubkey — a wallet signing directly or a program calling `resolve()` via CPI. The check is identical either way. +The `dispute_resolver` field in the escrow can be any pubkey, whether that's a wallet signing directly or a program calling `resolve()` via CPI. The check is identical either way. **Emergency resolve:** After 14 days in `Disputed` state with no resolution, either party can call `emergency_resolve` to unlock funds. @@ -65,7 +65,7 @@ The `dispute_resolver` field in the escrow can be any pubkey — a wallet signin An on-chain directory for resolvers. Resolvers register with metadata (name, type, fee, URI); resolution stats are auto-incremented by the escrow program via CPI and cannot be manipulated externally. -`update_stats` is callable only by the escrow program — enforced via an `["escrow_authority"]` PDA that only the escrow program can sign for. +`update_stats` is callable only by the escrow program, enforced via an `["escrow_authority"]` PDA that only the escrow program can sign for. Resolver types: `CentralAuthority`, `JuryDAO`, `MAD`, `Algorithmic`, `Multisig` @@ -100,7 +100,7 @@ app/ — Next.js + Tamagui playground ### Build -Programs must be built in order — the escrow program depends on the registry: +Programs must be built in order, since the escrow program depends on the registry: ```bash cargo build-sbf --manifest-path programs/descro_ext_resolvers/Cargo.toml @@ -137,7 +137,7 @@ yarn workspace descro-app run dev ## SDK Usage -The SDK is consumed as raw TypeScript via `transpilePackages` in the Next.js config — no build step needed. +The SDK is consumed as raw TypeScript via `transpilePackages` in the Next.js config, so no build step is needed. ```ts import { DescroSdk } from "@descro/sdk"; @@ -167,6 +167,6 @@ sdk.listener.onEscrowUpdate(escrowPubkey, (account) => { ... }); ## Architecture Notes - **Anchor 1.0.x:** `UncheckedAccount<'info>` with `/// CHECK:` doc comments; `#[derive(InitSpace)]` + `#[max_len(N)]` for strings. -- **`@coral-xyz/anchor@0.32.x`:** Use `new Program(idl, provider)` — the IDL's `address` field provides the program ID. The 3-argument form is broken in 0.32.x. -- **Yarn workspaces:** `nodeLinker: node-modules` (not PnP) — required for Next.js Turbopack compatibility. +- **`@coral-xyz/anchor@0.32.x`:** Use `new Program(idl, provider)`. The IDL's `address` field provides the program ID. The 3-argument form is broken in 0.32.x. +- **Yarn workspaces:** `nodeLinker: node-modules` (not PnP), required for Next.js Turbopack compatibility. - **LiteSVM tests:** each `tests/common/mod.rs` provides `setup()`, PDA helpers, `send()`/`try_send()`, `ix_*` builders, and `read_*` deserializers. `test_resolve_with_registry.rs` loads both `.so` files to test the full CPI flow.