HomeCase studiesMulti-Chain Cryptocurrency Portfolio Tracker with Real-Time Redis...

Case study · Tallinn, Estonia

Multi-Chain Cryptocurrency Portfolio Tracker with Real-Time Redis Valuation and Tax-Lot Accounting

Digital Asset Analytics & Tax Reporting

Active digital asset holders spread balances across hardware wallets, centralized exchanges, and multi-chain DeFi protocols, making accurate net-worth tracking and tax-lot reconciliation error-prone. Built for a digital asset analytics operation in Tallinn, we engineered a cryptocurrency portfolio tracker using TypeScript, Node.js, and Redis that unifies on-chain transfers and exchange fills into a deterministic ledger. Redis powers sub-second mark-to-market valuations and rate-limited RPC polling, while a strict fixed-point accounting engine calculates FIFO, LIFO, and weighted-average tax reports.

Industry
Digital Asset Analytics & Tax Reporting
Solution
A multi-chain web analytics and tax-accounting platform built on TypeScript, Node.js, and Redis for live wallet valuation, DeFi position tracking, and auditable cost-basis exports.
Platforms
Web & API
Stack
TypeScript · Node.js · Redis · Next.js · PostgreSQL · TimescaleDB
Location
Tallinn, Estonia · delivered remotely
Role
Engineering, with the team behind for mobile and QA

Delivered remotely for a business based in Tallinn, Estonia. Names withheld by agreement.

Project Overview

Digital asset ownership rarely lives in a single custody account. A typical investor in Tallinn holds Bitcoin across cold-storage UTXO addresses, stakes assets on Ethereum or Solana validators, provides concentrated liquidity in decentralized exchanges, and executes spot trades across multiple centralized venues. Standard spreadsheet trackers break down under 18-decimal token units, wrapped assets, cross-chain bridges, and overlapping exchange fee currencies.

We built a cryptocurrency portfolio tracker powered by TypeScript, Node.js, and Redis to turn fragmented on-chain and off-chain activity into one continuously valued, tax-reconciled ledger. The system ingests read-only wallet addresses and exchange API keys, streams real-time market valuations over WebSockets, and runs deterministic cost-basis calculations aligned with European digital asset reporting expectations.

Fragmented Asset Visibility

Building reliable crypto analytics requires solving data-integrity challenges that traditional equity trackers never encounter:

  • Token precision drift: Standard IEEE-754 floating-point math introduces silent dust errors across wei-scale quantities and micro-cap liquidity tokens.
  • Unmatched internal transfers: Moving assets from an exchange to a hardware wallet looks like a taxable sale unless outbound and inbound legs are paired across venues.
  • Noisy spam airdrops: Public EVM and Solana addresses accumulate malicious or worthless dust tokens that distort portfolio totals and chart scales unless filtered.
  • Heterogeneous rate limits: Aggregating dozens of RPC providers and exchange REST endpoints simultaneously without centralized coordination triggers IP bans and partial syncs.

Architectural Strategy

Our engineering approach separated fast ephemeral market state from immutable historical ledger truth. Live spot prices, order-book reference feeds, user session subscriptions, and distributed API rate limiters live inside Redis for low-latency in-memory coordination. Canonical transaction histories, transfer-matching overrides, and realized tax lots persist in PostgreSQL alongside TimescaleDB historical candle series.

By keeping TypeScript shared across the Node.js ingestion workers, WebSocket gateway, and Next.js frontend, exact schema definitions and arbitrary-precision serialization formats remain identical from blockchain RPC decoding down to browser table rendering.

Core Capabilities

  • Unified Multi-Chain & CEX Aggregation: Connects read-only exchange keys, EVM chains, Bitcoin XPUB descriptors, and Solana addresses into one normalized event stream.
  • Real-Time Mark-to-Market Streaming: Redis Pub/Sub pushes spot price ticks through a Node.js WebSocket layer, updating unrealized P&L and allocation weights without page reloads.
  • Smart Transfer & Bridge Pairing: Automatically links wallet-to-wallet movements, wrapped token conversions, and bridge exits to carry forward original cost basis.
  • DeFi Yield & Staking Accounting: Separates principal LP deposits, claimed rewards, and protocol gas fees so income events and capital disposals remain distinct.
  • Deterministic Tax-Lot Engine: Computes realized gains under FIFO, LIFO, HIFO, or specific-identification rules with point-in-time EUR/USD fiat conversion via TimescaleDB.

Technical Architecture

Ingestion begins when a user links an address or read-only exchange credential in Next.js. Node.js workers enqueue scoped backfill jobs onto Redis Streams, acquiring distributed token-bucket permits before querying RPC nodes or exchange endpoints. Raw payloads normalize into typed double-sided ledger movements (acquisition, disposal, fee, transfer, reward) stored in PostgreSQL.

Flow: Chain RPCs & CEX APIs → Node.js Rate-Limited Adapters (Redis Token Buckets) → Event Normalizer & Transfer Matcher → PostgreSQL Canonical Ledger + TimescaleDB FX/Candles → Redis Valuation Cache & Pub/Sub → Node.js WebSocket Gateway → Next.js Dashboard

Whenever the cost-basis worker replays a wallet's chronological event stream, it commits immutable lot-consumption rows and publishes a cache-invalidation signal via Redis. Connected Next.js clients receive fresh valuation vectors immediately while historical tax reports stream out asynchronously as verifiable CSV or PDF audit packets.

Technology Stack

