CKB Pulse

All lessons · xUDT and tokens · Start here · Glossary

Full-balance UDT burn is valid for SUDT and plain xUDTWorkingFrom one fix

From one fix · Check: right · Checked 2026-11-19

Burning a UDT's entire balance is accepted by SUDT and xUDT without extensions, because those scripts allow output amount to be less than or equal to input amount. offckb removed a guard that rejected destroyAmount === totalBalance and now still emits a zero-balance type cell (16-byte zero amount), which is valid. Extension-enabled xUDT was not covered by this change.

Why it matters: A guard that rejects destroyAmount === totalBalance blocks a burn that sUDT and plain xUDT accept, so users cannot clear their full token balance and must leave at least one token behind.

Pattern

Avoid
if (destroyAmount === totalBalance) { throw new Error('Destroying the entire UDT balance may be rejected by the UDT script...

Taken from the commit, shortened.

A test changed in the same commit

It sits next to the fix. We did not run it.

Concepts
Transaction building and fees, Capacity and cell size
Evidence
From one fix: from one project, checked against its commit
First seen
2026-10-08
Last changed
2026-10-08
Last checked
2026-11-19
Check against the commit
right: the lesson follows from its commit and still holds in the code today

Sources (1)

More about xUDT and tokens

All 2 in this topic

Do you maintain a project this lesson came from? Confirm or correct it

Cite this lesson
LusoCryptoLabs, "Full-balance UDT burn is valid for SUDT and plain xUDT", CKB lessons, https://pulse.lusocryptolabs.com/learned/xudt/full-balance-udt-burn-is-valid-for-sudt-and-plain-xudt, CC BY 4.0, last changed 2026-10-08.

Drawn from public commits and checked against the commit each one came from and the project's code today. Read the source before you rely on one. Text under CC BY 4.0: credit LusoCryptoLabs, CKB lessons, with a link to the lesson. Want a lesson changed or removed? Open an issue.