Skip to content

Anuj-kumar-in/Cash.io

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

22 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Cash.io - Multi-Chain ZK-Privacy dApp

Important

Active Integration Phase: Cash.io is currently in its frontend integration phase. Some features, particularly those involving cross-chain bridging and real-time proof generation, may be experimental or non-functional in the current build as we synchronize our agents, relayers, and frontend components.

πŸ—οΈ Architecture Overview

POA Cash.io is a cutting-edge decentralized application that provides zero-fee, privacy-preserving cross-chain transactions across Ethereum, Solana, and Bitcoin (via Rootstock) networks, all rolled up on an Avalanche Subnet-EVM hub chain.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                              CASH.IO ARCHITECTURE                            β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”‚
β”‚  β”‚  Ethereum   β”‚   β”‚   Solana    β”‚   β”‚  Rootstock  β”‚   β”‚   Bitcoin   β”‚      β”‚
β”‚  β”‚   Bridge    β”‚   β”‚   Bridge    β”‚   β”‚   Bridge    β”‚   β”‚   (via RSK) β”‚      β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜      β”‚
β”‚         β”‚                 β”‚                 β”‚                 β”‚              β”‚
β”‚         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜              β”‚
β”‚                          β”‚                                                   β”‚
β”‚                    β”Œβ”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”                                            β”‚
β”‚                    β”‚  Relayer  β”‚  ← Cross-chain event watchers              β”‚
β”‚                    β”‚  Network  β”‚                                            β”‚
β”‚                    β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜                                            β”‚
β”‚                          β”‚                                                   β”‚
β”‚         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                                 β”‚
β”‚         β”‚                                 β”‚                                 β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”                  β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”                          β”‚
β”‚  β”‚    ZK       β”‚                  β”‚  Blob       β”‚                          β”‚
β”‚  β”‚  Prover     β”‚                  β”‚  Storage    β”‚                          β”‚
β”‚  β”‚  Network    β”‚                  β”‚  (Sharded)  β”‚                          β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜                  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜                          β”‚
β”‚         β”‚                                 β”‚                                 β”‚
β”‚         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                 β”‚
β”‚                          β”‚                                                   β”‚
β”‚              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                                     β”‚
β”‚              β”‚   AVALANCHE SUBNET     β”‚                                     β”‚
β”‚              β”‚   (EVM-Compatible)     β”‚                                     β”‚
β”‚              β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€                                     β”‚
β”‚              β”‚ β€’ ZK Verifier Precompileβ”‚                                    β”‚
β”‚              β”‚ β€’ Shielded Pool Contractβ”‚                                    β”‚
β”‚              β”‚ β€’ Bridge Contracts     β”‚                                     β”‚
β”‚              β”‚ β€’ ERC-4337 EntryPoint  β”‚                                     β”‚
β”‚              β”‚ β€’ Paymaster (Zero-Fee) β”‚                                     β”‚
β”‚              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                     β”‚
β”‚                          β”‚                                                   β”‚
β”‚              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                                     β”‚
β”‚              β”‚   LANGGRAPH.JS AGENTS  β”‚                                     β”‚
β”‚              β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€                                     β”‚
β”‚              β”‚ β€’ Intent Parser        β”‚                                     β”‚
β”‚              β”‚ β€’ Proof Coordinator    β”‚                                     β”‚
β”‚              β”‚ β€’ TX Submitter         β”‚                                     β”‚
β”‚              β”‚ β€’ Health Monitor       β”‚                                     β”‚
β”‚              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                     β”‚
β”‚                                                                              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

🎯 Key Features

1. Multi-Chain Support

  • Ethereum - Direct bridge with Merkle proof verification
  • Solana - Cross-chain messaging with SPL token support
  • Bitcoin - Via Rootstock (RSK) EVM-compatible sidechain
  • Rollup Aggregation - All transactions rolled up on Avalanche Subnet

2. Privacy (ZK Proofs)

  • Shielded Pool Model - Notes + Nullifiers system
  • ZK-SNARKs - Groth16 proofs for transaction privacy
  • Commitment Tree - Merkle tree for balance tracking
  • Batch Proving - Validity rollup style batching

3. Zero-Fee UX (Account Abstraction)

  • ERC-4337 Integration - Full Account Abstraction support
  • Paymaster - Gas sponsorship for users
  • Bundler - UserOperation batching and submission
  • Smart Accounts - Social recovery, spending limits

