Skip to content

[Demo] validation: remove AssumeUTXO - #36598

Draft
l0rinc wants to merge 35 commits into
bitcoin:masterfrom
l0rinc:l0rinc/remove-assumeutxo
Draft

l0rinc wants to merge 35 commits into
bitcoin:masterfrom
l0rinc:l0rinc/remove-assumeutxo

Conversation

@l0rinc

@l0rinc l0rinc commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Draft demo: this is meant to showcase what complete AssumeUTXO removal could look like and the simplifications that AssumeUTXO currently prevents.
The decision about complete removal is of course still open. This draft is meant to serve as a concrete reference for the smaller proposals below - it's not meant to be merged.

Smaller PRs: I will carve out individual changes to gauge interest in each part, and link them here as they are opened.
Some of the findings are useful even if snapshot loading or background validation stays.
Feedback on which parts seem worth pursuing, and in which order, is welcome.

Motivation: this follows our in-person discussion at the October 2026 Core Dev meeting.
My impression was that there was rough agreement about the ambiguity background validation introduces: we trust a snapshot enough to use it immediately, but describe that trust as temporary until the same node finishes checking history.

Multiple chainstates affect much more than snapshot loading: ordinary validation changes have to account for different chainstate roles, candidate sets, notifications, downloads, pruning, cache allocation, database lifetimes and locks.
I am not sure this amount of complexity in the most critical part of our codebase is still worth it, given that adoption isn't where we hoped it would be.
Ordinary IBD is also getting faster: #35295 is already merged, and the upcoming pruneassumevalid will make pruned IBD even faster.

Snapshot bootstrapping without background validation can still offer an advantage: a new node becomes usable before ordinary IBD would finish because snapshot loading time scales with the UTXO set size, while ordinary IBD time scales with the blockchain size.
Whether that is worth its maintenance cost is a fair question, and we can discuss it here or in the dedicated PR where I will propose the removal.
Even after removal, we could decide to add it back in a cleaner way, for example isolated through IPC.
This demo makes that cost, and the code we could remove, visible for that discussion.

Background validation can be considered separately: if we keep snapshot loading, I would prefer making its trust assumption explicit and distributing verification across ordinary IBD nodes, as proposed in #32377 and #36543.
That could give us wider independent checking of the commitment without making every snapshot user maintain a second chainstate.

Users who want to validate history themselves and transition to an archival node could rebuild with -reindex and pruning disabled.
Alternatively, they could run IBD in a separate datadir while their snapshot node remains usable, then switch once it is ready.
@Sjors's #36557 discusses dropping mandatory background sync and these alternatives.

What the series demonstrates:

  • After the fixture cleanup in test: avoid reusing AssumeUTXO coin insertion method in test fixtures #36601, the next eight commits remove background validation while snapshot loading keeps working, a stopping point that can be reviewed on its own.
  • The middle commits remove snapshot imports and startup resumption, then the validation, block storage, notification and release-process special cases they needed.
  • The final seven commits add the simplifications this removal enables: startup in one pass, stable database ownership, one download path, a single prune height, and removal of the locks and diagnostics used to select and identify chainstates.

Ordinary validation, -assumevalid, pruning, ChainstateManager and UTXO export (dumptxoutset) remain.

Related work:

@DrahtBot

DrahtBot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

External sites

Reviews

See the guideline and AI policy for information on the review process.

