Skip to content

Run the proof verifier in the browser instead of on a server - #10

Merged
ulrichard merged 7 commits into
AminaBank:masterfrom
NiklasKoehler:feature/browser-only-wasm
Sep 18, 2026
Merged

ulrichard merged 7 commits into
AminaBank:masterfrom
NiklasKoehler:feature/browser-only-wasm

Conversation

@NiklasKoehler

Copy link
Copy Markdown
Contributor

Electrum needs a TCP socket a page cannot open, so the UTXO lookups moved to Esplora over HTTP. The server is configurable and defaults to Blockstream's public instances.

bitcoinconsensus is Bitcoin Core's script interpreter and therefore C++, so building it for wasm needs a C++ standard library for that target. build.sh borrows clang and libc++ from the wasi-sdk, but does not link wasi-libc: that would put a second allocator next to Rust's and add a WASI import surface the browser would have to fill in. src/csupport.rs backs libc++ with Rust's allocator instead, so the module imports nothing but its own glue.

Also fixes the confirmation depth, which was off by one. The block a UTXO is mined in counts as its first confirmation, so asking for three quietly required four.

Comment thread Cargo.toml Outdated
@ulrichard

Copy link
Copy Markdown
Member
grafik could you sign the commits?

@ulrichard

Copy link
Copy Markdown
Member

Thanks a lot for the contribution. This is how I imagined it from the beginning.

Electrum needs a TCP socket a page cannot open, so the UTXO lookups moved
to Esplora over HTTP. The server is configurable and defaults to
Blockstream's public instances.

bitcoinconsensus is Bitcoin Core's script interpreter and therefore C++,
so building it for wasm needs a C++ standard library for that target.
build.sh borrows clang and libc++ from the wasi-sdk, but does not link
wasi-libc: that would put a second allocator next to Rust's and add a
WASI import surface the browser would have to fill in. src/csupport.rs
backs libc++ with Rust's allocator instead, so the module imports nothing
but its own glue.

Also fixes the confirmation depth, which was off by one. The block a UTXO
is mined in counts as its first confirmation, so asking for three
quietly required four.
addr_of_mut! on a static mut needs an unsafe block on 1.78, which is
what CI tests as the MSRV, so the exception slot is an UnsafeCell now.
The fmt job only used nightly for format_code_in_doc_comments, which
nothing here relies on.

Also drops an unused dev-dependency, treats an emptied confirmations
field as the default rather than zero, and notes that build.sh fetches
Linux x86_64 tools.
The bdk_wallet 1.0 port went in as bitcoindevkit/bdk-reserves#39 and
shipped as 3.0.0, so there is no reason to pin a branch on a fork any
more. It pulls in bdk_wallet 3 and bitcoinconsensus 0.105, which checks
signatures with the script interpreter from Bitcoin Core 25.1.

bitcoinconsensus 0.105 does not use the libc crate, so the wasm-only
stand-in goes, and with it the Cargo.lock juggling in build.sh that only
existed to hide the patch. bdk_wallet 3 needs Rust 1.85, so that is the
MSRV now.
Logo and link as in bitcoindevkit/bdk-reserves. The example proof's
message still says SEBA: it is signed into the proof and cannot change.
LICENSE and the README both pointed at LICENSE-APACHE and LICENSE-MIT,
which were never in this repository. The log crate has had no callers
since the HTTP service went.
@NiklasKoehler
NiklasKoehler force-pushed the feature/browser-only-wasm branch from 01420c1 to 935087d Compare September 18, 2026 14:40
@ulrichard
ulrichard merged commit 3976eca into AminaBank:master Sep 18, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants