Privacy-First Portfolio Sharing on Solana
FlexAnon enables users to share their DeFi portfolio with cryptographic proof while maintaining privacy. Built on Solana powered by Zerion.
- Description
- Key Features
- Architecture
- Technical Stack
- Getting Started
- API Documentation
- Smart Contract
- How It Works
- Use Cases
- Roadmap
- Contributing
- License
FlexAnon provides Data disclosure with cryptographic proof:
- Prove authenticity with on-chain commitments on Solana
- Maintain privacy by never exposing your wallet address
- Generate verifiable share links powered by Merkle proofs
- Data disclosure using Merkle trees
- Wallet address remains hidden
- On-chain commitments via relayer
- User wallet never directly touches the blockchain
- Cryptographic proofs stored on Solana
- Tamper-proof commitment hashing
- Version tracking for portfolio updates
- Public verification of shared data
- RESTful API for portfolio data
- Real-time updates via Zerion API
- Support for 35+ blockchain networks
- Comprehensive documentation
- Shareable links
- Real-time balance charts and analytics
FlexAnon uses a hybrid architecture combining on-chain security with off-chain performance:
Frontend: NextJS application with Solana Web3.js integration Backend: Express.js API server with Zerion integration Solana Program: Anchor solana programs for commitment storage Database: PostgreSQL (Supabase) for share links and metadata Relayer: Rent abstraction layer for privacy
- Solana: On-chain commitment storage
- Anchor Framework: Smart contract development
- Phantom Wallet: User authentication
- Node.js: Runtime environment
- Express.js: API framework
- TypeScript: Type safety
- PostgreSQL: Database (Supabase)
- Zerion API: Real-time portfolio data
- Portfolio balances
- Historical charts
- Asset positions across 35+ chains
- React: User interface
- TypeScript: Type safety
- Tailwind CSS: Styling
- Merkle Trees: Privacy-preserving proofs
- SHA-256: Hashing algorithm
- Ed25519: Wallet signatures
Node.js >= 18.x
pnpm >= 8.x
Solana CLI >= 1.18.x
Anchor CLI >= 0.30.x
PostgreSQL >= 14.xCreate .env files in both frontend and backend directories:
Backend .env:
# Database
DATABASE_URL=postgresql://user:password@host:5432/flexanon
# Solana
SOLANA_RPC_URL=https://api.devnet.solana.com
SOLANA_NETWORK=devnet
SOLANA_PROGRAM_ID=PROGRAM_ID
# Relayer (base58 encoded private key)
RELAYER_PRIVATE_KEY=your_base58_private_key
# Zerion API
ZERION_API_KEY=your_zerion_api_key
# Server
PORT=3001
NODE_ENV=productionFrontend .env:
NEXT_PUBLIC_API_URL=https://your-backend-url.vercel.app
NEXT_PUBLIC_SOLANA_NETWORK=devnet
NEXT_PUBLIC_SOLANA_PROGRAM_ID=PROGRAM_IDgit clone https://github.com/deepakA18/Flexanon.git
cd Flexanon# Backend
cd backend
pnpm install
# Frontend
cd ../frontend
pnpm install
# Solana Program
cd ../solana-programs
pnpm installcd solana-programs
anchor build
anchor deploycd ../backend
pnpm run db:setupBackend:
cd backend
pnpm devFrontend:
cd frontend
pnpm startProduction: https://flexanon-delta.vercel.app/api
Development: http://localhost:3001/api
Get Portfolio Summary
POST /dev/test-zerion
Content-Type: application/json
{
"wallet_address": "WALLET_ADDRESS"
}Get Balance Chart
GET /dev/wallet-chart/:wallet_address?period=dayParameters:
period:day|week|month|year
Get Asset Positions
GET /dev/wallet-positions/:wallet_address?chain=solanaGenerate Share Link
POST /share/generate
Content-Type: application/json
{
"wallet_address": "string",
"commitment_address": "string",
"commitment_version": number,
"chain": "solana",
"reveal_preferences": {
"show_total_value": boolean,
"show_pnl": boolean,
"show_top_assets": boolean,
"top_assets_count": number,
"show_wallet_address": boolean
}
}View Shared Portfolio
GET /share/:token_idCommit Merkle Root
POST /relayer/commit
Content-Type: application/json
{
"userWallet": "string",
"merkleRoot": number[],
"metadata": {
"chain": "solana",
"snapshotTimestamp": number,
"expiresAt": number | null,
"privacyScore": number
},
"userSignature": "string",
"message": "string",
"timestamp": number
}Get Status
GET /subscription/status?wallet=stringGet Plans
GET /subscription/plansThe Solana program is built with Anchor Framework and handles commitment storage.
79WokvRaKKnw4Ay73s6HGMn9ZJVcxBmsufEGH8imxTAn
commit_root Stores a Merkle root commitment on-chain.
pub fn commit_root(
ctx: Context<CommitRoot>,
user_wallet: Pubkey,
merkle_root: [u8; 32],
metadata: CommitMetadata,
) -> Result<()>revoke_all Revokes all share links for a wallet.
pub fn revoke_all(ctx: Context<RevokeAll>) -> Result<()>ShareCommitment
pub struct ShareCommitment {
pub relayer: Pubkey, // 32 bytes
pub merkle_root: [u8; 32], // 32 bytes
pub version: u32, // 4 bytes
pub metadata: CommitMetadata,
pub timestamp: i64, // 8 bytes
pub revoked: bool, // 1 byte
pub bump: u8, // 1 byte
}User connects Solana wallet, and FlexAnon fetches real-time portfolio data from Zerion Solana API.
User chooses what to reveal:
- Total portfolio value
- Profit/Loss percentage
- Top N assets
- Individual asset details
- Wallet address (optional)
Portfolio data is converted into Merkle leaves. Each data point becomes a leaf that can be independently revealed or hidden.
Example Leaves:
- wallet_address: hash(wallet_address)
- total_value: hash(total_value)
- asset_0_SOL: hash(SOL_data)
- asset_1_USDC: hash(USDC_data)
The Merkle root is committed to Solana via a relayer wallet. This ensures:
- User's wallet never appears on-chain
- Commitment is tamper-proof
- Version tracking for updates
A unique share token is created containing:
- Token ID (short, shareable)
- Revealed leaves (what user chose to share)
- Merkle proofs (for verification)
- Commitment address (Solana PDA)
Anyone with the share link can:
- View revealed data
- Verify Merkle proofs against on-chain commitment
- Confirm data authenticity without seeing hidden information
- Never share your private keys
- Verify all transactions before signing
- Use hardware wallets for large holdings
- Review revealed data before generating share links
This project is licensed under the MIT License.
- Solana Foundation for blockchain infrastructure
- Zerion for portfolio data API
- Anchor Framework for smart contract development
- Website: flexanon.vercel.app
- Documentation: docs.flexanon.xyz
- Twitter: @FlexAnon
