> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/zkp2p/zkp2p-contracts/llms.txt
> Use this file to discover all available pages before exploring further.

# Introduction

> Learn about ZKP2P v2.1 - A decentralized protocol for trustless peer-to-peer fiat-to-crypto exchanges

## What is ZKP2P?

ZKP2P is a decentralized protocol enabling **trustless peer-to-peer exchanges** between fiat currency and cryptocurrency. Users can on-ramp (buy crypto with fiat) or off-ramp (sell crypto for fiat) directly with counterparties, without intermediaries or centralized custody.

The v2.1 smart contracts form the core infrastructure for the ZK P2P fiat on/off-ramp, centered around three main components:

* **Escrow**: Manages liquidity deposits from makers
* **Orchestrator**: Coordinates the intent lifecycle and verification
* **Unified Payment Verifier**: Validates off-chain payment attestations for multiple payment methods

<Info>
  ZKP2P uses zero-knowledge proofs to verify payment receipts without exposing sensitive user data, ensuring privacy while maintaining trustlessness.
</Info>

## Key Features

<CardGroup cols={2}>
  <Card title="Trustless P2P Trading" icon="handshake">
    Direct fiat-to-crypto exchanges without intermediaries or custodians. Smart contracts guarantee settlement based on cryptographic proofs.
  </Card>

  <Card title="Multi-Platform Support" icon="building-columns">
    Support for 8+ payment platforms including Venmo, PayPal, Wise, Zelle, CashApp, Revolut, MercadoPago, and Monzo.
  </Card>

  <Card title="Zero-Knowledge Privacy" icon="shield-halved">
    Payment verification without exposing sensitive data. zkTLS proofs validate transactions while preserving user privacy.
  </Card>

  <Card title="Intent-Based Architecture" icon="arrows-spin">
    Efficient liquidity matching and settlement through an intent-based system. Makers provide liquidity, takers signal intent to trade.
  </Card>

  <Card title="Modular Design" icon="puzzle-piece">
    Pluggable verifiers and extensible registry system. Easy to add new payment methods and customize verification logic.
  </Card>

  <Card title="EIP-712 Attestations" icon="file-signature">
    Standardized, typed data signing for off-chain payment proofs that integrate seamlessly with on-chain verification.
  </Card>
</CardGroup>

## Use Cases

### On-Ramp: Buy Crypto with Fiat

Users can purchase USDC with fiat currency through verified payment platforms. The process is simple:

1. Find a maker's deposit with your preferred payment method
2. Signal your intent to buy a specific amount
3. Send fiat payment off-chain through the payment platform
4. Submit payment proof to unlock USDC on-chain

<Tip>
  On-ramping allows you to convert local fiat currency to USDC without using a centralized exchange, maintaining full custody throughout.
</Tip>

### Off-Ramp: Sell Crypto for Fiat

Liquidity providers (makers) can deposit USDC to earn fees by facilitating trades:

1. Create a deposit with supported payment methods and rates
2. Configure minimum/maximum trade amounts and accepted currencies
3. Receive fiat payments from takers off-chain
4. Earn protocol fees on successful trades

### Cross-Border Payments

Access global liquidity through multiple payment rails. Users can:

* Trade across different payment platforms (e.g., send USD via Venmo, receive EUR via Wise)
* Support for multiple fiat currencies per payment method
* Configurable conversion rates set by liquidity providers

## How It Works

ZKP2P uses an **intent-based trading model** where:

<Steps>
  <Step title="Maker Deposits Liquidity">
    A liquidity provider (maker) creates a deposit on the Escrow contract, specifying accepted payment methods, currencies, and conversion rates.
  </Step>

  <Step title="Taker Signals Intent">
    A buyer (taker) signals their intent to trade by locking the maker's liquidity through the Orchestrator contract.
  </Step>

  <Step title="Off-Chain Payment">
    The taker sends fiat payment to the maker through the specified payment platform (e.g., Venmo, PayPal).
  </Step>

  <Step title="Payment Proof Generation">
    The payment receipt is converted to a zkTLS proof via an attestation service, which creates an EIP-712 signed attestation.
  </Step>

  <Step title="On-Chain Verification">
    The Unified Payment Verifier validates the attestation signatures and payment details against the intent parameters.
  </Step>

  <Step title="Settlement">
    Upon successful verification, USDC is released to the taker, fees are distributed, and liquidity is returned to the maker.
  </Step>