4. AI Agents (LangGraph.js)

  • Intent Parser Agent - Natural language to transaction
  • Proof Coordinator Agent - ZK proof generation workflow
  • TX Submitter Agent - AA bundler interaction
  • Health Monitor Agent - Cross-chain health checks

5. Blob Storage & Sharding

  • Data Availability - Encrypted transaction data storage
  • Content-Addressed - IPFS/Arweave integration
  • Sharded Retrieval - Efficient proof input serving
  • Indexing Layer - Commitment tree reconstruction

6. IPFS Storage (Decentralized)

  • Recovery Key Backup - Encrypted recovery keys stored on IPFS
  • Pinata Integration - Reliable IPFS pinning service
  • Password Encryption - AES-GCM-256 encryption for sensitive data
  • Gateway Fallback - Multiple IPFS gateway support

πŸ“ Project Structure

Cash.io/
β”œβ”€β”€ packages/
β”‚   β”œβ”€β”€ subnet-evm/              # Avalanche Subnet with custom precompiles
β”‚   β”‚   β”œβ”€β”€ precompiles/         # Go precompile implementations
β”‚   β”‚   β”‚   β”œβ”€β”€ zkverifier/      # ZK proof verification precompile
β”‚   β”‚   β”‚   └── cryptoops/       # Elliptic curve operations
β”‚   β”‚   └── genesis/             # Subnet genesis configuration
β”‚   β”‚
β”‚   β”œβ”€β”€ contracts/               # Solidity smart contracts
β”‚   β”‚   β”œβ”€β”€ core/                # Core protocol contracts
β”‚   β”‚   β”‚   β”œβ”€β”€ ShieldedPool.sol # Privacy pool (notes/nullifiers)
β”‚   β”‚   β”‚   β”œβ”€β”€ CommitmentTree.sol
β”‚   β”‚   β”‚   └── ZKVerifier.sol
β”‚   β”‚   β”œβ”€β”€ bridges/             # Cross-chain bridge contracts
β”‚   β”‚   β”‚   β”œβ”€β”€ EthBridge.sol
β”‚   β”‚   β”‚   β”œβ”€β”€ SolanaBridge.sol
β”‚   β”‚   β”‚   └── RootstockBridge.sol
β”‚   β”‚   β”œβ”€β”€ aa/                  # Account Abstraction
β”‚   β”‚   β”‚   β”œβ”€β”€ CashAccount.sol  # Smart account
β”‚   β”‚   β”‚   β”œβ”€β”€ CashPaymaster.sol
β”‚   β”‚   β”‚   └── CashAccountFactory.sol
β”‚   β”‚   └── rollup/              # Rollup components
β”‚   β”‚       β”œβ”€β”€ BatchSubmitter.sol
β”‚   β”‚       └── StateManager.sol
β”‚   β”‚
β”‚   β”œβ”€β”€ circuits/                # ZK circuits (Circom)
β”‚   β”‚   β”œβ”€β”€ transfer.circom      # Private transfer circuit
β”‚   β”‚   β”œβ”€β”€ deposit.circom       # Shield deposit circuit
β”‚   β”‚   β”œβ”€β”€ withdraw.circom      # Unshield withdraw circuit
β”‚   β”‚   └── batch.circom         # Batch proof aggregation
β”‚   β”‚
β”‚   β”œβ”€β”€ relayer/                 # Cross-chain relayer service
β”‚   β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”‚   β”œβ”€β”€ watchers/        # Chain-specific event watchers
β”‚   β”‚   β”‚   β”œβ”€β”€ provers/         # Proof generation
β”‚   β”‚   β”‚   └── submitters/      # Transaction submission
β”‚   β”‚   └── package.json
β”‚   β”‚
β”‚   β”œβ”€β”€ agents/                  # LangGraph.js AI agents
β”‚   β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”‚   β”œβ”€β”€ graphs/          # Agent workflow graphs
β”‚   β”‚   β”‚   β”œβ”€β”€ nodes/           # Agent action nodes
β”‚   β”‚   β”‚   β”œβ”€β”€ tools/           # Agent tools
β”‚   β”‚   β”‚   └── state/           # Shared agent state
β”‚   β”‚   └── package.json
β”‚   β”‚
β”‚   β”œβ”€β”€ blob-storage/            # Blob storage service
β”‚   β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”‚   β”œβ”€β”€ storage/         # Storage backends
β”‚   β”‚   β”‚   β”œβ”€β”€ sharding/        # Data sharding logic
β”‚   β”‚   β”‚   └── indexer/         # Commitment tree indexer
β”‚   β”‚   └── package.json
β”‚   β”‚
β”‚   └── sdk/                     # TypeScript SDK
β”‚       β”œβ”€β”€ src/
β”‚       β”‚   β”œβ”€β”€ client/          # Main SDK client
β”‚       β”‚   β”œβ”€β”€ aa/              # Account abstraction helpers
β”‚       β”‚   β”œβ”€β”€ zk/              # ZK proof generation
β”‚       β”‚   β”œβ”€β”€ bridges/         # Bridge interaction
β”‚       β”‚   └── ipfs/            # IPFS storage integration
β”‚       └── package.json
β”‚
β”œβ”€β”€ apps/
β”‚   └── web/                     # Web application
β”‚       β”œβ”€β”€ src/
β”‚       β”‚   β”œβ”€β”€ components/
β”‚       β”‚   β”œβ”€β”€ pages/
β”‚       β”‚   └── hooks/
β”‚       └── package.json
β”‚
β”œβ”€β”€ docker/                      # Docker configurations
β”œβ”€β”€ scripts/                     # Deployment scripts
└── docs/                        # Documentation

