How antusantury/blackdiamond works
Black Diamond is a cross-platform escrow service: buyers and sellers use Telegram or the web interface to create or join a deal, fund escrow, confirm delivery, and release funds through seller withdrawal. Both interfaces share deal, database, payment, commission, notification, and security capabilities. The README documents this lifecycle and TON support; sampled code and the source index support selected implementation links. Several subsystems, including frontend behavior and some backend services, were not fully sampled, so their internal connections are omitted.
Main entry points: unified_handler.py Bot deal actions · join_deal.py Seller join · app.py Web interface · database.py Deal database
Components 17
User interfaces
- Telegram
- Telegram bot
bot/main.py - Bot deal actions
bot/handlers/unified_handler.py - Web interface
web/app.py - Seller join
web/join_deal.py - Web client
static/js/main.js - Cross-platform API
web/cross_platform_api.py
Escrow workflow
- Deal processing
shared/deal_processor.py
Shared services
- Deal database
shared/database/database.py - Blockchain payments
shared/decentralized_payments.py - Fee calculation
shared/commission.py - Authorization
bot/security/zero_trust_security.py - Notifications
shared/notifications.py - Platform synchronization
shared/platform_sync.py
External services
- TON blockchain
- Telegram messaging
Other components
- Buyer / seller
Connections 23
- Buyer / seller → Telegram: use
- Buyer / seller → Web interface: use
- Telegram → Telegram bot: send updates
- Telegram bot → Bot deal actions: register handlers
bot/main.py - Buyer / seller → Bot deal actions: request deal actions
- Buyer / seller → Web client: use
- Web client → Web interface: request web actions
- Buyer / seller → Seller join: join deal
- Bot deal actions → Deal database: read and update deals
bot/handlers/unified_handler.py - Bot deal actions → Blockchain payments: check payments
bot/handlers/unified_handler.py - Bot deal actions → Fee calculation: calculate fees
bot/handlers/unified_handler.py - Bot deal actions → Authorization: authorize actions
bot/handlers/unified_handler.py - Web interface → Deal database: read deal
web/app.py - Web interface → Fee calculation: calculate fees
web/app.py - Seller join → Deal database: read and join deal
web/join_deal.py - Seller join → Blockchain payments: get payment details
web/join_deal.py - Seller join → Fee calculation: calculate fees
web/join_deal.py - Seller join → Notifications: notify buyer
web/join_deal.py - Cross-platform API → Deal database: access deal data
web/cross_platform_api.py - Cross-platform API → Platform synchronization: synchronize platforms
web/cross_platform_api.py - Cross-platform API → Notifications: send notifications
web/cross_platform_api.py - Blockchain payments → TON blockchain: verify TON payments
- Notifications → Telegram messaging: send messages
shared/notifications.py