How a like burns WAIFU
On WaifuCash a like costs a tiny amount of WAIFU, and most of that amount is destroyed. This page explains how that works under the hood: what happens in the database at the moment of the like, who is paid when the artwork sells, and how the burn reaches the Solana chain. The project is small and early, and the last section says where this design is weaker than it sounds.
Why a like is not a Solana transaction
A free like is a signal anyone can fake with a script. A like that costs something, and destroys most of what it costs, means someone gave something up. The obvious way to build it is one transaction per like, and that fails for three reasons.
- A like costs 0.00003 USD. The network fee for a transaction is larger than the like itself.
- Every like would need a wallet signature. Nobody approves a popup to like a picture.
- A failed transaction leaves a like that may or may not exist.
So the like is recorded in our database, and the chain is settled in batches. Everything below is about keeping that split honest.
One like, one database transaction
The like endpoint does all of its writes inside a single SQL transaction. Simplified:
START TRANSACTION;
SELECT reward_balance FROM users WHERE id = :user FOR UPDATE;
-- the daily cap is checked again here, after the row lock
SELECT count FROM like_daily_counts
WHERE user_id = :user AND like_date = CURDATE();
UPDATE users SET balance = balance - :cost
WHERE id = :user AND balance >= :cost;
INSERT INTO burns (burn_type, amount, burn_address)
VALUES ('usage', :cost * 0.70, 'pending-batch');
INSERT INTO like_shares (item_id, user_id, like_order, share_weight)
VALUES (:item, :user, :order, :share_weight);
INSERT INTO royalty_pool (item_id, pool)
VALUES (:item, :cost * 0.30)
ON DUPLICATE KEY UPDATE pool = pool + VALUES(pool);
COMMIT;
The daily cap is checked twice. Each account has two votes per day. The first check runs before the transaction and gives a fast, friendly error. Two requests sent at the same instant both pass it. The second check runs after the user row is locked, so the second request waits, sees the count left by the first and stops.
Every write is checked. Our database driver returns false on a failed statement instead of raising an error. Until July 2026 a failed write to the burn ledger could commit together with a successful balance deduction: the user paid and nothing was scheduled to burn. Now each statement fails loudly and the whole like rolls back.
The price is fixed in USD, not in tokens. The cost is converted at the live price on each request. If the price feed is down the endpoint answers with an error and charges nothing. A stale price would be worse than no like.
70 percent burned, 30 percent to the people who liked first
Of each like, 70 percent goes to the burn ledger and 30 percent to a pool that belongs to that artwork. When the artwork is later sold, part of the sale fee is paid to the people who liked it, in proportion to a share weight set by the order of their like.
| Like order on the artwork | Share weight |
|---|---|
| 1 to 100 | 3.0 |
| 101 to 500 | 2.0 |
| After 500 | 1.0 |
The order is stored with the like, so the payout job never has to reconstruct history. It reads the sale, adds up the share weights for the artwork and credits each liker the fee multiplied by their weight and divided by the total weight. Payouts go to balances on the platform, which can be withdrawn.
The sale fee is 2.001 percent, split in three equal parts: treasury, burn and likers. The seller keeps the rest. There is no separate creator royalty on resales today.
The leak we almost shipped
Users can earn WAIFU from daily quests. Those tokens are a promise from us, not tokens that someone deposited. If a like paid with quest rewards sent 30 percent to the pool, and the pool pays into balances that can be withdrawn, we would have built a machine that turns promises into withdrawals.
So the endpoint has two funding paths.
- Paid from deposited WAIFU: 70 percent burn, 30 percent pool, and the liker gets a share in the artwork.
- Paid from quest rewards: 100 percent burn, nothing to the pool, no share recorded.
The second path only destroys a liability. It can never create a claim. Quest rewards are spent first, so a new user can vote without depositing, and should know that those votes do not earn a share.
Settling on chain, once a week
Rows in the burn ledger start as pending, with no transaction signature. Every Sunday at 20:00 UTC a job does this, with a retry on Wednesday if Sunday failed.
- Start from the baseThe weekly burn begins with a fixed 2,500,000 WAIFU from the burn reserve.
- Add pending rows, oldest firstMarketplace and usage burns are added until the total would pass the weekly cap of 5,000,000. Rows that do not fit wait for the next week.
- Burn for realOne SPL burn instruction is sent from the burn reserve wallet. Total supply drops. It is not a transfer to a dead address.
- CompareThe amount the burner reports must equal the amount the selected rows add up to. If they differ, nothing is recorded and an alarm goes out.
- RecordOnly then, in one database transaction, the weekly burn is written with its signature and the selected rows are marked as settled in it.
The cap exists so that a bug or an attack on the like endpoint cannot make the job burn an unbounded amount. The comparison step came from a real near miss: the burner keeps a short memory of recent requests, and a rerun inside that window could have returned the answer of an earlier, smaller burn. The rule we hold on to is that the amount burned is never smaller than the amount settled.
If the transaction fails, the rows stay pending and are picked up again. If the database write fails after a confirmed burn, we have burned without recording it. That needs a person to fix, but it is the safe direction to be wrong.
What this design does not give you
- It is custodial. Balances on the platform live in our database. The weekly burn can be verified on chain; an individual like cannot.
- The burn happens weekly, not at the moment of the like. When the like response says burned, it means scheduled to burn.
- Someone has to trust that the ledger and the chain match. The chain is the authority. Our ledger has trailed it before, when early manual burns were never imported, so anyone checking should compare against the total supply on chain, not against our numbers.
WAIFU is a small, volatile token with modest liquidity, and nothing here is financial advice. See About for the risks and who runs the project.