</Steps>

## Protocol Security

ZKP2P incorporates multiple security mechanisms:

* **Reentrancy Guards**: All critical functions use OpenZeppelin's `ReentrancyGuard`
* **Pausable Emergency Stop**: Governance can pause intent creation and fulfillment while preserving fund recovery
* **Double-Spend Prevention**: Nullifier registry prevents payment proofs from being used multiple times
* **Intent Expiration**: Time-limited intents with configurable expiry periods prevent indefinite liquidity locks
* **Signature Verification**: EIP-712 typed data signatures for intent gating and attestation validation
* **Whitelisted Registries**: Controlled access for escrows, verifiers, and post-intent hooks

<Warning>
  All smart contracts have been audited, but users should always verify contract addresses and understand the risks before interacting with the protocol.
</Warning>

## Supported Networks

ZKP2P is deployed across multiple networks:

| Network          | Status       | Description                                                |
| ---------------- | ------------ | ---------------------------------------------------------- |
| **Base**         | ✅ Production | Live mainnet deployment for production use                 |
| **Base Sepolia** | ✅ Testnet    | Public testnet for development and testing                 |
| **Base Staging** | 🔧 Staging   | Internal staging environment for pre-production validation |

<Note>
  Contract addresses for each network can be found in the respective deployment directories in the GitHub repository.
</Note>

## Architecture Overview

The v2.1 architecture consists of several interconnected components:

```mermaid theme={null}
graph TB
    Maker[Maker/Liquidity Provider]
    Taker[Taker/Buyer]
    Escrow[Escrow Contract]
    Orchestrator[Orchestrator Contract]
    Verifier[Unified Payment Verifier]
    Registry[Registry System]
    
    Maker -->|createDeposit| Escrow
    Taker -->|signalIntent| Orchestrator
    Orchestrator -->|lockFunds| Escrow
    Orchestrator -->|verifyPayment| Verifier
    Verifier -->|checkRegistry| Registry
    Orchestrator -->|unlockAndTransfer| Escrow
```

Each component serves a specific purpose:

* **Escrow**: Secure fund custody and liquidity management
* **Orchestrator**: Intent lifecycle coordination and fee distribution
* **Unified Payment Verifier**: Multi-platform payment validation
* **Registry System**: Permission management and configuration

For a detailed explanation of the architecture, see the [Architecture](/architecture) page.

## Token Support

Currently, ZKP2P v2.1 supports:

* **USDC** (USD Coin) as the primary settlement token
* Multiple fiat currencies through payment platform verification
* Configurable conversion rates for fiat-to-crypto exchanges

<Info>
  The modular design allows for future expansion to support additional ERC20 tokens as deposit assets.
</Info>

## Getting Started

Ready to integrate with ZKP2P? Check out these resources:

<CardGroup cols={2}>
  <Card title="Quickstart Guide" icon="rocket" href="/quickstart">
    Get up and running with local development in minutes
  </Card>

  <Card title="Architecture Deep Dive" icon="sitemap" href="/architecture">
    Understand the complete system design and component interactions
  </Card>

  <Card title="API Reference" icon="code" href="/contracts/escrow">
    Explore contract interfaces and function signatures
  </Card>

  <Card title="GitHub Repository" icon="github" href="https://github.com/zkp2p/zkp2p-v2-contracts">
    View the source code and contribute to the protocol
  </Card>
</CardGroup>

## Community & Support

* **Website**: [zkp2p.xyz](https://zkp2p.xyz)
* **Documentation**: [docs.zkp2p.xyz](https://docs.zkp2p.xyz)
* **GitHub**: [github.com/zkp2p](https://github.com/zkp2p)

<Note>
  ZKP2P is an open-source project licensed under MIT. Contributions are welcome!
</Note>