Type Reviewers
Concept NACK Sjors
Concept ACK ismaelsadeeq, instagibbs, sedited, willcl-ark, stickies-v, nervana21, danielabrozzoni, optout21

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #36990 (test: replace hard-coded RPC error codes by l0rinc)
  • #36946 (scripted-diff: [test] Add util/check.h includes for assertions by maflcko)
  • #36904 (log: Remove trailing and embedded newlines from log messages by maflcko)
  • #36876 (GUARDED_BY annotations for nTx, m_chain_tx_count by Crypt-iQ)
  • #36858 (refactor: break the blockstorage/validation circular dependency by pzafonte)
  • #36856 (kernel: add manual pruning by pzafonte)
  • #36854 (kernel: let callers create the block manager by pzafonte)
  • #36844 (iwyu: Fix warnings in more modules in src/ and treat them as errors by hebasto)
  • #36827 (test: Kill validation mutants by Zeegaths)
  • #36808 (iwyu: Fix warnings in src/test/fuzz and treat them as errors by hebasto)
  • #36790 (p2p: ignore historical blocks when counting blocks in flight by sashaphmn)
  • #36778 (AssumeUTXO: replace loadtxoutset RPC with a startup arg by l0rinc)
  • #36768 (kernel: Dispatch log callbacks with btcsignals by ryanofsky)
  • #36739 (refactor: pass BlockManager to ChainstateManager by pzafonte)
  • #36738 (refactor: move block writes and pruning into BlockManager by pzafonte)
  • #36735 (validation: delete pruned files after a failed flush by pzafonte)
  • #36702 (validation: don't treat snapshot block as linked on startup by shuv-amp)
  • #36629 (Add output script index and corresponding script history RPC by andrewtoth)
  • #36621 (node: batch block file pruning in a single pass over block index by mutatrum)
  • #36603 (Improve loadtxoutset performance by ajtowns)
  • #36543 (validation: check the most recent AssumeUTXO commitment during IBD by l0rinc)
  • #36542 (AssumeUTXO: allow retrying loadtxoutset after an interrupted load by l0rinc)
  • #36520 (interfaces: Avoid node crashes from invalid Chain IPC calls by ryanofsky)
  • #36503 (rpc: reject AssumeUTXO rollback without tip data by l0rinc)
  • #36500 (AssumeUTXO: reject duplicate coins and empty snapshot groups by l0rinc)
  • #36452 (validation: fix false corruption errors after pruning or AssumeUTXO by l0rinc)
  • #36372 (p2p: replace full outbound peers that don't support tx relay (take 2) by fjahr)
  • #36346 (validation: don't accept txs to the mempool while loading a snapshot by 0xShadowX)
  • #36326 (kernel: Use typed errors for fatal and flush error notifications by arejula27)
  • #36257 (qa: assert_equal -> assert_true/assert_false by hodlinator)
  • #36220 (rpc: report background validation progress in getchainstates by arejula27)
  • #36167 (build: Enable -Wunused by fanquake)
  • #36149 (validation: Leave some pruned blocks in m_blocks_unlinked, fix another nSequenceId issue by mzumsande)
  • #36114 (wallet: harden external signer psbt processing, revamp mock by Sjors)
  • #36042 (build: Bump g++ minimum supported version to 13 by maflcko)
  • #36000 (validation: prefetch blocks while connecting by l0rinc)
  • #35731 (Indexes: Harden the flush-error notification invariant by arejula27)
  • #35591 ([DO NOT MERGE] Erlay: bandwidth-efficient transaction relay protocol (Full implementation) by sr-gi)
  • #35557 (kernel, validation: Add btck_chainstate_manager_set_clock_time by ryanofsky)
  • #35522 (refactor: Extract per-message helpers from SendMessages() (move-only) by pablomartin4btc)
  • #35229 (refactor: Use CBlockIndex parameters as reference by optout21)
  • #35003 (validation: improve block data I/O error handling in P2P paths by furszy)
  • #34864 (coins: tighten cache entry state invariants by l0rinc)
  • #34778 (logging: rewrite macros to enforce restrictions at compile-time, improve efficiency and usability by ryanofsky)
  • #34775 (kernel: allow only one global logging connection by stickies-v)
  • #34534 (rpc: Manual prune lock management (Take 2) by fjahr)
  • #34360 (bench: add WalletBalanceManySpent for high-history wallet scenario by w0xlt)
  • #33324 (blocks: add resumable reobfuscation for existing block files by l0rinc)
  • #32468 (rpc: generateblock to allow multiple outputs with custom payouts by polespinasa)
  • #29256 (log, refactor: Allow log macros to accept context arguments by ryanofsky)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

