A blockchain-based, AI-assisted mobile application for managing digital wills and inheritance using Flutter, Solidity, and Deep Learning.
This MVP allows users to:
- Create secure digital wills stored on Ethereum blockchain
- Assign crypto assets, NFTs, and social media accounts to beneficiaries
- Use AI to suggest beneficiaries based on social connections
- Automated inactivity detection with human verification
- End-to-end encryption with IPFS storage
┌─────────────────┐
│ Flutter App │
│ (Mobile UI) │
└────────┬────────┘
│
┌────┴────────────────────┐
│ │
┌───▼──────┐ ┌───────▼────────┐
│ Web3 │ │ ML Inference │
│ Service │ │ Service │
└───┬──────┘ └───────┬────────┘
│ │
┌───▼──────────┐ ┌────────▼────────┐
│ Smart │ │ TFLite Model │
│ Contract │ │ (Inactivity │
│ (Solidity) │ │ Classifier) │
└──────────────┘ └─────────────────┘
│
┌────▼─────────────┐
│ IPFS Storage │
│ (Encrypted) │
└──────────────────┘
-
Flutter SDK (3.0.0+)
flutter --version
-
Node.js & npm (for Hardhat)
node --version npm --version
-
Python 3.8+ (for ML model training)
python --version
-
Metamask or similar Web3 wallet
git clone https://github.com/yourusername/digital-will-app.git
cd digital-will-appflutter pub getcd contracts
npm installCreate .env file:
SEPOLIA_RPC_URL=https://eth-sepolia.g.alchemy.com/v2/YOUR_KEY
PRIVATE_KEY=your_wallet_private_key
ETHERSCAN_API_KEY=your_etherscan_keyCompile and deploy:
npx hardhat compile
npx hardhat run scripts/deploy.js --network sepoliaSave the deployed contract address!
cd ml_models
pip install -r requirements.txt
python inactivity_classifier.pyThis generates:
inactivity_model.h5(Keras model)scaler.pkl(Feature scaler)
python convert_to_tflite.pyCopy inactivity_model.tflite to assets/ml_models/
Create lib/core/config/api_config.dart:
class APIConfig {
static const String sepoliaRpcUrl = 'YOUR_ALCHEMY_URL';
static const String contractAddress = 'YOUR_CONTRACT_ADDRESS';
static const String pinataAPIKey = 'YOUR_PINATA_KEY';
static const String pinataSecretKey = 'YOUR_PINATA_SECRET';
static const String facebookAppId = 'YOUR_FB_APP_ID';
}flutter rundigital_will_app/
├── lib/
│ ├── core/
│ │ ├── config/ # API configs
│ │ ├── constants/ # App constants
│ │ └── utils/ # Helper functions
│ ├── data/
│ │ ├── models/ # Data models
│ │ ├── repositories/ # Data repositories
│ │ └── services/ # Business logic
│ │ ├── web3_service.dart
│ │ ├── encryption_service.dart
│ │ ├── ipfs_service.dart
│ │ ├── ml_inference_service.dart
│ │ └── social_media_service.dart
│ ├── presentation/
│ │ ├── screens/ # UI screens
│ │ │ ├── create_will_screen.dart
│ │ │ ├── dashboard_screen.dart
│ │ │ └── verification_screen.dart
│ │ └── widgets/ # Reusable widgets
│ └── main.dart
├── contracts/
│ ├── DigitalWill.sol # Smart contract
│ ├── hardhat.config.js
│ └── scripts/
│ └── deploy.js
├── ml_models/
│ ├── inactivity_classifier.py
│ ├── convert_to_tflite.py
│ └── requirements.txt
├── assets/
│ ├── ml_models/
│ │ └── inactivity_model.tflite
│ ├── images/
│ └── contracts/
│ └── DigitalWill.json # ABI
└── test/
// hardhat.config.js
module.exports = {
solidity: "0.8.20",
networks: {
sepolia: {
url: process.env.SEPOLIA_RPC_URL,
accounts: [process.env.PRIVATE_KEY],
chainId: 11155111
}
}
};Option 1: Pinata (Recommended)
- Sign up at https://pinata.cloud
- Get API keys
- Update
api_config.dart
Option 2: Infura IPFS
- Sign up at https://infura.io
- Create IPFS project
- Use project ID
Facebook/Instagram:
- Create app at https://developers.facebook.com
- Add OAuth redirect URIs
- Request permissions:
user_posts,user_likes - Add App ID to config
cd contracts
npx hardhat testflutter testcd ml_models
python test_model.py- User registration & authentication
- OAuth integration (Facebook/Instagram)
- Digital asset management UI
- Will creation flow
- Beneficiary assignment
- Rule-based inactivity detection
- Smart contract deployment (testnet)
- IPFS encrypted storage
- Basic ML classifier
- Push notifications for verification
- Multi-chain support (Polygon, BSC)
- Advanced ML model with LSTM
- Multi-source verification (notary API)
- Family tree integration
- Legal document templates
- Asset auto-discovery
- Multi-signature support
- DAO governance for disputes
- AES-256 encryption for sensitive data
- End-to-end encryption
- Client-side key management
- Secure key storage with Flutter Secure Storage
- ReentrancyGuard protection
- Access control modifiers
- Tested with Hardhat
- Auditable on-chain logic
- GDPR/KVKK compliant
- Explicit user consent
- Data deletion rights
- Minimal metadata storage
- Days since last post/like/comment/DM
- Activity frequency metrics
- Engagement rates
- Device usage patterns
- Posting consistency
- Social network density
Input (18) → Dense(128) → BatchNorm → Dropout(0.3)
→ Dense(64) → BatchNorm → Dropout(0.3)
→ Dense(32) → Dropout(0.2)
→ Output(3): [active, suspicious, deceased]
- Accuracy: ~92%
- AUC-ROC: ~0.96
- Precision (deceased class): ~88%
| Operation | Estimated Gas | Cost (ETH) |
|---|---|---|
| Create Will | ~250,000 | ~0.002 |
| Update Will | ~80,000 | ~0.0008 |
| Record Activity | ~45,000 | ~0.0004 |
| Execute Will | ~120,000 | ~0.001 |
1. Web3 Connection Failed
// Check RPC URL and network
await _client.getNetworkId(); // Should return 11155111 for Sepolia2. IPFS Upload Timeout
// Try different gateway or increase timeout
options: Options(receiveTimeout: Duration(seconds: 30))3. ML Model Not Loading
// Ensure .tflite file is in assets and pubspec.yaml is updated
flutter clean && flutter pub get4. Smart Contract Call Reverts
# Check if wallet has testnet ETH
# Get free ETH from Sepolia faucet: https://sepoliafaucet.com// Create new will
await web3Service.createWill(
encryptedDataURI: ipfsHash,
beneficiaryAddresses: ['0x...', '0x...'],
sharePercentages: [5000, 5000], // 50%, 50% (basis points)
inactivityThreshold: 15552000, // 180 days in seconds
);
// Record activity (resets inactivity timer)
await web3Service.recordActivity();
// Check inactivity status
bool isInactive = await web3Service.checkInactivity(ownerAddress);
// Get will data
Map<String, dynamic> willData = await web3Service.getWillData(ownerAddress);// Upload encrypted will
String ipfsHash = await ipfsService.uploadWillData({
'assets': [...],
'beneficiaries': [...],
'metadata': {...}
});
// Retrieve will data
Map<String, dynamic> willData = await ipfsService.retrieveWillData(ipfsHash);
// Pin for persistence
await ipfsService.pinContent(ipfsHash);// Predict activity status
Map<String, dynamic> prediction = await mlService.predictActivityStatus({
'days_since_last_post': 45,
'days_since_last_like': 30,
'app_sessions_per_week': 2,
// ... other features
});
// Output:
// {
// 'active': 0.15,
// 'suspicious': 0.65,
// 'deceased': 0.20,
// 'recommendation': 'REQUEST_VERIFICATION',
// 'confidence': 0.65
// }// Get activity metadata
Map<String, dynamic> metadata = await socialService.calculateActivityMetadata();
// Fetch recent posts
List<Map<String, dynamic>> posts = await socialService.fetchRecentPosts(limit: 50);
// Analyze patterns
double consistency = socialService.analyzePostingConsistency(posts);graph TD
A[User Opens App] --> B[Connect Wallet]
B --> C[OAuth Social Login]
C --> D[Add Digital Assets]
D --> E[Add Beneficiaries]
E --> F{Use AI Suggestions?}
F -->|Yes| G[Analyze Social Graph]
F -->|No| H[Manual Entry]
G --> I[Set Inactivity Threshold]
H --> I
I --> J[Encrypt Will Data]
J --> K[Upload to IPFS]
K --> L[Create Smart Contract]
L --> M[Transaction Confirmed]
M --> N[Will Active]
graph TD
A[Daily Cron Job] --> B[Check All Active Wills]
B --> C{Fetch User Activity}
C --> D[Social Media API]
C --> E[App Usage Logs]
D --> F[Calculate Features]
E --> F
F --> G[ML Model Prediction]
G --> H{Status?}
H -->|Active| I[Update Timestamp]
H -->|Suspicious| J[Send Verification Request]
H -->|Deceased| K[Count Failed Verifications]
K --> L{3+ Failed?}
L -->|Yes| M[Mark as Deceased]
L -->|No| J
J --> N[User Responds?]
N -->|Yes| I
N -->|No| K
M --> O[Execute Will]
- Complete security audit of smart contracts
- Penetration testing of backend APIs
- Load testing (1000+ concurrent users)
- Legal compliance review (inheritance laws)
- Privacy policy & terms of service
- KYC/AML integration (if handling large assets)
- Multi-sig wallet for contract ownership
- Backup & disaster recovery plan
# 1. Audit smart contract
npm run audit
# 2. Deploy to mainnet
npx hardhat run scripts/deploy.js --network mainnet
# 3. Verify contract on Etherscan
npx hardhat verify --network mainnet DEPLOYED_CONTRACT_ADDRESS
# 4. Update app config with mainnet details
# 5. Submit app to stores (App Store, Play Store)User Metrics:
- Active wills created
- Average assets per will
- Verification response rate
- User retention (30/60/90 day)
System Metrics:
- ML model accuracy (production)
- False positive rate (deceased detection)
- Smart contract gas optimization
- IPFS retrieval latency
Business Metrics:
- User acquisition cost
- Lifetime value
- Conversion rate (free → paid)
- Churn rate
# monitoring-stack.yml
services:
- Firebase Analytics (user behavior)
- Sentry (error tracking)
- Mixpanel (product analytics)
- Grafana + Prometheus (system metrics)
- The Graph (blockchain indexing)| Service | Cost |
|---|---|
| Firebase (Auth, Notifications) | $25 |
| Pinata IPFS (100GB) | $20 |
| Alchemy API (Ethereum RPC) | $49 |
| Server (Node.js backend) | $50 |
| ML Model Hosting | $30 |
| Total | ~$174/month |
- Gas fees: ~$5-10 (one-time, paid by user)
- Storage: ~$0.02/month
- API calls: ~$0.05/month
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
# Fork the repo
git clone https://github.com/YOUR_USERNAME/digital-will-app.git
# Create feature branch
git checkout -b feature/amazing-feature
# Make changes and test
flutter test
# Commit with conventional commits
git commit -m "feat: add beneficiary auto-suggestion"
# Push and create PR
git push origin feature/amazing-feature- Follow Effective Dart
- Use
flutter formatbefore commits - Write tests for new features
- Document public APIs
This project is licensed under the MIT License - see LICENSE file.
Important Legal Notice:
This is an MVP project for educational and demonstration purposes. Before using in production:
-
Legal Compliance: Inheritance laws vary by jurisdiction. Consult with legal experts in your target markets.
-
Not Financial Advice: This system does not provide legal, financial, or estate planning advice.
-
Smart Contract Risks: Blockchain transactions are irreversible. Thoroughly test and audit before mainnet deployment.
-
Privacy: Implement proper GDPR/CCPA compliance for user data handling.
-
Death Verification: The inactivity detection is NOT a substitute for official death certificates. Implement multi-source verification with legal authorities.
-
Liability: Users should understand the risks of crypto custody and inheritance planning.
- Documentation: https://docs.yourapp.com
- Discord: https://discord.gg/yourapp
- Email: support@yourapp.com
- Twitter: @yourapp
- OpenZeppelin for smart contract libraries
- TensorFlow team for ML framework
- IPFS for decentralized storage
- Ethereum Foundation
- Flutter community
- MVP launch (testnet)
- Core features implementation
- Security audit
- Beta testing (100 users)
- Mainnet deployment
- iOS/Android app store launch
- Multi-chain support (Polygon)
- Advanced ML model (LSTM)
- Legal partnerships (notaries)
- Enterprise features
- API for third-party integrations
- Mobile web version
- International expansion
- Fiat on-ramp integration
- DAO governance launch
- White-label solution
Built with using Flutter, Solidity & Deep Learning
Version: 1.0.0-mvp
Last Updated: October 2025
Blockchain Development:
Flutter Development:
Machine Learning:
Star this repo if you find it useful!