ChainTrust is a revolutionary blockchain-powered SaaS platform that provides immutable proof of ownership for digital content. Register your creative works on the Polygon blockchain with IPFS storage for permanent, tamper-proof ownership verification.
- Instant Registration: Upload any file type and register ownership in seconds
- SHA-256 Hashing: Cryptographic content fingerprinting
- Blockchain Storage: Immutable records on Polygon network
- IPFS Integration: Decentralized file storage with Infura
- Public Verification: Anyone can verify ownership with content hash
- Ownership Certificates: Beautiful, shareable proof certificates
- Transfer Support: Transfer ownership between wallets
- Dashboard: Manage all your registered content in one place
- Smart Contract Escrow: Secure freelance transactions
- Subscription Sharing: Group payment management
- API Access: Developer integration tools
- White-label Solutions: Custom branding options
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Frontend │ │ Backend │ │ Blockchain │
│ (Next.js) │◄──►│ (Node.js) │◄──►│ (Polygon) │
│ │ │ │ │ │
│ • React UI │ │ • Express API │ │ • Smart │
│ • Web3 Wallet │ │ • File Upload │ │ Contracts │
│ • File Upload │ │ • IPFS Service │ │ • Ownership │
│ • Verification │ │ • Blockchain │ │ Registry │
│ • Dashboard │ │ Integration │ │ │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│ │
▼ ▼
┌─────────────────┐ ┌─────────────────┐
│ IPFS │ │ PostgreSQL │
│ (File Storage) │ │ (Metadata) │
└─────────────────┘ └─────────────────┘
- Node.js 18+ and npm
- Git
- Polygon wallet with MATIC tokens
- Infura IPFS project (optional)
git clone https://github.com/your-username/chaintrust.git
cd chaintrust# Copy environment template
cp .env.example .env
# Edit with your configuration
nano .envRequired Environment Variables:
# Blockchain
PRIVATE_KEY=your_wallet_private_key
POLYGON_MUMBAI_RPC=https://rpc-mumbai.maticvigil.com
POLYGONSCAN_API_KEY=your_polygonscan_api_key
# IPFS (Optional - uses public gateway if not set)
IPFS_PROJECT_ID=your_infura_project_id
IPFS_PROJECT_SECRET=your_infura_secret
# API
JWT_SECRET=your_secure_jwt_secret# Root dependencies (Hardhat, deployment)
npm install
# Backend dependencies
cd backend && npm install && cd ..
# Frontend dependencies
cd frontend && npm install && cd ..# Compile contracts
npm run compile
# Deploy to Polygon Mumbai testnet
npm run deploy:mumbai
# Or deploy locally for development
npm run node # Terminal 1
npm run deploy:local # Terminal 2# Start backend API (Terminal 1)
npm run backend:dev
# Start frontend (Terminal 2)
cd frontend && npm run devNavigate to http://localhost:3000 and connect your Web3 wallet!
# Set environment variables
cp .env.example .env
# Edit .env with your values
# Start all services
docker-compose up -d
# View logs
docker-compose logs -f
# Stop services
docker-compose down# Build and deploy
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
# SSL with Let's Encrypt
docker-compose -f docker-compose.yml -f docker-compose.ssl.yml up -dMost endpoints require a connected wallet. The frontend handles this automatically.
POST /api/ownership/register
Content-Type: multipart/form-data
# Form data
file: [binary file]
title: "My Creative Work"
description: "Description of the work"
isTransferable: trueGET /api/ownership/verify/{contentHash}
Response:
{
"verified": true,
"contentHash": "abc123...",
"data": {
"owner": "0x123...",
"title": "My Creative Work",
"registeredAt": "2024-01-01T00:00:00Z",
"ipfsHash": "Qm456...",
"ipfsUrl": "https://ipfs.io/ipfs/Qm456..."
}
}GET /api/ownership/owner/{walletAddress}
Response:
{
"owner": "0x123...",
"totalContent": 5,
"content": [...]
}POST /api/upload/ipfs
Content-Type: multipart/form-data
# Upload files without blockchain registrationGET /api/upload/status/{ipfsHash}
Response:
{
"available": true,
"hash": "Qm456...",
"publicUrl": "https://ipfs.io/ipfs/Qm456...",
"metadata": {...}
}chaintrust/
├── contracts/ # Smart contracts (Solidity)
│ ├── ContentOwnershipRegistry.sol
│ ├── FreelanceEscrow.sol
│ └── SubscriptionPool.sol
├── backend/ # Node.js API server
│ ├── routes/ # API endpoints
│ ├── services/ # Business logic
│ └── server.js # Express app
├── frontend/ # Next.js React app
│ ├── components/ # React components
│ ├── pages/ # Next.js pages
│ ├── lib/ # Utilities
│ └── styles/ # CSS styles
├── scripts/ # Deployment scripts
├── test/ # Contract tests
└── docker-compose.yml # Docker configuration
# Compile contracts
npm run compile
# Run tests
npm test
# Deploy locally
npm run node # Start local blockchain
npm run deploy:local # Deploy contracts
# Deploy to testnet
npm run deploy:mumbai
# Verify on Polygonscan
npm run verify -- --network polygon 0xCONTRACT_ADDRESScd frontend
# Start development server
npm run dev
# Build for production
npm run build
npm start
# Type checking
npm run type-check
# Linting
npm run lintcd backend
# Start with auto-reload
npm run dev
# Start production server
npm start
# Run with debugger
npm run debug# Run all contract tests
npm test
# Run specific test file
npx hardhat test test/ContentOwnership.test.js
# Run with gas reporting
REPORT_GAS=true npm test
# Test coverage
npm run coverage# Backend API tests
cd backend && npm test
# Frontend component tests
cd frontend && npm test
# End-to-end tests
npm run test:e2e- Get Mumbai MATIC from faucet
- Configure
POLYGON_MUMBAI_RPCin.env - Run
npm run deploy:mumbai - Update frontend with contract addresses
- Fund wallet with MATIC for gas fees
- Configure
POLYGON_MAINNET_RPCin.env - Set
NODE_ENV=production - Run
npm run deploy:polygon - Verify contracts on Polygonscan
# Install Vercel CLI
npm i -g vercel
# Deploy
vercel
# Set environment variables in Vercel dashboard
# NEXT_PUBLIC_API_URL=https://your-api.com/api- Connect GitHub repository
- Set environment variables
- Deploy with
npm run backend:start
- Backend:
GET /health - IPFS:
GET /api/upload/health - Smart contracts: Monitor on Polygonscan
# View application logs
docker-compose logs -f backend
docker-compose logs -f frontend
# Database logs
docker-compose logs -f postgres
# All services
docker-compose logs -f- ✅ OpenZeppelin contracts used
- ✅ ReentrancyGuard implemented
- ✅ Access control modifiers
- ✅ Input validation
- ⏳ Audit scheduled (Q2 2024)
- ✅ Rate limiting
- ✅ CORS configuration
- ✅ Input validation (Joi)
- ✅ File upload restrictions
- ✅ Webhook signature verification
- ✅ CSP headers
- ✅ XSS protection
- ✅ Wallet connection security
- ✅ No sensitive data in localStorage
"Transaction failed" errors:
- Check wallet has MATIC for gas fees
- Verify network (Mumbai vs Mainnet)
- Increase gas limit if needed
"File upload failed":
- Check file size (max 10MB)
- Verify IPFS service status
- Check CORS configuration
"Wallet not connecting":
- Clear browser cache
- Disable conflicting wallet extensions
- Check network settings
"Smart contract not found":
- Verify deployed addresses in
deployed-addresses.json - Check correct network selected
- Redeploy contracts if needed
# Enable debug logging
DEBUG=chaintrust:* npm run backend:dev
# Frontend debug mode
NODE_ENV=development npm run devWe welcome contributions! Please see CONTRIBUTING.md for guidelines.
- Fork repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open Pull Request
- ESLint + Prettier for JavaScript/TypeScript
- Solhint for Solidity
- Conventional commits for messages
This project is licensed under the MIT License - see LICENSE file for details.
- Documentation: docs.chaintrust.app
- Discord: discord.gg/chaintrust
- Email: support@chaintrust.app
- GitHub Issues: Create an issue
- Proof of Ownership Module
- Web3 Wallet Integration
- IPFS File Storage
- Public Verification
- Basic UI/UX
- Smart Contract Escrow
- Subscription Sharing Manager
- API Access & Documentation
- Mobile App (React Native)
- Batch Operations
- Multi-chain Support (Ethereum, BSC)
- NFT Integration
- Advanced Analytics
- White-label Solutions
- Enterprise Features