πŸš€ Quick Start

# Clone the repository
git clone https://github.com/your-org/cash-io.git
cd cash-io

# Install dependencies
npm install

# Build all packages
npm run build

# Start local development
npm run dev

🌐 IPFS Integration

The SDK provides built-in IPFS support for decentralized storage of recovery keys and other data.

Environment Variables

Add the following to your .env file (or .env.local for frontend):

# Frontend (Vite) - use VITE_ prefix
VITE_IPFS_GATEWAY_URL=https://gateway.pinata.cloud
VITE_IPFS_API_URL=https://api.pinata.cloud
VITE_IPFS_JWT=your-pinata-jwt-token

# Backend/Node.js
IPFS_GATEWAY_URL=https://gateway.pinata.cloud
IPFS_API_URL=https://api.pinata.cloud
IPFS_JWT=your-pinata-jwt-token

Usage in Frontend

import { 
  CashioClient, 
  IPFSClient, 
  ipfsClient,
  RecoveryKeyUtils 
} from '@cash-io/sdk';

// Option 1: Create IPFS client from environment variables
const ipfs = ipfsClient('VITE_');

// Option 2: Use through CashioClient
const cashio = new CashioClient({
  // ... other config
  ipfs: {
    gatewayUrl: import.meta.env.VITE_IPFS_GATEWAY_URL,
    jwt: import.meta.env.VITE_IPFS_JWT,
  },
});

// Upload recovery key (encrypted with password)
const result = await cashio.uploadRecoveryKey(
  'your-recovery-key-data',
  'user-password',
  { userId: 'user-123' } // optional metadata
);
console.log('Recovery key stored at:', result.cid);

// Retrieve and decrypt recovery key
const recoveryKey = await cashio.retrieveRecoveryKey(result.cid, 'user-password');

// Upload arbitrary JSON data
const jsonResult = await cashio.uploadJSONToIPFS({
  type: 'wallet-backup',
  data: { /* ... */ }
});
console.log('JSON stored at:', jsonResult.ipfsUri);

Direct IPFS Client Usage

import { IPFSClient, RecoveryKeyUtils } from '@cash-io/sdk';

const ipfs = new IPFSClient({
  gatewayUrl: 'https://gateway.pinata.cloud',
  jwt: 'your-pinata-jwt',
});

// Upload raw data
const result = await ipfs.upload('Hello IPFS!', { name: 'hello.txt' });

// Upload JSON
const jsonResult = await ipfs.uploadJSON({ foo: 'bar' });

// Retrieve data
const data = await ipfs.retrieve(result.cid);
console.log(data.text); // "Hello IPFS!"

// Encrypt and upload recovery key
const encryptedData = await RecoveryKeyUtils.encrypt('secret-key', 'password');
const recoveryResult = await ipfs.uploadRecoveryKey(encryptedData);

// Retrieve and decrypt
const recoveryData = await ipfs.retrieveRecoveryKey(recoveryResult.cid);
const secret = await RecoveryKeyUtils.decrypt(recoveryData, 'password');

πŸ“š Documentation

πŸ” Security

This project is in active development. Do not use in production without thorough security audits.

πŸ“„ License

MIT License - see LICENSE for details.

About

Seamless decentralizd Payment system

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors