Design and Implementation of Baidu Transaction Middle‑Platform Asset System
The article presents the architecture, business scenarios, consistency mechanisms, double‑entry accounting, hotspot‑account handling, storage sharding, and regulatory compliance of Baidu's transaction middle‑platform asset system that supports C2C payments, virtual‑coin, cash, and asset services across dozens of products.
Baidu's Transaction Middle‑Platform Asset System is built on the Baidu Cashier and Transaction systems to consolidate and manage C‑end personal cash and virtual‑asset (e.g., virtual coins) business, providing a secure, reliable, and nationally compliant user‑asset management capability.
The system enables a C2C payment model where users can directly reward each other, addressing scenarios such as video‑content tipping and Q&A rewards that traditional B2C models cannot satisfy.
Three core asset types are supported: virtual‑coin, cash, and asset. Each type offers multi‑dimensional accounts (iOS, Android, recharge, gift, etc.) and common operations like recharge, consumption, refund, gifting, withdrawal, tax calculation, and cross‑business conversion.
To ensure data consistency, the system adopts a two‑pronged approach: payment‑level consistency through full‑parameter signature upgrades, and change‑level consistency via eventual consistency and data reconciliation using a reliable message queue.
Hotspot accounts—high‑concurrency accounts such as merchant or popular creator accounts—are handled by separating balance updates from detail inserts, marking details as “un‑summarized” and asynchronously aggregating them to compute the actual balance, with balances split into ledger, actual, and cache layers.
For accounting accuracy, a double‑entry bookkeeping model is employed, guaranteeing that every debit has a corresponding credit, supporting atomic operations, idempotent APIs, and detailed transaction trails.
Storage is sharded by user ID and business order number across 16 shards (1024 tables) to overcome MySQL single‑node limits; hotspot data is archived to cold‑storage tables, and Elasticsearch is used for real‑time, multi‑dimensional queries via binlog‑based synchronization.
The system complies with national financial regulations by introducing a personal‑registry scheme that registers individual user information with clearing‑licensed banks, enabling C2C settlements while meeting one‑clear (一清) requirements.
Overall, the asset system aims to support all Baidu payment scenarios, providing unified asset management, settlement, and payout capabilities, while continuously iterating to address emerging business challenges.
Architecture Digest
Focusing on Java backend development, covering application architecture from top-tier internet companies (high availability, high performance, high stability), big data, machine learning, Java architecture, and other popular fields.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.