Skip to content

sip-protocol/sip-protocol

Repository files navigation

β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—
β–ˆβ–ˆβ•”β•β•β•β•β• β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—
β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•
β•šβ•β•β•β•β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β•β•β•β•
β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘
β•šβ•β•β•β•β•β•β• β•šβ•β• β•šβ•β•

Shielded Intents Protocol

Privacy is not a feature. It's a right.

The privacy layer for cross-chain transactions via NEAR Intents + Zcash

One toggle to shield them all β€’ Stealth addresses β€’ Zero-knowledge proofs β€’ Selective disclosure β€’ Multi-chain support

License: MIT TypeScript Next.js NEAR Zcash pnpm PRs Welcome


Table of Contents


πŸ›‘οΈ What is SIP?

SIP (Shielded Intents Protocol) brings HTTPS-level privacy to cross-chain transactions. Just as HTTPS encrypted the web without changing how users browse, SIP adds privacy to blockchain intents without changing how users swap.

HTTP    β†’ HTTPS   (Web privacy upgrade)
Intents β†’ SIP     (Blockchain privacy upgrade)

Stop exposing your financial activity. Start swapping privately.


πŸŽ₯ Quick Preview

The Privacy Upgrade

❌ Public Intent (Everyone sees everything) βœ… Shielded Intent (Solvers see only what they need)
{
  from: "0x1234...",
  inputAmount: 10,
  inputToken: "SOL",
  outputToken: "ETH",
  recipient: "0x5678..."
}

Exposed:

  • πŸ”΄ Your wallet address
  • πŸ”΄ Exact amounts
  • πŸ”΄ Recipient address
  • πŸ”΄ Full transaction history
{
  intentId: "abc123",
  outputToken: "ETH",
  minOutput: 0.004,
  inputCommitment: "0xabc...",
  recipientStealth: "0xdef...",
  proof: "0x123..."
}

Protected:

  • βœ… Sender hidden (commitment)
  • βœ… Amount hidden (ZK proof)
  • βœ… Recipient hidden (stealth address)
  • βœ… Unlinkable transactions

Result: Solvers can fulfill your intent without knowing who you are or where the funds are going.


🎯 The Problem

Current cross-chain solutions expose everything about your transactions. This isn't just inconvenient β€” it's a security risk.

What's Exposed

Data Point Visibility Risk
Sender Address Public Targeted phishing, social engineering
Transaction Amount Public Front-running, MEV extraction
Recipient Address Public Surveillance, address clustering
Transaction History Permanent Financial profiling, discrimination

Real-World Consequences

Attack Vector How It Works Impact
Front-Running Bots see your pending swap, execute first You get worse price
MEV Extraction Validators reorder txs to profit Value extracted from you
Phishing Attackers identify high-value wallets Direct theft attempts
Surveillance Exchanges/govts track all activity Privacy violation
Price Discrimination Services see your balance Higher fees for wealthy users

The blockchain is a public ledger. Without privacy, it's a surveillance system.


πŸ’‘ The Solution

SIP wraps cross-chain intents in a cryptographic privacy layer using battle-tested technology from Zcash and cutting-edge stealth address schemes.

How It Works

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                          USER                                    β”‚
β”‚                            β”‚                                     β”‚
β”‚                            β–Ό                                     β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚                      SIP SDK                             β”‚    β”‚
β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚    β”‚
β”‚  β”‚  β”‚ Privacy     β”‚ β”‚ Stealth     β”‚ β”‚ ZK Proof        β”‚    β”‚    β”‚
β”‚  β”‚  β”‚ Toggle      β”‚ β”‚ Address Gen β”‚ β”‚ Generation      β”‚    β”‚    β”‚
β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β”‚                            β”‚                                     β”‚
β”‚                            β–Ό                                     β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚              SHIELDED INTENT LAYER                       β”‚    β”‚
β”‚  β”‚  β€’ Pedersen commitments (hide amounts)                   β”‚    β”‚
β”‚  β”‚  β€’ Stealth addresses (hide recipients)                   β”‚    β”‚
β”‚  β”‚  β€’ ZK proofs (prove validity without revealing data)     β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β”‚                            β”‚                                     β”‚
β”‚                            β–Ό                                     β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚                 NEAR INTENTS ROUTER                      β”‚    β”‚
β”‚  β”‚  β€’ Intent matching                                       β”‚    β”‚
β”‚  β”‚  β€’ Solver network                                        β”‚    β”‚
β”‚  β”‚  β€’ Cross-chain execution                                 β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β”‚                            β”‚                                     β”‚
β”‚            β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                    β”‚
β”‚            β–Ό               β–Ό               β–Ό                    β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”            β”‚
β”‚  β”‚    Solana    β”‚ β”‚    Zcash     β”‚ β”‚   Ethereum   β”‚            β”‚
β”‚  β”‚              β”‚ β”‚  (Privacy    β”‚ β”‚              β”‚            β”‚
β”‚  β”‚              β”‚ β”‚   Backbone)  β”‚ β”‚              β”‚            β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Core Mechanisms

