-
Notifications
You must be signed in to change notification settings - Fork 12
Flowchart
Bitrequest edited this page Jan 31, 2026
·
4 revisions
This flowchart illustrates the Bitrequest web application architecture, focusing on blockchain payment monitoring, transaction matching, and real-time updates.
flowchart TD
%% Application Initialization
A["Index.html Loaded"] --> B["Load Config, Assets, Language Files, & Local Storage Data"]
B --> C["Initialize JS Libraries:<br/>• sjcl.js (Crypto primitives)<br/>• crypto_utils.js (secp256k1, hashing, encoding)<br/>• bip39_utils.js (HD wallet derivation)"]
C --> D["User Authentication / Pinlock Check"]
D --> E["Initialize Core Modules & Dashboard UI"]
%% Core Modules Setup
E --> F["Currency/Address Management Module"]
E --> G["Payment Processing Module"]
E --> H["Blockchain Payment Monitoring Module"]
E --> I["Socket & Polling Module"]
E --> J["Settings Module"]
%% Settings Flow
J --> K["Configure Settings:<br/>• Confirmations per coin<br/>• API keys & RPC nodes<br/>• Fiat currency (170+)<br/>• PIN & permissions<br/>• Backup (JSON/Google Drive)"]
K --> E
%% Currency/Address Management Flow
F --> L["Add/Manage Addresses"]
L --> L1["Manual Entry + QR Scan"]
L --> L2["BIP39 Seed Derivation:<br/>12/15/18/21/24 words"]
L --> L3["Extended Key Import:<br/>xpub, zpub, Ltub, dgub, kpub"]
L --> L4["Monero View Key Import"]
L --> L5["Lightning Node Connect:<br/>LND / LNbits / CLNRest"]
L1 --> M["Save to Local Storage"]
L2 --> M
L3 --> M
L4 --> M
L5 --> M
M --> N["Update Dashboard: Currencies Section"]
N --> O{"User Ready for<br/>Request Creation?"}
O -- Yes --> P
O -- No --> AA
%% Payment Request Creation Flow
G --> P["User Initiates Payment Request"]
P --> P1["Point of Sale Mode"]
P --> P2["Share Mode"]
P1 --> Q
P2 --> Q
Q["Select Currency & Address"]
Q --> Q1{"Currency Type?"}
Q1 -- "BTC/LTC/DOGE/DASH/BCH" --> R1["Standard UTXO Address"]
Q1 -- "Lightning" --> R2["Generate Invoice:<br/>BOLT11 / LNURL"]
Q1 -- "ETH/ERC20/L2" --> R3["EVM Address<br/>(Base/Arbitrum/Polygon/BSC)"]
Q1 -- "Monero" --> R4["Stealth Address +<br/>View Key for Scanning"]
Q1 -- "Kaspa" --> R5["Kaspa Address<br/>(40-bit bech32 checksum)"]
Q1 -- "Nano/Nimiq" --> R6["Native Address Format"]
R1 --> R
R2 --> R
R3 --> R
R4 --> R
R5 --> R
R6 --> R
R["Input Amount + Metadata:<br/>• Fiat or crypto amount<br/>• Title, description (BIP21)"]
R --> S["Real-Time Conversion:<br/>Fiat ↔ Crypto via cached rates<br/>(CMC/CoinPaprika/CoinGecko)"]
S --> T["Generate URI & QR Code"]
T --> T1{"Lightning?"}
T1 -- Yes --> T2["BOLT11/LNURL Invoice +<br/>NFC/Boltcard Support"]
T1 -- No --> T3["Standard URI:<br/>bitcoin:/ethereum:/kaspa:/etc."]
T2 --> U
T3 --> U
U["Share Request:<br/>• Device share dialog<br/>• URL shortening (Firebase/Bitly)<br/>• Display QR for POS"]
U --> V["Save Request to Local Storage"]
V --> W["Dashboard: Requests Section"]
%% Blockchain Monitoring Flow
H --> X["Open Monitoring Connection"]
X --> X1{"Connection Type?"}
X1 -- "WebSocket" --> X2["Real-time via:<br/>BlockCypher, mempool.space"]
X1 -- "Polling" --> X3["Interval polling via<br/>block explorers"]
X1 -- "Personal Node" --> X4["Direct RPC:<br/>Electrum, Infura, Alchemy"]
X1 -- "Lightning Node" --> X5["Invoice status via:<br/>LND/LNbits/CLNRest API"]
X1 -- "Monero Node" --> X6["View key scanning via:<br/>Remote node / LWS"]
X2 --> Y
X3 --> Y
X4 --> Y
X5 --> Y
X6 --> Y
W --> Z["Retrieve Next Open Request"]
Z --> Y["Monitor Address/Invoice"]
Y --> AB["Fetch Transaction Data +<br/>Historical Exchange Rates"]
%% Transaction Processing
AB --> AC["Display Transaction Info"]
AC --> AD["Match Transaction with Request:<br/>• Compare crypto amounts<br/>• Calculate fiat equivalent<br/>• Adjust for volatility window"]
AD --> AE{"Check Confirmations"}
AE -- "Instant (Lightning/Nano/Dash)" --> AF1["Instant Confirmation"]
AE -- "0-conf enabled" --> AF2["Zero-Conf Accept"]
AE -- "Meets threshold" --> AF3["Confirmed"]
AE -- "Below threshold" --> AG["Pending: Continue Monitoring"]
AE -- "No match" --> AH["No Match: Continue Scanning"]
AF1 --> AF
AF2 --> AF
AF3 --> AF
AF["Mark as Paid/Complete"]
AG --> AI
AH --> W
AF --> AI["Update UI:<br/>Instant feedback via WebSocket"]
AI --> AJ["Post-Payment Actions:<br/>• Generate receipt (PDF)<br/>• CSV export<br/>• Archive request"]
AJ --> AK["Update Dashboard: Archive Section"]
%% Loop or Idle
AK --> AL{"More Open Requests?"}
AL -- Yes --> W
AL -- No --> AA["Idle State"]
AA --> AA1["Await User Action:<br/>• New request<br/>• View details/history<br/>• Backup data<br/>• Team invite<br/>• Settings change"]
AA1 --> P
AA1 --> L
AA1 --> K
flowchart LR
subgraph "crypto_utils.js"
CU1["secp256k1<br/>Key Operations"]
CU2["Hash Functions<br/>SHA256, RIPEMD160,<br/>Keccak256"]
CU3["Address Encoding<br/>Base58, Bech32,<br/>CashAddr, Kaspa Bech32"]
CU4["WIF Encoding"]
end
subgraph "bip39_utils.js"
BU1["Mnemonic<br/>Generation/Validation"]
BU2["Seed Derivation<br/>PBKDF2"]
BU3["BIP32 HD Derivation<br/>m/44'/m/84' paths"]
BU4["Extended Keys<br/>xpub/zpub/kpub"]
end
CU1 --> BU3
CU2 --> BU2
CU3 --> BU4
| Currency | Path | Extended Key | Address Format |
|---|---|---|---|
| Bitcoin SegWit | m/84'/0'/0'/0/ | zpub | bc1q... |
| Bitcoin Legacy | m/44'/0'/0'/0/ | xpub | 1... |
| Litecoin SegWit | m/84'/2'/0'/0/ | zpub | ltc1q... |
| Litecoin Legacy | m/44'/2'/0'/0/ | Ltub | L... |
| Ethereum (+L2) | m/44'/60'/0'/0/ | xpub | 0x... |
| Kaspa | m/44'/111111'/0'/0/ | kpub | kaspa:q... |
| Dogecoin | m/44'/3'/0'/0/ | dgub | D... |
| Dash | m/44'/5'/0'/0/ | xpub | X... |
| Bitcoin Cash | m/44'/145'/0'/0/ | xpub | bitcoincash:q... |
| Currency | Primary Method | Fallback | Node Support |
|---|---|---|---|
| Bitcoin | WebSocket (mempool.space) | BlockCypher polling | Electrum |
| Lightning | LND/LNbits/CLNRest API | — | Direct connect |
| Ethereum | WebSocket (Alchemy) | Polling (Infura) | Custom RPC |
| L2 (Base/Arb/Poly) | Alchemy Enhanced API | Standard RPC | Custom RPC |
| Monero | View key scanning | — | Remote node, LWS |
| Kaspa | REST API polling | — | — |
| Litecoin | WebSocket | Polling | Electrum |
| Nano | WebSocket | Polling | — |
- Loads HTML, config, assets, and language files
- Initializes pure JavaScript crypto libraries (no WASM dependencies)
- Checks PIN/authentication before showing admin features
- Currency Management: Add addresses manually, from seed, or extended keys
- Payment Processing: Create requests with fiat-pegged amounts
- Blockchain Monitoring: Real-time transaction detection
- Settings: Confirmations, API keys, backup, permissions
- Supports multiple input methods per currency
- Special handling for Monero (view keys), Lightning (node connections), and Kaspa (kpub)
- Addresses stored locally with drag-drop priority ordering
- Currency-specific URI generation (bitcoin:, lightning:, kaspa:, etc.)
- Real-time fiat conversion with rate caching
- QR code generation with optional NFC/Boltcard for Lightning
- WebSocket for instant notifications (preferred)
- Polling fallback for reliability
- Personal node connections for privacy
- View key scanning for Monero privacy preservation
- Compares received amount against request
- Fetches historical rates for fiat accuracy
- Configurable confirmation thresholds (0-conf to 6+)
- Instant confirmation for Lightning, Nano, Dash InstantSend
- Receipt generation (PDF/shareable)
- CSV export for accounting
- Archive management
- Status persists in local storage
This flowchart visualizes the complete Bitrequest workflow from initialization through payment completion, highlighting the pure JavaScript architecture and multi-currency support.