Turn Data Into Value, Without Giving It Away
Enclava is a decentralized AI-powered data marketplace designed to help individuals and organizations monetize their data without compromising privacy. Whether you want to sell, subscribe to, or rent data, Enclava offers a secure, seamless, and trustless environment, powered by Hedera Blockchain.
Using Trusted Execution Environments (TEE), sensitive data is processed confidentiall, raw data is never exposed. Privacy is preserved by design. Each dataset is represented by a personal AI Agent, which autonomously handles data exchange, queries, and payments with other agents.
On Enclava, your data becomes a valuable digital asset, a byproduct of your core business that you can monetize continuously through royalties. You can also query and analyze data within Enclava to gain powerful insights, detect patterns, and generate predictions and recommendations. The more data is shared, the more accurate and less biased AI systems become, unlocking innovation at scale.
- Trusted Execution Environments (TEE) - Process data without exposing raw information
- Zero-Knowledge Proofs (ZKP) - Prove data properties without revealing details
- Homomorphic Encryption - Compute on encrypted data while keeping it private
- Data Watermarking & Provenance - Track origin and prevent unauthorized usage
- AI-driven data discovery & classification - Smart labeling and organization
- AI-powered data quality & cleansing - Enforce integrity before processing
- Natural Language Query - Ask questions in plain language, get instant answers
- Automatic relationship detection - AI finds optimal dataset joins and merges
- Synthetic data generation - Fill missing pieces or augment datasets
- Adaptive access control - Context-aware permissions powered by AI
- NFT-based ownership - Immutable proof of data rights
- Smart contract automation - Transparent, trustless transactions
- Pay-per-query model - Users only pay for data they use
- Continuous royalties - Data providers earn from every query
- Sub-400ms finality - Ultra-fast settlements via Hedera Blockchain
- Rust-based backend - Safe, fast, and memory-efficient processing
- RESTful API - Easy integration with existing systems
- Swagger documentation - Complete API reference
- Scalable architecture - Handle enterprise-grade workloads
backend/
βββ src/
β βββ api/ # REST API endpoints
β βββ database/ # PostgreSQL integration
β βββ tee/ # Trusted Execution Environment
β βββ helpers/ # AI agents and utilities
β βββ types/ # Data structures and schemas
β βββ config/ # Application configuration
βββ migrations/ # Database migrations
βββ uploads/ # Dataset storage
contracts/
βββ src/
β βββ EnclavaPayments.sol # NFT-based payment system
βββ script/ # Deployment scripts
βββ test/ # Contract tests
- Backend: Rust with Actix-web framework
- Database: PostgreSQL with SQLx
- AI/ML: Google Gemini integration via Rig framework
- Blockchain: Solidity smart contracts on Hedera Network
- Development: Foundry for smart contract development
- API Documentation: OpenAPI/Swagger with utoipa
- File Processing: CSV parsing and multipart uploads
- Rust 1.89+ (Install Rust)
- Node.js 18+ (Install Node.js)
- PostgreSQL 17+ (Install PostgreSQL)
- Foundry (Install Foundry)
- Git (Install Git)
git clone https://github.com/your-org/enclava.git
cd enclavaCreate a .env file in the root directory:
DATABASE_URL=postgresql://username:password@localhost/enclava
GEMINI_API_KEY=your-gemini-api-key
PORT=8080# Install sqlx-cli if not already installed
cargo install sqlx-cli
# Create database and run migrations
cd backend
sqlx database create
sqlx migrate runcd backend
cargo build --release
cargo runThe API will be available at http://localhost:8080
- Swagger UI:
http://localhost:8080/swagger-ui/ - Health check:
http://localhost:8080/health
cd contracts
# Install dependencies
forge install
# Compile contracts
forge build
# Run tests
forge test
# Deploy to testnet (configure your private key first)
./deploy_testnet.shGET /- Service statusGET /health- Health check
POST /dataset/upload- Upload dataset with metadataPOST /dataset/details/generate- AI-generated dataset details
GET /agents- List all available agentsGET /agents/for-prompt- Get agents suitable for a promptPOST /agents/query- Query specific agentsGET /agents/{id}- Get agent details
GET /datasets/stats- Dataset statisticsGET /profile- User profile information
curl -X POST "http://localhost:8080/dataset/upload" \
-H "Content-Type: multipart/form-data" \
-F "file=@your-dataset.csv" \
-F "user_address=0x1234567890123456789012345678901234567890" \
-F "dataset_price=100.0" \
-F "description=Sample dataset description" \
-F "name=My Dataset" \
-F "category=Analytics"curl -X POST "http://localhost:8080/agents/query" \
-H "Content-Type: application/json" \
-d '{
"prompt": "What insights can you provide about user behavior?",
"agent_ids": [1, 2, 3],
"tx_hash": "0xabcdef..."
}'The EnclavaPayments.sol contract implements:
- ERC721 NFTs representing dataset ownership
- Royalty distribution system for data providers
- Payment tracking and claim functionality
- Usage-based billing for data consumers
safeMint()- Mint NFT for dataset uploadpayForDatasetUsage()- Process payments for data usageclaimAllFunds()- Claim accumulated royaltiesgetUnclaimedAmount()- Check pending earnings
cd backend
cargo testcd contracts
forge test -vvv# Start the backend
cd backend && cargo run &
# Run integration tests
curl -X GET http://localhost:8080/health# Build for production
cd backend
cargo build --release
# Run with production settings
RUST_LOG=info ./target/release/enclava_backendcd contracts
# Deploy to Hedera testnet with verification
./deploy_testnet.shKey configuration options in backend/src/config.rs:
DATABASE_URL- PostgreSQL connection stringALCHEMY_RPC_URL- Blockchain RPC endpointPORT- Server port (default: 8080)UPLOAD_DIR- Dataset storage directoryMAX_ALLOWED_SELECTED_AGENTS- Query limit per request
ENCLAVA_CONTRACT_ADDRESS- Address of the deployed EnclavaPayments contract- Network configuration in
foundry.toml INITIAL_OWNER- Address to receive contract ownership when deploying
This project is licensed under the MIT License - see the LICENSE file for details.