Mechanism Purpose Technology
Pedersen Commitments Hide transaction amounts value * G + blinding * H
Stealth Addresses One-time recipient addresses EIP-5564 style, secp256k1
ZK Proofs Prove validity without revealing data Zcash proving system
Viewing Keys Selective disclosure for compliance Derived key pairs

✨ Key Features

πŸ”’ One-Click Privacy

Toggle between public and shielded modes with a single switch. No complex setup, no key management headaches.

🌐 Multi-Chain Support

Works across Solana, Ethereum, NEAR, and more. Privacy shouldn't be chain-specific.

πŸ“Š Three Privacy Levels

Level Description Use Case
TRANSPARENT Standard public transaction When privacy isn't needed
SHIELDED Full privacy via Zcash pool Personal transactions
COMPLIANT Privacy + viewing key Institutional/regulatory

πŸ‘» Stealth Addresses

Every transaction uses a fresh one-time address. No address reuse, no transaction linkability.

πŸ”‘ Viewing Keys

Selective disclosure for audits and compliance. Prove your transaction history without exposing it to everyone.

πŸ›‘οΈ MEV Protection

Hidden amounts and recipients mean front-runners can't extract value from your trades.

⚑ Zero UX Friction

Same swap interface you're used to. Privacy happens under the hood.


πŸ“¦ Installation

# npm
npm install @sip-protocol/sdk

# pnpm
pnpm add @sip-protocol/sdk

# yarn
yarn add @sip-protocol/sdk

πŸš€ Quick Start

1. Initialize the SDK

import { SIP, PrivacyLevel } from '@sip-protocol/sdk';

const sip = new SIP({
  network: 'mainnet', // or 'testnet'
});

2. Create a Shielded Intent

const intent = await sip.createIntent({
  input: {
    chain: 'solana',
    token: 'SOL',
    amount: 10,
  },
  output: {
    chain: 'ethereum',
    token: 'ETH',
  },
  privacy: PrivacyLevel.SHIELDED,
});

3. Get Quotes & Execute

// Solvers compete to fill your intent
const quotes = await intent.getQuotes();

// Execute with the best quote
const result = await intent.execute(quotes[0]);

console.log(result.status);  // 'fulfilled'
console.log(result.txHash);  // null (shielded!)
console.log(result.proof);   // ZK proof of execution

4. Choose Your Privacy Level

// Public mode (standard intent, no privacy)
privacy: PrivacyLevel.TRANSPARENT

// Full privacy (via Zcash shielded pool)
privacy: PrivacyLevel.SHIELDED

// Privacy + audit capability (for institutions)
privacy: PrivacyLevel.COMPLIANT,
viewingKey: generateViewingKey()

πŸ—οΈ Architecture

Component Overview

sip-protocol/
β”œβ”€β”€ apps/
β”‚   └── demo/                 # Next.js demo application
β”‚       β”œβ”€β”€ src/app/          # App router pages
β”‚       └── src/components/   # UI components
β”œβ”€β”€ packages/
β”‚   β”œβ”€β”€ sdk/                  # @sip-protocol/sdk
β”‚   β”‚   β”œβ”€β”€ src/stealth.ts    # Stealth address generation
β”‚   β”‚   β”œβ”€β”€ src/intent.ts     # Intent builder
β”‚   β”‚   β”œβ”€β”€ src/privacy.ts    # Viewing key management
β”‚   β”‚   β”œβ”€β”€ src/crypto.ts     # Pedersen commitments
β”‚   β”‚   └── src/sip.ts        # Main client class
β”‚   └── types/                # @sip-protocol/types
β”‚       β”œβ”€β”€ src/intent.ts     # ShieldedIntent interface
β”‚       β”œβ”€β”€ src/privacy.ts    # PrivacyLevel enum
β”‚       └── src/stealth.ts    # Stealth address types
└── docs/                     # Documentation

Data Flow

User Input β†’ Privacy Layer β†’ Intent Creation β†’ Solver Network β†’ Execution
     β”‚              β”‚              β”‚                 β”‚             β”‚
     β”‚              β–Ό              β”‚                 β”‚             β”‚
     β”‚       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”‚                 β”‚             β”‚
     β”‚       β”‚ Generate β”‚         β”‚                 β”‚             β”‚
     β”‚       β”‚ Stealth  β”‚         β”‚                 β”‚             β”‚
     β”‚       β”‚ Address  β”‚         β”‚                 β”‚             β”‚
     β”‚       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β”‚                 β”‚             β”‚
     β”‚              β”‚              β”‚                 β”‚             β”‚
     β”‚              β–Ό              β”‚                 β”‚             β”‚
     β”‚       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”‚                 β”‚             β”‚
     β”‚       β”‚ Create   β”‚         β”‚                 β”‚             β”‚
     β”‚       β”‚ Pedersen β”‚         β”‚                 β”‚             β”‚
     β”‚       β”‚Commitmentβ”‚         β”‚                 β”‚             β”‚
     β”‚       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β”‚                 β”‚             β”‚
     β”‚              β”‚              β”‚                 β”‚             β”‚
     β”‚              β–Ό              β”‚                 β”‚             β”‚
     β”‚       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”‚                 β”‚             β”‚
     β”‚       β”‚ Generate β”‚         β”‚                 β”‚             β”‚
     β”‚       β”‚ ZK Proof β”‚         β”‚                 β”‚             β”‚
     β”‚       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β”‚                 β”‚             β”‚
     β”‚              β”‚              β”‚                 β”‚             β”‚
     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“š Packages

