A decentralized platform built on Solana blockchain for distributing and completing tasks with secure payment processing using Shamir's Secret Sharing (SSS) for private key management.
DexAdofm is a full-stack decentralized application that enables users to create tasks (like thumbnail selection) and workers to complete them for cryptocurrency rewards. The platform features:
- Decentralized Architecture: Built on Solana blockchain
- Secure Payment Processing: Uses Shamir's Secret Sharing for private key management
- Dual Interface: Separate user and worker frontends
- Distributed Infrastructure: Multi-server distribution system
- Real-time Task Management: PostgreSQL database with Prisma ORM
- Main Backend (
backend/): Express.js API with TypeScript - Distribution Servers (
distribution/): 5-node distributed system for load balancing - Database: PostgreSQL with Prisma ORM
- Blockchain Integration: Solana Web3.js for wallet operations
- User Frontend (
user-frontend/): Next.js app for task creators (Port 3001) - Worker Frontend (
worker-frontend/): Next.js app for task workers (Port 3002)
- Blockchain: Solana
- Backend: Node.js, Express.js, TypeScript
- Frontend: Next.js 14, React 18, Tailwind CSS
- Database: PostgreSQL, Prisma
- Security: Shamir's Secret Sharing, JWT
- Infrastructure: Docker, Docker Compose
DexAdofm/
βββ backend/ # Main API server
β βββ prisma/ # Database schema and migrations
β βββ src/
β β βββ routers/ # API routes
β β βββ sss/ # Shamir's Secret Sharing implementation
β β βββ types.ts # TypeScript definitions
β βββ package.json
βββ distribution/ # Distributed server infrastructure
β βββ server-1/ # Distribution node 1 (Port 8080)
β βββ server-2/ # Distribution node 2 (Port 7070)
β βββ server-3/ # Distribution node 3 (Port 6060)
β βββ server-4/ # Distribution node 4 (Port 5050)
β βββ server-5/ # Distribution node 5 (Port 4040)
β βββ docker-compose.yml
βββ user-frontend/ # Task creator interface
β βββ app/ # Next.js app router
β βββ components/ # React components
β βββ package.json
βββ worker-frontend/ # Task worker interface
βββ app/ # Next.js app router
βββ components/ # React components
βββ package.json
- Node.js 18+
- PostgreSQL database
- Docker and Docker Compose
- Solana CLI tools
- Yarn or npm
cd backend
# Install dependencies
npm install
# Set up environment variables
cp .env.example .env
# Edit .env with your database URL and other configurations
# Set up database
npx prisma generate
npx prisma db push
# Generate Shamir's Secret Sharing shares
npm run generate:shares
# Start the server
npm startcd user-frontend
# Install dependencies
npm install
# Set up environment variables
cp .env.example .env
# Edit .env with your backend API URL
# Start development server
npm run devcd worker-frontend
# Install dependencies
npm install
# Set up environment variables
cp .env.example .env
# Edit .env with your backend API URL
# Start development server
npm run devcd distribution
# Start all distribution servers
docker-compose up -d
# Check server status
docker-compose psDATABASE_URL="postgresql://username:password@localhost:5432/dexadofm"
JWT_SECRET="your-jwt-secret"
SOLANA_RPC_URL="https://api.mainnet-beta.solana.com"
AWS_ACCESS_KEY_ID="your-aws-key"
AWS_SECRET_ACCESS_KEY="your-aws-secret"
AWS_REGION="us-east-1"
S3_BUCKET="your-s3-bucket"NEXT_PUBLIC_API_URL="http://localhost:3000"
NEXT_PUBLIC_SOLANA_RPC_URL="https://api.mainnet-beta.solana.com"- Connect your Solana wallet to the user frontend
- Upload images for your task (e.g., thumbnail options)
- Set the reward amount in SOL
- Submit the task to the blockchain
- Monitor task completion and payouts
- Connect your Solana wallet to the worker frontend
- Browse available tasks
- Complete tasks by selecting the best option
- Receive automatic payments upon task completion
- Shamir's Secret Sharing: Private keys are split across multiple distribution servers
- JWT Authentication: Secure API access
- Blockchain Verification: All transactions verified on Solana
- Rate Limiting: Protection against spam and abuse
The application uses the following main entities:
- User: Task creators with Solana addresses
- Worker: Task completers with pending/locked amounts
- Task: Tasks with options and reward amounts
- Option: Individual choices for each task
- Submission: Worker responses to tasks
- Payouts: Payment transaction records
# Build and start all services
docker-compose -f docker-compose.prod.yml up -d
# Monitor logs
docker-compose logs -f# Start development environment
docker-compose -f docker-compose.dev.yml up -dPOST /tasks- Create new taskGET /tasks/:id- Get task detailsGET /tasks- List user's tasks
GET /tasks- Get available tasksPOST /submit- Submit task completionGET /balance- Get worker balancePOST /payout- Request payout
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Local Development: Use
npm run devfor hot reloading - Testing: Run tests with
npm test - Database Migrations: Use
npx prisma migrate dev - Production Build: Use
npm run build
- Application Logs: Check Docker logs for each service
- Database Health: Monitor PostgreSQL connection and performance
- Blockchain Transactions: Track Solana transaction status
- API Performance: Monitor response times and error rates
Built with β€οΈ using Solana, Next.js, and TypeScript