When we introduced the Secret Fund feature in FinLedger v2.0, it was designed with a simple mental model:
"A user wants a hidden digital envelope to stash some emergency cash."
In that initial release, the vault only supported a single, generic account archetype: a basic liquid savings bucket. You could deposit money, withdraw money, and view a balance.
However, once users started testing the feature in the real world, their feedback quickly proved that our initial assumption was far too narrow.
Emergency reserves are not just loose cash in a digital envelope:
- Some users keep an emergency reserve in a dedicated secondary bank account.
- Others maintain a secret physical cash stash in a home safe.
- Others hold an emergency Fixed Deposit (FD) with an agreed maturity date.
- Others maintain a secondary emergency credit card with a high credit limit, reserved exclusively for medical crises.
If a financial vault can only track simple cash deposits, it fails to represent real-world emergency solvency.
In FinLedger v2.1.1 (commit fc79363), we undertook a major architectural expansion: Expanding the Secret Fund to support all 7 financial account archetypes (VaultAccountType.kt, VaultLedgerEngine.kt).
Here is how we brought full double-entry multi-asset ledger mathematics into an isolated, encrypted vault.
The 7 Account Archetypes in the Vault
flowchart TD subgraph MultiAssetVault["The 7 Vault Account Archetypes"] direction TB subgraph LiquidAssets["Liquid Assets (Spendable Reserves)"] A1["1. Cash: Physical cash stashes"] A2["2. Bank: Dedicated emergency checking accounts"] A3["3. UPI: Discreet virtual payment handles"] A4["4. Wallets: Digital prepaid balances"] end subgraph IlliquidAssets["Illiquid Assets (Long-Term Reserves)"] A5["5. Fixed Deposits: Time-locked term deposits with maturity"] A6["6. Investments: Emergency gold, mutual funds, or liquid bonds"] end subgraph Liabilities["Liabilities (Emergency Credit)"] A7["7. Credit Cards: Standby credit limits & outstanding balances"] end end By expanding the vault to mirror all seven account types supported by the main application, users can model their true emergency net worth with complete accuracy.
The Architectural Challenge: Double-Entry Math in an Isolated Sandbox
Supporting credit cards and investments inside a secret vault is far more complex than tracking cash.
Consider what happens when you add a credit card to the vault:
- A credit card is not an asset; it is a revolving liability.
- Swiping a vault credit card increases your liability, reducing your vault net worth.
- Making a card payment from your vault checking account is an internal transfer that settles credit card debt without altering your operational cash flow.
Because the Secret Vault operates in complete isolation from the public ledger, we could not simply reuse the public ViewModels or database tables.
In VaultLedgerEngine.kt, we implemented an isolated mirror of our double-entry accounting kernel:
flowchart TD subgraph VaultAccountingKernel["Vault Double-Entry Ledger Engine"] Accounts["Vault Accounts Collection (7 Archetypes)"] --> Engine["VaultLedgerEngine.kt"] Transactions["Vault Transactions Collection"] --> Engine Engine --> Metric1["Liquid Spendable Reserve: Cash + Bank + UPI + Wallets (Immediately accessible for emergencies)"] Engine --> Metric2["Illiquid Reserves: Fixed Deposits + Liquid Investments"] Engine --> Metric3["Vault Liabilities: Emergency Credit Card Outstanding Debt"] Metric1 --> NetWorthCalc["Vault Net Worth = (Liquid + Illiquid) - Liabilities"] Metric2 --> NetWorthCalc Metric3 --> NetWorthCalc end 1. Liquid Reserves vs Illiquid Fixed Deposits
Just like in the master ledger, the vault separates immediate spendable liquidity from time-locked assets:
- If you have Rs. 50,000 in a vault checking account and Rs. 2,00,000 locked in an emergency Fixed Deposit, your Available Emergency Cash is Rs. 50,000.
- The UI clearly distinguishes between funds that can be spent today and assets that require breaking a deposit.
2. Credit Card Liability Tracking
If you have an emergency credit card inside the vault:
- You track your credit limit (e.g., Rs. 1,50,000) and your outstanding balance.
- If you swipe Rs. 20,000 for emergency car repairs, the vault records a liability increase.
- Your vault net worth decreases by Rs. 20,000, reflecting the debt obligation.
3. Internal Vault Transfers
Moving money between accounts inside the vault (such as moving Rs. 10,000 from your vault bank account to pay off your vault credit card, or depositing cash into your vault checking account) executes as an internal vault transfer:
- Source account decreases.
- Destination account increases.
- Zero impact on vault income or expense totals.
Strict Parity with Zero Code Duplication
To ensure that financial calculations inside the vault are just as reliable as the public ledger:
-
VaultLedgerEngine.ktuses the exact same posting rules and floating-point precision bounds (0.001rupees) asLedgerEngine.kt. - The engine is tested by 15 dedicated automated unit test suites in
VaultLedgerEngineTest.kt. - Every edge case—from credit card overpayments to partial Fixed Deposit liquidations—is verified by automated assertions.
Key Takeaway
Emergency preparedness looks different for everyone.
Some people rely on cash envelopes; others rely on dedicated bank accounts, fixed deposits, or emergency credit cards. By expanding FinLedger's Secret Vault to support all seven account archetypes with complete double-entry mathematical rigor, we ensure that your private financial safety net reflects your real-world economic resilience.
FinLedger is a privacy-first, offline-first personal finance application for Android that models bank accounts, credit cards, and cash without double-counting.
Explore FinLedger on Google Play: https://play.google.com/store/apps/details?id=com.devanshufinance.app




