B7 · module 5 of 6 · The Economy and the Bank
The economy and the bank.
Three currencies on separate paths, a wallet keyed by the player’s account that is the running total of a transactional ledger, and a per-game bank the pool funds and pays out from after a published rake.
Three dives: three currencies, the transactional wallet, and the bank, the pool, and the rake — the levers a prize economy is built from, in the open.
The three dives
each a leaf, the teachingThree currencies
The reference economy runs on three currencies, each with a different meaning. Keys are the paid currency: a player buys them with Telegram Stars and…
B7.5.2The transactional wallet
A player’s balances live in a wallet keyed by their USR account, one wallet per account across every room they play. The wallet is…
The bank, the pool, and the rake
Each game with a prize has a bank, a BNK escrow that holds its pool for the life of the game. In a paid room the pool is what the…
The module, in one law
codemojex · value, in the open and in balanceB7.5 is the economy: how value enters, moves, and is paid out without ever leaving the wallet unbalanced. Three currencies carry different meanings — keys are paid, bought with Telegram Stars and spent in paid rooms; clips are free and carry no value; diamonds are prizes, won from a game’s bank and convertible to keys at ten to one. Balances live in a wallet keyed by the USR account, and the wallet is the running total of a TXN ledger: every move is a debit and a credit applied together in one transaction, all-or-nothing, so a balance is never half-changed and the history is always there to audit. Each prize game holds a BNK escrow, a pool the all-pay attempts fund; the house takes a published rake, and at the close the remainder pays the top entrants as diamonds. The reference design draws the line at hidden house players winning prizes back from users, preferring transparent levers and leaving any house participation flagged for the chief architect and legal. Three dives: three currencies, the transactional wallet, and the bank, the pool, and the rake.
The doors
the sibling coursesEchoMQ — the protocol, in depth
The bus B3 narrates, taught rung by rung: the keyspace, the Lua inventory, and the 3.0 Stream Tier — XADD, XREADGROUP, XACK — with conformance on Valkey.
Redis Patterns Applied
The substrate patterns under the bus: sorted sets, atomic Lua moves, locks, and streams — the judgement layer.
/echo-persistenceEcho Persistence — the durable floor
Beneath the volatile tiers: the Graft page engine built twice, the commit-LSN loop, and the stream archive on Tigris. Where Part I says state lives somewhere, this says where it lives durably.
References
sources · relatedSources
- Helland — Life Beyond Distributed Transactions (CIDR 2007)a wallet and a bank as durable entities, the ledger as the record of truth
- Ecto.Multi — composable, single-transaction database operationsthe one transaction a debit and a credit are applied in together
- All-pay auctions — every bid is paid, the standings decide the prizethe bank a paid room’s attempts fund, a pool paid out after the rake
Related
- BCS — the course homethe law, the id anatomy, the chapter map
- Echo Persistencethe durable floor beneath the bus