Skip to content

About

This project takes "Atomic IP" to a much deeper level by adding Zero-Knowledge verification to the sales process. You aren't just selling a file; you are providing "proof of quality" without "loss of secrecy."

Resources

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

Atomic IP Marketplace

CI

Soroban smart contracts for atomic IP swaps using USDC, IP registry, and ZK verification.

Overview

  • atomic_swap: Atomic swaps with USDC payments, pause functionality, buyer/seller indexing. Double-initialization is guarded with assert! — a second initialize call panics with Error(Contract, #6).
  • ip_registry: Register and query IP assets with TTL. Version history is stored per-version and retrieved through paginated reads — see docs/architecture.md. update_listing, transfer_listing_ownership, create_version, and deregister_listing unconditionally reject while a swap is pending, checked against a single admin-configured atomic_swap address — never a caller-supplied one — see Pending-Swap Guard on Listing Mutations.
  • zk_verifier: Merkle tree ZK proof verification with TTL.

Governance vs. admin trust

  • Fee changes are on-chain governed: fee_bps, fee_recipient, and cancel_delay_secs can only change via propose_fee_update → approve_fee_update → execute_fee_update. Execution requires >= required_approvals distinct require_auth() approvals from the configured governance signer set (set_governance_config), plus a minimum on-chain timelock after quorum is reached. The admin key alone cannot redirect protocol fees.
  • Everything else admin-gated is still a single-key operation: pause/unpause, dispute windows, escrow hold config, allowed tokens, admin transfer, the swap MultiSigConfig threshold, and ip_registry's set_atomic_swap are all set with a plain admin.require_auth() call — whoever holds the admin key controls them directly, with no on-chain quorum or timelock.

See contracts/ for sources and docs/architecture.md for sequence diagrams.

Getting Started

Prerequisites

  • Rust (stable, with wasm32v1-none target)
    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
    rustup target add wasm32v1-none
  • Stellar CLI — used to build, optimize, and deploy contracts
    cargo install --locked stellar-cli --features opt
  • Node.js v18+ and npm — required for the frontend
    # via nvm (recommended)
    nvm install 18

Clone and configure

git clone https://github.com/unixfundz/Atomic-IP-Marketplace.git
cd Atomic-IP-Marketplace
cp .env.example .env

.env.example walkthrough

Variable Description
STELLAR_NETWORK testnet or mainnet
STELLAR_RPC_URL Soroban RPC endpoint (default: testnet)
CONTRACT_ATOMIC_SWAP Deployed atomic_swap contract ID (filled after deploy)
CONTRACT_IP_REGISTRY Deployed ip_registry contract ID
CONTRACT_ZK_VERIFIER Deployed zk_verifier contract ID
VITE_* Frontend copies of the above for Vite
ATOMIC_SWAP_ADMIN Admin address for contract initialization
ATOMIC_SWAP_FEE_RECIPIENT Address that receives protocol fees
ATOMIC_SWAP_FEE_BPS Fee in basis points (e.g. 250 = 2.5%). See Fee & Royalty Bounds for how this interacts with a listing's royalty_bps.
ATOMIC_SWAP_CANCEL_DELAY_SECS Seconds before a buyer can cancel (e.g. 3600)

Build contracts

# Build and optimize all contracts
./scripts/build.sh

# Build a single contract
./scripts/build.sh atomic_swap
# Available: ip_registry, atomic_swap, zk_verifier

Run tests

./scripts/test.sh

This runs cargo test --locked --workspace across all three contracts.

Local testnet setup

  1. Start a local Stellar network (requires Docker):
    stellar network start local
  2. Add a funded account:
    stellar keys generate deployer --network local
    stellar keys fund deployer --network local
  3. Set STELLAR_NETWORK=local and STELLAR_RPC_URL=http://localhost:8000/soroban/rpc in .env.
  4. Deploy:
    ./scripts/deploy_testnet.sh

Frontend

cd frontend
cp .env.example .env   # fill in VITE_CONTRACT_* after deploy
npm install
npm run dev

Build & Test

Build all contracts:

./scripts/build.sh

Run tests:

./scripts/test.sh

Deploy (Testnet)

./scripts/deploy_testnet.sh

Security

Please report vulnerabilities privately — do not open public issues for security bugs. See SECURITY.md for the full responsible disclosure policy, including the private email contact and any available GitHub advisory channel.

License

This project is licensed under the Apache License 2.0. See the LICENSE file for details.


Workspace using pinned Soroban SDK v25.3.0 and soroban-poseidon v25.0.1

About

This project takes "Atomic IP" to a much deeper level by adding Zero-Knowledge verification to the sales process. You aren't just selling a file; you are providing "proof of quality" without "loss of secrecy."

Resources

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages