Truebasis
System Concept
Truebasis was created to address a primary challenge in Web3 financial tracking: the accurate calculation of token cost basis and unrealized capital gains. Rather than relying on simple snapshot balances, Truebasis reconstructs a precise double-entry transaction ledger chronologically from address histories, determining cost-basis using First-In, First-Out (FIFO) tax rules.

The project is structured around a decoupled architecture. The NestJS backend manages blockchain transaction ingestion, ledger reconstruction, caching, and rate limiting. The Next.js frontend delivers a premium responsive dashboard showcasing detailed asset breakdown tables, wallet grouping cards, and active tax-lot positions.
FIFO Replay Engine
Truebasis determines cost basis dynamically by chronological transaction-ledger replay instead of static balance points. During synchronization, the core engine fetches address histories from Zerion, filters spam or airdrop scam tokens, and replays each transfer in block order.
When an inbound credit is processed, the engine pushes a new lot onto an in-memory FIFO stack, storing the precise quantity, unit price, date, and transaction hash. Outbound debits consume lots from the bottom of the stack (oldest first). If an outbound transfer targets another user-owned wallet, the engine performs a cost-basis preservation split, replicating the consumed lot in the recipient's wallet at its original acquisition price.
DeFi Position Modeling
Tracking DeFi positions (staking pools, yield aggregators, and AMM pools) requires decomposing complex tokens. Truebasis monitors rebasing stakes (like stETH) and reward-bearing tokens (like rETH) to update quantities dynamically. Interest harvested from lending positions is integrated as zero-cost CREDIT entries, updating the average cost basis automatically.
Liquidity pools are modeled dynamically. Depositing tokens into a pool is recorded as a trade (SWAP) of constituent assets for LP shares. Redeeming is mapped as a debit of the LP tokens and credit of the returned tokens, calculating gains or losses against the LP share acquisition cost.
Web3 Auth Roadmap (SIWE)
To supplement standard email and GitHub OAuth credentials, the integration spec introduces Sign-In with Ethereum (SIWE - ERC-4361). This provides cryptographic session authentication, letting users sign in securely via browser-injected private keys.
Interactive FIFO Sandbox
Interact with the live simulator below to explore the core FIFO replay engine and cryptographic SIWE flow in real-time. Toggle between tabs, add manual buys/sells/transfers, and trigger step-by-step walk-throughs to see how lots are processed.
Milestones
NestJS Modular Backend API Setup|Backend
Apr 2026Genesis Sync & FIFO Stack Rebuild Engine|Backend/Database
May 2026Dynamic DeFi Staking & LP Calculation|Protocol API
May 2026Hardhat Ethers Simulation Harness Deploy|Simulation
Jun 2026Interactive Next.js Dashboard Frontend|Frontend/Design
Jun 2026Closing Thoughts
Truebasis serves as a robust foundation for automated tax lot accounting. The roadmap includes implementing the Sign-In with Ethereum (SIWE) standard for cryptographic credentials, enabling users to log in directly via browser extension private keys.