Selling a Nervos DAO withdrawal: CKB now, no new script

A Nervos DAO deposit pays out at the end of the 180-epoch cycle in which its withdrawal request lands, with cycles counted from the deposit. Someone who needs their CKB early waits up to about 30 days. iCKB solves this for CKB deposited through iCKB, but an existing deposit cannot move into it.

We want to build a third option in the Cellula wallet: sell the withdrawal. The depositor gets CKB now, and the buyer claims the deposit when it matures. Before we build it, we would like to hear where this breaks.

How it works

Withdrawal phase 1 turns a deposit cell into a withdrawing cell. The DAO script lets that withdrawing cell use any lock (dao.c v0.5.4 L332-L334). Since 2023, nodes require it to have a lock of the same serialized size as the deposit’s, for deposits included at or after block 10,000,000 (RFC 0023, DaoScriptSizeVerifier). phroi found the issue that led to that rule.

So one transaction can:

  • spend the seller’s deposit cell and create the withdrawing cell under the buyer’s lock, at the same index;
  • spend the buyer’s CKB and pay the seller.

Both sign the same transaction. No new on-chain script is needed.

On testnet, both sides on secp256k1 locks: the buyer paid 995.89 CKB for a 1,000 CKB claim with a full cycle (about 30 days) left, about 5% a year (0xb376a515). The deposit was made 3 blocks earlier. A lock of another size is refused by the node: “The lock script size of deposit cell at index 0 does not match the withdrawing cell at the same index”.

Cellula wallet accounts can do it today with the wallet’s own lock, also on testnet: a full account sold a 300 CKB claim to another full account (0x85cf8e0c), and a starter address to another starter address (0x6bdaf749). The wallet app has no code for this yet.

The buyer’s claim, on a local dev chain with the same DAO binary as mainnet (ckb 0.210.0, 10-block epochs): after maturity the buyer got exactly the same compensation as a normal withdrawal from the same blocks. A claim one epoch early, and the seller trying to spend the cell, were both refused. The testnet claims above mature around 2026-12-04.

Price

At maturity the buyer receives the deposit plus the compensation up to the phase 1 block. The claim earns nothing after phase 1: dao.c takes the rate from the withdrawing cell’s own block. So:

  • the yield earned so far goes to the buyer on chain, and the price pays it back to the seller;
  • the yield for the days left is given up;
  • the discount is what the buyer earns for waiting.

Example: a 10,000 CKB deposit made 10 days ago is worth about 10,006 CKB at maturity, 20 days from now. A buyer who wants 5% a year pays about 9,979 CKB now and earns 27 CKB. Waiting the full cycle would have paid the seller about 10,017 CKB. The wallet would show both numbers.

How much it would be used

We measured mainnet withdrawals over the 158 days to 2026-11-04: 896 phase 1 withdrawals, 838.7M CKB. This leaves out the iCKB pool and a dCKB drain in August, the 205 cells whose lock changed at phase 1. Time from phase 1 to maturity:

Time to maturity Withdrawals CKB
under 1 day 276 138.5M
1 to 3 days 164 204.0M
3 to 7 days 163 221.8M
7 to 14 days 93 81.3M
14 to 21 days 69 129.4M
21 to 31 days 131 63.8M

About half (49% of withdrawals, 41% of the CKB) were within 3 days of maturity. About a third were more than a week away. So this is a small feature for people who need their CKB quickly, not a large market.

Credit and earlier objections

tianlitao proposed this in t/8956#7 (English in #8), as an extension of the instant convert service xxuejie described in #1. phroi answered that it is “not really viable” and listed the problems (#11, #15). Our answers:

  • Unbounded liquidity, a DoS with a huge deposit. Each quote is for one deposit, and each buyer sets the largest deposit it will take. A deposit nobody buys waits for its cycle, as today.
  • “What if the user deposited 4 years ago, is he not entitled to a part of his yield?” He keeps it: the yield earned so far is part of the price.
  • Deposits are NFTs, the user must choose one. The wallet shows each deposit with its time left and its price, and the user picks.
  • Same index for deposit and withdrawal, at most 64 outputs. One deposit per transaction, built by the wallet.

iCKB, and dCKB before it, already change the lock at phase 1 inside their own protocols. We found no service that buys single claims from users.

Traps and limits

  • Who signs last. Any spend of a deposit is a phase 1, so the seller cannot cancel cheaply, and a buyer holding a half-signed transaction could wait while the claim grows. So the buyer signs first and the seller signs last.
  • Cycle boundary. A signed transaction stays valid after the boundary (since is only a lower bound). If phase 1 lands after it, the claim moves to the next cycle, about 30 more days. So each quote has a deadline a few epochs before the boundary, and at the deadline the buyer spends, on chain, the input reserved for that quote, which voids it. Replace-by-fee is not enough: on a dev chain it replaced a sale that was pending or just proposed, but once the sale could be committed, the next block committed it anyway.
  • Quote spam. Each signed quote ties up one of the buyer’s cells, so a buyer limits open quotes per requester.
  • Lock sizes. A buyer needs a lock of the seller’s size, and one key can back several. Common sizes: 73 bytes (secp256k1, and multisig or ACP with 20-byte args), 75 (JoyID, Omnilock with 22-byte args, ACP with 22). Cellula wallet accounts are 75 bytes (starter addresses, the size of JoyID) or 85 bytes (full accounts, which sell to another full account). The buyer’s lock must also handle phase 2, which needs an absolute-epoch since.
  • What the buyer checks. The DAO type, all-zero deposit data, the output lock and the deposit block. dao.c checks the headers, so the seller cannot fake the claim.
  • No resale. A claim changes hands once: a withdrawing cell can only be spent in phase 2, after maturity. If the buyer loses its key, the claim is lost.
  • Fees and minimums. The buyer pays the fee. The payment to the seller is a normal cell: at least 61 CKB on secp256k1, a little more on bigger locks.
  • A rule that may change. The node’s code calls the lock-size check “a temporary solution till Nervos DAO script can be properly upgraded”. A future DAO script could forbid a new lock at phase 1, and this would stop working.
  • Voting. chenyukang’s ckb-treasury-lab#15 notes that withdrawing cells count as voting weight. We added there that a sale moves them, and supported counting deposits only.

