
Airchainpay
Anywhere. Anytime. Even Offline.
About
The problem it solves AirChainPay addresses a critical gap in the cryptocurrency payment ecosystem by solving the fundamental problem of offline and limited-connectivity crypto payments. The Core Problem Traditional cryptocurrency payments require constant internet connectivity to: Access blockchain networks Sign and broadcast transactions Verify payment confirmations Check wallet balances This creates significant barriers in real-world scenarios where: Internet connectivity is unreliable or unavailable (remote areas, underground locations, disaster zones) Network congestion causes high fees and slow confirmations Privacy concerns with online transaction broadcasting Cross-border payments face regulatory and infrastructure challenges AirChainPay's Solution AirChainPay creates a hybrid offline-online payment system that enables: 1. Offline Payment Capability Bluetooth Low Energy (BLE) peer-to-peer transfers between devices Offline transaction signing and queuing Secure local storage of pending transactions QR code-based payment initiation 2. Multi-Chain Interoperability Support for Core Testnet, Base Sepolia, Lisk Sepolia, and Morph Holesky Cross-chain compatibility through standardized smart contracts Token support for USDC, USDT, and native currencies 3. Security-First Architecture Rust-based wallet core for maximum security and memory safety Hardware-backed storage (iOS Keychain, Android Keystore) Zero memory exposure for private keys Encrypted BLE communication 4. Reliable Infrastructure High-performance Rust relay server for transaction processing Background task scheduling for offline transaction broadcasting Multi-level caching and data compression Comprehensive monitoring and health checks Real-World Applications This solution enables crypto payments in scenarios where traditional methods fail: Retail environments with poor connectivity Emergency situations where infrastructure is compromised International travel with connectivity issues Privacy-conscious transactions requiring offline signing Disaster relief in areas with damaged infrastructure Remote commerce in underserved regions Key Innovation AirChainPay's breakthrough is combining offline transaction capability with real blockchain integration, creating a seamless bridge between offline convenience and on-chain security. Users can initiate payments offline, queue them securely, and have them automatically broadcast when connectivity is restored. This addresses the fundamental tension between cryptocurrency's digital nature and real-world payment scenarios where internet connectivity cannot be guaranteed.
How it's made
Challenges we ran into Major BLE Challenges & Solutions 1. Android BLE Advertising Limitations Problem: Android's BLE advertising is severely restricted - apps cannot advertise as peripherals in the background, and the advertising API is limited. Evidence in Code: // From BluetoothManager.ts if (Platform.OS !== 'android') { console.log('[BLE] Non-Android platform detected, using fallback advertising'); await this.startFallbackAdvertising(paymentData); return { success: true }; } Solution: Implemented a hybrid approach using tp-rn-ble-advertiser library with fallback mechanisms and retry logic. Android Permission Hell Problem: Android 12+ requires multiple Bluetooth permissions that are often denied or need manual settings intervention. Evidence in Code: // Complex permission handling with detailed feedback const criticalPermissionStatus = await this.hasCriticalPermissions(); if (!criticalPermissionStatus.granted) { const missingPermissions = criticalPermissionStatus.missing.map(perm => { switch (perm) { case PermissionsAndroid.PERMISSIONS.BLUETOOTH_SCAN: return 'Bluetooth Scan'; case PermissionsAndroid.PERMISSIONS.BLUETOOTH_CONNECT: return 'Bluetooth Connect'; case PermissionsAndroid.PERMISSIONS.BLUETOOTH_ADVERTISE: return 'Bluetooth Advertise'; default: return perm; } }); } Solution: Created comprehensive permission management with user-friendly error messages and settings redirects. Rust BLE Implementation Challenges Problem: The Rust wallet core couldn't implement full BLE functionality due to platform limitations. Evidence in Code: // From wallet-core/src/core/ble/mod.rs #[cfg(target_os = "android")] { return Err(WalletError::ble("BLE functionality is not yet implemented for Android (JNI required for Adapter::new)".to_string())); } Solution: Moved BLE implementation to React Native layer while keeping cryptographic operations in Rust. Advertising Retry Logic Problem: BLE advertising often fails on first attempt due to timing or state issues. Evidence in Code: // Retry mechanism with exponential backoff private async startAdvertisingWithRetry(advertisingMessage: string): Promise<void> { const maxRetries = 3; let lastError: Error | null = null; for (let attempt = 1; attempt <= maxRetries; attempt++) { try { this.advertiser.startBroadcast(advertisingMessage); await new Promise(resolve => setTimeout(resolve, 1000)); this.isAdvertising = true; return; } catch (error) { if (attempt < maxRetries) { await new Promise(resolve => setTimeout(resolve, 2000)); } } } } Solution: Implemented robust retry logic with proper error handling and state management. Cross-Platform Compatibility Problem: BLE behavior differs significantly between iOS and Android, requiring platform-specific implementations. Evidence in Code: // Platform-specific initialization if (Platform.OS === 'android') { console.log('[BLE] Initializing ReactNativeBleAdvertiser for Android...'); this.initializeBleAdvertiser(); } Solution: Created platform-agnostic interfaces with platform-specific implementations and fallbacks. State Management Complexity Problem: BLE state changes are asynchronous and can cause race conditions. Evidence in Code: // State change listener with proper handling this.stateSubscription = this.manager.onStateChange((state) => { console.log('[BLE] State changed:', state); if (state === State.PoweredOn) { this.bleAvailable = true; } else { this.bleAvailable = false; } }, true); Solution: Implemented proper state management with listeners and connection tracking. Key Lessons Learned Android BLE is fundamentally broken for app-to-app communication Permission handling requires extensive user guidance Retry logic is essential for BLE operations Platform-specific code is unavoidable for BLE Graceful degradation is crucial when BLE fails State management must handle asynchronous BLE events properly