Category Technology detail
Web Dashboard Next.js with TypeScript interactive holdings tables, allocation charts, and tax views
Ingestion & API Runtime Node.js and TypeScript services coordinating wallet syncs, exchange adapters, and REST APIs
Real-Time Cache & Bus Redis Pub/Sub, Streams, and Sorted Sets for live ticks, rate limits, and job queues
Ledger Storage PostgreSQL persisting canonical wallet events, cost-basis lots, and reconciliation rules
Historical Pricing TimescaleDB storing OHLCV candles and historical fiat FX rates for point-in-time cost basis
Live Streaming Node.js WebSocket gateway broadcasting Redis price deltas to subscribed browser sessions
Precision Arithmetic Arbitrary-precision Decimal/BigInt math avoiding IEEE-754 rounding drift across 18-decimal tokens
Chain & CEX Adapters Modular TypeScript connectors for EVM chains, Solana, Bitcoin UTXO, and read-only exchange APIs
Tax Export Engine Streaming CSV and PDF lot-disposition generators supporting FIFO, LIFO, and HIFO methods

Engineering Trade-offs & Solutions

Engineering Challenge Solution & Trade-off
Live market ticks across thousands of tokens saturate database reads Stored normalized latest prices and asset-to-user subscription indexes in Redis, reducing PostgreSQL reads to historical ledger queries at the expense of maintaining cache warm-up routines.
Out-of-order historical CSV imports invalidate downstream FIFO cost basis Designed an event-sourced lot-recomputation pipeline triggered per affected asset stream; importing old records replays only the impacted asset's lot queue rather than the entire account.
Malicious spam tokens clutter holdings and skew valuation charts Integrated Redis-cached token-reputation registries and liquidity-depth checks that quarantine unverified tokens from net-worth sums while keeping raw transactions inspectable.
Node.js single-threaded event loop stalls during large multi-year tax exports Offloaded heavy lot-matching and PDF/CSV streaming to isolated Node.js worker processes fed by Redis Streams, keeping the API and WebSocket gateway responsive under load.

Security & Read-Only Custody Boundaries

Portfolio trackers attract phishing and credential-stuffing pressure because they sit adjacent to user wealth. Every exchange integration enforces strictly read-only API permissions—rejecting keys with withdrawal or trade scopes during initial validation—and encrypts stored secrets using envelope encryption with per-tenant keys.

On-chain tracking requires only public addresses or extended public keys (xpub/zpub), guaranteeing private signing keys never touch application servers. Publicly shareable portfolio views use stripped projection payloads that mask exact wallet addresses and sensitive transaction hashes.

Throughput & Streaming Scale

During volatile market sessions, incoming price feed updates spike dramatically while users simultaneously trigger portfolio refreshes. Node.js price-aggregator processes coalesce rapid exchange ticker bursts inside Redis pipelines, publishing throttled state deltas over WebSockets so browser DOM reconciliation stays smooth.

Backfill jobs scale horizontally across worker containers consuming Redis Stream consumer groups. Each blockchain adapter isolates chain-specific retry policies and finality buffers, ensuring congestion on one network never delays valuation updates or tax calculations on another.

Operational Outcomes

Unifying real-time Redis state streaming with an exact TypeScript accounting ledger delivered dependable clarity for digital asset holders and tax professionals:

  • Consistent multi-venue visibility: Cold wallets, exchange balances, and active DeFi positions resolve into one continuously updated net-worth picture.
  • Exact decimal integrity: Arbitrary-precision arithmetic eliminates penny and dust discrepancies between transaction logs and annual tax exports.
  • Audit-ready tax trails: Every realized gain links back to specific acquisition timestamps, historical TimescaleDB FX rates, and matched transfer pairs.
  • Resilient sync execution: Distributed Redis rate limiting and consumer-group workers absorb high-volume wallet backfills without degrading live dashboard responsiveness.

01 — Questions

asked about this kind of project

Why use Redis alongside PostgreSQL instead of querying the database for live portfolio prices?

Crypto spot prices update continuously across dozens of quote pairs while users hold hundreds of distinct tokens. Redis caches latest tick maps and user-session valuation hashes in memory and fans out deltas over Pub/Sub, shielding PostgreSQL from repetitive read load during volatile market swings.

How does the TypeScript backend prevent floating-point rounding errors on 18-decimal ERC-20 tokens?

JavaScript native numbers lose precision well before 18 decimal places. All token quantities, gas fees, and fiat valuations are parsed straight from RPC/API strings into BigInt base units or arbitrary-precision Decimal objects, with PostgreSQL storing exact numeric columns rather than floats.

How do you handle blockchain reorganizations or pending transactions without corrupting tax lots?

Ingestion workers tag newly observed blocks as provisional until chain-specific finality thresholds pass. If a shallow reorg occurs, Redis-coordinated replay jobs roll back unconfirmed event batches cleanly before the deterministic cost-basis engine commits realized gain/loss lots.

How are self-transfers between a user's own hardware wallet and exchange distinguished from taxable disposals?

The reconciliation pipeline matches outbound transfers against inbound deposits sharing asset identity, timestamp windows, and fee tolerances across all wallets owned by the workspace. Matched pairs reclassify automatically as internal transfers, preserving original acquisition timestamps and cost basis.

How do you respect strict rate limits across heterogeneous exchange APIs and blockchain RPC nodes?

Every upstream provider shares a distributed Redis token-bucket limiter keyed by API credential or RPC endpoint. Background sync queues throttle burst imports automatically and prioritize active user sessions over historical backfill jobs.

03 — Similar project?

describe what is different about yours

Build yours.

Tell me what exists, what you need and the deadline. Fixed price for a defined scope, or $55/day (8–9 hours work) with a written plan first.

Solitaire Corporate Park, Makarba, Ahmedabad, Gujarat 380015, India · IST (UTC+5:30) · --:-- IST · Mon–Fri 09:00–18:00 IST · US & EU overlap daily

No newsletter, no CRM. Just a reply.