Plan

  1. In the Cellula wallet, on testnet first: for each deposit, “CKB now” next to the value at maturity.
  2. Open offers: public, in an open format any wallet can read, so any buyer can answer, the iCKB bot included.
  3. No fee for us. The wallet only builds the transaction both sides sign. We do not buy claims, hold anyone’s CKB or take a side.

No funding is asked here. Does anyone see a flaw, or would you make offers?

6 Likes

Interesting approach. I like that this creates an option for existing DAO depositors to access liquidity without introducing a new script or requiring them to migrate into iCKB.

One question worth exploring is how the open-offer mechanism handles price discovery and buyer protection, especially around the cycle boundary where a transaction could push the claim into another 30-day cycle. Could a standardized quote format with clear expiry conditions help reduce that risk?

I think this could be a useful addition to the CKB ecosystem, particularly if different wallets and liquidity providers can participate without relying on a single intermediary.

3 Likes

Thanks, that is the plan, and we tested the cancel path before answering.

Price discovery. Quotes would be per deposit. The wallet would send the deposit’s out point to several buyers, each would answer with a price, and the wallet would show the best one next to the value at maturity. Quotes would be public, so anyone can compare them.

Buyer protection at the boundary. A CKB transaction has no expiry (since is only a lower bound), so the buyer has to enforce the deadline, not the chain. A quote would carry:

  • the deposit out point and the claim epoch it assumes;
  • the price and the seller’s payment lock;
  • valid_until, a few epochs before the cycle boundary;
  • the buyer’s signature, over a transaction that uses an input cell kept for that quote only.

At valid_until, if the sale is not on chain, the buyer spends that input on chain, which voids the quote. Our wallet would also refuse to send a sale after valid_until. The seller signs last, so a buyer cannot sit on a half-signed deal, and the buyer’s signature binds the price.

Tested on a local dev chain (ckb 0.210.0):

  • buyer first and seller last works without re-signing; a seller who changes the price after the buyer signed is refused;
  • a sale sent after the buyer spent its input is refused (TransactionFailedToResolve), and the deposit stays a deposit and can be quoted again;
  • replace-by-fee is not a safe cancel: it replaced a sale that was pending or just proposed, but once the sale could be committed, the next block committed it anyway, 4 times out of 4. We corrected that line in the post.

Standard format. That is what we mean by open offers. We would write a short spec next to the wallet code, so other wallets and liquidity providers can quote or accept without anyone in the middle.

2 Likes

Great idea @T_Silva, saw this by chance, feel free to tag me next time!

Once iCKB was rejected as mean for voting in both Community DAO and Treasury, I very seriously considered developing something similar.

My idea started from that until I realized that users can buy/sell those deposits without even withdrawing from them.

The biggest issues I see compared to iCKB is Liquidity:

  • Being able to use in protocols the capital locked up in NervosDAO deposits without withdrawing
  • Market Maker Liquidity needed to fully buy someone else deposit

Good luck :hugs:
Phroi

3 Likes

Thanks @phroi,

Agreed on both. A sold claim is not composable, and a buyer has to take the whole deposit, since deposits cannot be split. That is why each buyer sets the largest deposit it will take, and why we called it a small feature.

On buying and selling deposits without withdrawing, do you mean deposits made under a lock whose control can move, like a proxy lock owned by another cell? That keeps the yield and allows resale, but only for deposits made that way from the start. This sale is for deposits that already sit under a plain lock.

That route also matters for voting, it lets a deposit’s weight change hands without a withdrawal, so I added a note to ckb-treasury-lab#15.

1 Like

Came to mind a couple times back then, completely forgot until this thread, way too busy with everything else!! :rofl:

By the way, there are even easier way to get liquid voting. For example, a centralized intermediary holds the deposits and a user either:

  • Buy them in a platform, only for reselling them right after voting
  • Buy the right to vote with them for a particular vote

All this achieved with standard locks.

That’s yet another reason why voting with money doesn’t feel right to me :man_shrugging:

Phroi

PS:

Pretty easy to miss, @xjd @chenyukang let us know if this should be an issue on its own.

3 Likes

Thanks @phroi, and for pointing xjd and chenyukang at the note.

Agreed: no lock rule stops a custodian, or a market off chain, from renting votes. Deposit-only removes the cheapest route, the one that needs no trust: a claim bought and paid for in a single transaction.

What the weight should be is a bigger question than this thread. Ward only proves who controls a lock, so it works the same whether a platform weighs deposits, people or reputation. The binding side is here: t/11130 Let any wallet bind its Nervos DAO deposit on Metaforo .

2 Likes