Package Description Status
@sip-protocol/sdk Core SDK for creating shielded intents βœ… Active
@sip-protocol/types TypeScript type definitions βœ… Active
apps/demo Reference implementation and demo app βœ… Active

πŸ—ΊοΈ Roadmap

Phase 1: Foundation βœ… Complete

  • βœ… Core type definitions (ShieldedIntent, PrivacyLevel, StealthAddress)
  • βœ… SDK architecture (SIP client, IntentBuilder)
  • βœ… Stealth address generation (secp256k1, EIP-5564 style)
  • βœ… Pedersen commitment implementation
  • βœ… Demo application with comparison view
  • βœ… Monorepo setup (pnpm + Turborepo)

Phase 2: Core Protocol πŸ”„ In Progress

  • βœ… Zcash testnet RPC client
  • βœ… Shielded transaction support
  • βœ… Solver interface design
  • ⏳ NEAR 1Click API integration
  • ⏳ End-to-end shielded flow
  • ⏳ Mock ZK proof generation

Phase 3: Integration πŸ“‹ Planned

  • Real ZK proof generation
  • Solver network integration
  • Multi-chain execution
  • Viewing key verification
  • Transaction status tracking

Phase 4: Production πŸš€ Future

  • Security audit
  • Mainnet deployment
  • SDK v1.0 release
  • Documentation site
  • Additional chain support

πŸ› οΈ Tech Stack

Category Technology Purpose
Framework Next.js 14 (App Router) Demo application
Language TypeScript (strict mode) Type safety
Styling Tailwind CSS + shadcn/ui UI components
State Zustand Client state management
Monorepo pnpm + Turborepo Package management
Cryptography @noble/curves, @noble/hashes Stealth addresses, commitments
Deployment Vercel Hosting

πŸ’» Development

Prerequisites

  • Node.js 18+
  • pnpm 8+

Setup

# Clone the repository
git clone https://github.com/RECTOR-LABS/sip-protocol.git
cd sip-protocol

# Install dependencies
pnpm install

# Start development
pnpm dev

Commands

pnpm dev        # Start development server (port 3000)
pnpm build      # Build all packages
pnpm lint       # Lint code
pnpm typecheck  # Type check

🀝 Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines.

Areas for Contribution

  • Protocol improvements
  • SDK features
  • Documentation
  • Security audits
  • Chain integrations

πŸ” Security

SIP is experimental software. Use at your own risk.

Zcash RPC Security

CRITICAL: Always use HTTPS/TLS when connecting to Zcash nodes in production.

The Zcash RPC client uses HTTP Basic Authentication, which transmits credentials in base64-encoded cleartext. Without TLS/HTTPS:

  • RPC credentials are vulnerable to network sniffing
  • All transaction data can be intercepted
  • Man-in-the-middle attacks are possible

Production Requirements:

  • βœ… Use https:// URLs for Zcash RPC endpoints
  • βœ… Configure zcashd with valid TLS certificates
  • βœ… Store credentials in secure environment variables
  • βœ… Use network-level access controls (firewall rules, VPCs)
  • ❌ NEVER use HTTP in production
  • ❌ NEVER hardcode credentials in source code

Example:

// βœ… Production (HTTPS)
const client = new ZcashRPCClient({
  host: 'https://your-node.com',
  port: 8232,
  username: process.env.ZCASH_RPC_USER,
  password: process.env.ZCASH_RPC_PASS,
})

// ⚠️ Development only (HTTP on localhost)
const testClient = new ZcashRPCClient({
  host: '127.0.0.1',
  port: 18232,
  username: 'test',
  password: 'test',
  testnet: true,
})

Reporting Security Issues

If you discover a security vulnerability, please report it responsibly:


πŸ“„ License

MIT License β€” see LICENSE file for details.


πŸ™ Acknowledgments

SIP builds on the shoulders of giants:

  • Zcash β€” Privacy-preserving cryptocurrency and proving system
  • NEAR Protocol β€” Intent-centric blockchain infrastructure
  • EIP-5564 β€” Stealth address standard
  • @noble/curves β€” Audited cryptographic primitives
  • The broader privacy and cryptography research community

Built for the NEAR AI Intents Hackathon

Privacy is not a feature. It's a right.

Documentation Β· Demo Β· Report Bug