LLM Linter (✨ experimental)

Possible places where comparison-specific test macros should replace generic comparisons:

  • src/test/kernel/test_kernel.cpp: BOOST_CHECK_THROW((ChainMan{context, chainman_opts}), std::runtime_error) → Prefer BOOST_CHECK_EXCEPTION with a predicate that checks the expected error message.
  • test/functional/feature_init.py: assert marker.read_bytes() == bytes(32) → assert_equal(marker.read_bytes(), bytes(32)).
  • test/functional/feature_init.py: assert index_files == {path.name: sha256sum_file(path) for path in index_dir.iterdir()} → assert_equal(index_files, {path.name: sha256sum_file(path) for path in index_dir.iterdir()}).

2026-11-27 11:19:58

@ismaelsadeeq

Copy link
Copy Markdown
Member

Concept ACK.

Following on from what we discussed in person: a feature-ready, usable assumeUTXO is with P2P utxo snapshot sharing, no background validation, and potentially on by default. I don't think it's a state we want to be in.
That variant of assumeUTXO trusts the whole money supply and UTXO set without ever reconstructing it. Making that the default new user experience, for the dominant full node implementation, is a shift in what running a node means, I'd rather we lean on fewer assumptions, e.g. even removing assumevalid as default.

If the feature-ready version lands and most new nodes come up from a snapshot and never pull the history, then over time the archival nodes thin out and validating/having the chain's history becomes something only a handful of nodes still do. Worst case, you can recover your funds but not the history. Pruning already nudges us that way (though it's not on by default, and most users only prune when they actually need to), but a snapshot default would speed it up. It's a bit of an extreme scenario, but I don't think it's an implausible state to be in, if the direction is future ready assumeUTXO.

And as discussed, as-is it's not even that usable, loading the snapshot takes too long. I remember giving up when trying it for the first time. (This can be fixed though)

I've also hit a maintenance cost directly. e.g. in #34075 we do block building, and query the tip which needs the chainstate, and multiple chainstates make that harder than it should be. Any node component that needs chainstate has no guarantee the chainstate it grabbed is still live, and the active one can get swapped under it, so you end up holding onto the chainstate manager and re-fetching the active chainstate every time instead of just keeping a stable handle. The last seven commits here show what you get back once this is gone.

I do think there's probably still a group of users who'd want assumeUTXO like snapshot bootstrapping. But I'd rather that live outside the dominant full node, libbitcoinkernel c header api should gives downstream projects a way to embed a ready UTXO set without risking a consensus split? and with LLMs now, that node-like projects can easily be vibe coded.

Snapshot loading scales with the UTXO set size while IBD scales with chain length indeed, so there is some argument on the linear growth concern and that #35295 and your pruneassumevalid idea don't fully close that gap for a new node that validates/semi validates the chain history, and that gap only grows as the chain gets longer.
That's a genuine advantage of assumeUTXO. But I don't think it's worth the complexity and assumptions it adds to the the reference implementation.

@l0rinc should we do it through the usual deprecate then remove style? Also thanks for putting the demo together, having the removable code and the simplifications it shows is nice to see.

@ariard

ariard commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

After the amount of time spent reviewing and testing assumeutxo, some folks might have a Stockholm syndroma removing assume utxo and me not the last...

More technically, it would has been possible to find an intermediary technical solution, where we would have kept the AssumeUTXO feature has an optional special build flag side-companion process available through a new ipc/capnp/sidevalidation.cpp. Somehow, the folks who wish to use AssumeUTXO would be able to do so, and this would ease diminish the maintenance burden for the libbitcoinkernel folks.

On a more usage level, I did share few ideas in the past on how to use AssumeUTXO for second-layers reputation systems, see here. Never been practical, though it would have been interesting for second-layers nodes, as they would have been able to join the system "on-the-fly" by leveraging assumeutxo activate chainstate.

@Sjors

Sjors commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

This draft is meant to serve as a concrete reference for the smaller proposals below - it's not meant to be merged.

This is fine and useful.

But to be clear, I'm concept NACK on actually removing AssumeUTXO.

I think we should drop background validation first, as I suggested in #36557. After that we can reconsider if code complexity is still too high.

@ismaelsadeeq wrote:

That variant of assumeUTXO trusts the whole money supply and UTXO set without ever reconstructing it. Making that the default new user experience, for the dominant full node implementation, is a shift in what running a node means, I'd rather we lean on fewer assumptions, e.g. even removing assumevalid as default.

(nit: the total supply can easily be checked against the issuance schedule. The distribution of the supply can't be checked.)

I don't think we should revisit -assumevalid in a discussion of removing AssumeUTXO, but it does raise an important point: we already allow users to skip part of validation and we even do it by default. And indeed perhaps we shouldn't, if the goal is to have every user verify everything even if they don't care and don't want to.

If the feature-ready version lands and most new nodes come up from a snapshot and never pull the history, then over time the archival nodes thin out and validating/having the chain's history becomes something only a handful of nodes still do.

Between the current reality of hardly anyone using AssumeUTXO, and the scenario you're describing, I think many decades will pass. By 2050 the blockchain might be 4 TB. The worst case UTXO set growth by then is 3+ TB, but at the current trend it might only be 35 GB.

100x less stuff to download (and process) creates a strong incentive for new users to use a client that does offer AssumeUTXO. It's a similar dynamic as with RBF: there's a limit to how far we can push against individual incentives to achieve network health. That goes for miner and for (non-miner) user incentives.

Also note that a user who didn't fully validate from genesis is still useful to the network if they provide mempool and (compact) block relay.

The big unpredictable factor here is Moore's law. In the optimistic scenario you'll download 4 TB in a few minutes in even the poorest and remote places on Earth. In a worst case scenario of technological regression, with a few quantum computers still surviving so we can't use compact signatures, everyone will just be using SPV or custodial wallets, because even after IBD keeping up with the chain would be too much.

@l0rinc wrote:

Even after removal, we could decide to add it back in a cleaner way, for example isolated through IPC.

I'm fine with refactoring things towards a cleaner approach, but it's not realistic to expect that if we remove this, it's going to come back. I'm also not convinced that the feature is so problematic that it needs to be temporarily removed. Even UPnP wasn't removed, merely disabled by default after the RCE vulnerabilities, but AssumeUTXO is already opt-in (and should stay that way).

@stickies-v

Copy link
Copy Markdown
Contributor

Concept ACK

Our validation code is the most critical we have. Having to reason about multiple chainstates is error-prone and a big mental tax on a lot of validation work. AssumeUTXO benefits those users who opt in to the feature just once, on first startup, but burdens everyone continuously with significant validation complexity they can't opt out of.

Moreover, while I think it is fine for users to make certain trust assumptions and trade-offs, I think it is important for this project to continue prioritizing the minimization of trust assumptions where we can.

@nervana21

Copy link
Copy Markdown
Contributor

Concept ACK

@danielabrozzoni

Copy link
Copy Markdown
Member

Concept ACK.

I was initially very excited when #35054 was opened. I really liked the idea of having a bitcoin node that could be quickly usable with little to no user interaction. However, various conversations with people, both here and in person, changed my mind.

The strongest argument for removing assumeutxo is that it complicates the validation code quite a bit, for little to no user adoption.

I can't comment much on the first point, other than that, anecdotally, I have spent some time reviewing PRs in the assumeutxo realm and doing some automated AI scans, and the code still seems a bit brittle around the edges to me. This comment from l0rinc #35054 (comment) points at the same problem: there have been many edge cases, and there still are, that required a lot of engineering time from us.

Regarding user adoption, none of us really has precise data, but we all seem to have a sense that adoption is little to none. My anecdotal experience is that the users I spoke to weren't even aware of assumeutxo. I think part of the problem is that users who want to connect their wallet to Core usually do it through an Electrum server, which requires either -txindex or the whole blockchain on disk. Neither is available until background validation finishes, so they don't get any upside from using assumeutxo.

I sometimes use assumeutxo, mostly when I need a node for testing and don't want to wait for it to exit IBD. As a user, I'd be a bit sad to see it go, but I think it's important that, as a project with limited resources, we use the engineering time we have efficiently, and assumeutxo doesn't seem to be the place for it.

@optout21

optout21 commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

I agree with most of the points of the above ~5 comments, and I don't want to repeat, and I have expressed my points in the background sync removal issue #36557.

The AssumeUTXO feature imposes a risk due to extra complexity, a risk unproportional to the usefulness and usage of the feature. (The extra complexity is largely a result of the need to support two chain states.) In the age of cheap LLM vulnerability scanners the feature-vs-simplicity balance is shifting towards simplicity.

What I would like to see:

  1. Remove the background sync part of Assume UTXO ASAP, reducing a large portion of extra complexity and tech debt (AssumeUTXO: drop background sync? #36557).
  2. Deprecate the full AssumeUTXO feature. This gives a clear signal to its users, and gives time to switch to alternatives. It also gives time to the development team to improve the alternatives, such as faster pruned IBD (pruneassumevalid: avoid downloading witnesses and writing blocks/undos during pruned assumevalid IBD #36476), and others. This is important, so that some users don't implement their own sub-optimal solution (e.g. own unverified UTXO set distribution).
  3. Remove the AssumeUTXO feature.

Concept ACK

@Sjors

Sjors commented Dec 3, 2026

Copy link
Copy Markdown
Member

It's useful to know if people have a preference for removing the whole thing, so I don't want to discourage that. But...

I still think we should only drop background sync. What's new: I think we can actually wait before adding p2p support.

@instagibbs wrote:

This is ongoing maintenance cost which means it shouldn't simply be ignored. We should complete the project, or cut our losses and harden the codebase we have left.

Those are the two extreme options, but my earlier point was that we should start with stripping the most problematic and least useful parts of the functionality, and then reconsider if we want to remove it completely.

My current impression is that removing background sync #36557 does a lot there. It's where most of the complexity sits, and removing it improves the user experience.

My prior is to doubt this, and all subsequent evidence has been one sided sadly. Node-in-a-box, as far as we know, continued what they've always done,

Start9 has support: https://github.com/Start9Labs/bitcoin-core-startos/blob/31.x/instructions.md#other-actions

RaspiBlitz is considering it, but not much movement: raspiblitz/raspiblitz#1178

Dropping background sync would also make it easier to support, since their software also wouldn't need to deal with two chain-states.

I don't think we need p2p support for node-in-box software. They could easily add torrent support.

@sedited wrote:

For setups where a third party, e.g. btcpayserver, already handles all their configuration, having to additionally trust this vendor with their snapshot seems like a totally fine trade-off to me.

BTCPayServer is open source too, so people can still verify that it relies on the assume-utxo hash rather than an arbitrary blob with a full data directory.

One thing we haven't seen yet is a proper node-on-a-phone. It wasn't practical before:

  1. the Kernel project, see e.g. https://github.com/Sjors/kernel-i-node for a prototype; or
  2. The QML GUI (which isn't ready yet)

Phones are different than raspberry pies, because you can't expect users to just leave the device in a corner for a few days, plugged in with the app in the foreground (iOs) while it completes IBD.

Without a way to skip historical block validation, running Bitcoin Core (or another kernel-based app) on a phone is likely never going to happen.

Most mobile apps share an xpub or use Electrum. Skipping historical sync in exchange for better privacy and eclipse attack resistance, may actually be good trade-off. Then they can use BIP-158 filters between sessions.

Phone apps can probably also use a torrent, so there too I think it's fine to hold off on adding p2p support until we see more usage.

All that said, AssumeUTXO for IBD + bip158 for steady state, might still not be good enough mobile UX. It may turn out that Utreexo / Floresta is the way forward for mobile. That also requires being able to skip historical block download, but only kernel would need to support it (and maybe not even that, if they maintain a fork of the kernel). The real pessimistic scenario is that Electrum over Tor is as good as it will ever get on mobile.

@ajtowns

ajtowns commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

I don't believe this is a good approach at all. There is obviously a very strong incentive to be able to spin up a new node quickly -- if it takes a day or a week between configuring a server and having it be able to follow the current tip, that's a major impediment to adoption. Assumeutxo provides a way of doing that figure in minutes: it reduces the amount of data to download by about 95%, and reduces the computational load similarly, even on relatively weak hardware.

Historical validation of the chain state is fundamentally a different job than "stand up a new node", and one that generally can take hours or days without causing a problem, provided it doesn't prevent you from standing up a new node. Linking the two tasks therefore encourages continual heavy optimisation of that code, often ones that are only beneficial during IBD. That seems to me a very risky tradeoff, in that any mistakes in the optimisations will impact live validation code. For example #37038 is a +800 LOC change that improves IBD from 2h25m to 2h22m on SSD, or to 8h14m on HDD or 8h/21h/54h on rpi in various configurations which seems to me to be measurable but not very meaningful, while introducing qualitative new risks via probabilistic primitives and more complex data structures.

I think the grand vision for the feature is too limited to actually be of general use. The current feature is incomplete, and not particularly fast, and is not a bandwidth saver either.

This feature was abandoned at the half-way point and has only recently been picked up for further development, so I've never found it surprising that it never got much use. Having done both the optimised load, and also the "skip bg download" part, I find this approach is much more appealing and convenient for spinning up new nodes than the current highly optimised IBD approach.

I'm not going to use the four-letter N-word here, but I think this is demonstrating fundamentally flawed development priorities.

@optout21

optout21 commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

it reduces the amount of data to download by about 95%

Nice to have a real argument here!
I'd zoom in on one aspect here. With all due respect, I don't think the quoted bit it true, due to background validation.
Could you clarify what's your stance on the background validation part of AssumeUTXO?
(less data to download until the node is up and later more / bg validation is an important part for trust level / nice to have but could be optional / not an important part / etc.).

@ajtowns

ajtowns commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

it reduces the amount of data to download by about 95%

Nice to have a real argument here! I'd zoom in on one aspect here. With all due respect, I don't think the quoted bit it true, due to background validation. Could you clarify what's your stance on the background validation part of AssumeUTXO?

With assumeutxo, the cost to stand up a new mainnet node to follow the tip and generate blocktemplates or act as a wallet is ~20 minutes of validation time, plus about 40GB of download. This is what I did in order to track the mainnet block for the testnet5 genesis mine -- much easier to justify spinning up a real mainnet node even for something pretty trivial when it only takes 20 minutes, than when it takes many hours or requires upgrading to a more expensive VPS.

Without assumeutxo, the cost to stand up a new mainnet node to do those things is however long IBD takes.

With or without assumeutxo, the cost to do IBD / full re-validation of the chain is about 700GB of download, plus some hours of CPU time. (Generating your own indexes is the same download, but could conceivably be less CPU, if undo data wasn't needed or was downloadable; for small indexes, an assumeindex mode would perhaps also be possible of course).

I would be tempted not to do background validation at all (ie, if you want to do IBD after spinning up via assumeutxo, just run a second node on the same system), but #37094 could be a better approach while remaining simple. I don't think the multi chainstate approach is a good one; but even very limited objections to that approach got rejected back in the day.

(less data to download until the node is up and later more / bg validation is an important part for trust level / nice to have but could be optional / not an important part / etc.).

I don't think the trust level is meaningfully different: if you're trusting that the developers didn't add code to insert fake utxos paying funds to themselves during IBD, you might as well trust them to include the correct utxo set hashes in the code. Calculating the utxo set hash via independent software protects against both sorts of bad behaviour. If you're reviewing the code, then the hashes are one of the more straightforward things to review (and could be an automatic part of IBD with #36543).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.