Repository navigation
Create privbcast tool, swap out in-node implementation for node-less driving - #5
Open
instagibbs wants to merge 27 commits into
Open
instagibbs wants to merge 27 commits into
instagibbs wants to merge 27 commits into
Conversation
instagibbs
force-pushed
the
privbcast-in-node
branch
14 times, most recently
from
September 28, 2026 18:58
9891ab1 to
f3439ca
Compare
A test_accept left the transaction's inputs in the coins cache and its signatures and scripts in the validation caches. That records, inside the node, that the transaction was validated before it was public, and a peer can probe it by timing a later submission of the same inputs. Uncache the coins fetched for the check (as the package path already does), skip ConsensusScriptChecks(), which on a test_accept only warms the script cache and cross-checks policy against consensus flags, and run the script checks with an explicit CachePolicy::READ_ONLY. The existing "don't store" flag was not usable for this: it has block-connection semantics and consumes a matched entry, marking it for eviction, which would have changed the fate of signatures already cached. STORE (mempool acceptance) and CONSUME (block connection) keep their previous behaviour. The database's own caches and the OS page cache are still warmed by the coin lookup, as by any UTXO read.
…cpp} A standalone program that speaks the P2P transports must be able to link them without CConnman and the rest of net.cpp. Pure move into bitcoin_common; net.h keeps including the new header, so nothing else changes.
Take the command byte as a parameter and return the reply's bound address, so a second SOCKS5 command can reuse the greeting, authentication and reply handling. Socks5() sends CONNECT as before.
Resolving a name through the Tor proxy keeps the lookup off the host's resolver and inside a circuit. The Tor RESOLVE command returns a single numeric address. A caller that relies on stream isolation must know the proxy actually selected username/password authentication, since Tor derives isolation from the credentials: require_auth fails the exchange otherwise. Make the isolation-credential counter atomic so concurrent streams never share credentials. Existing callers are unchanged.
instagibbs
force-pushed
the
privbcast-in-node
branch
4 times, most recently
from
September 29, 2026 18:07
9a2e3ff to
6c73b5d
Compare
A caller on a fixed schedule must bound the whole exchange in absolute time: an optional Socks5Deadline caps the local stages at the per-stage timeout and lets the proxy's reply, where the remote work happens, use the remaining budget, never past the deadline. Socks5Params also carries a per-stage timeout, an interrupt, a proxy connect timeout and isolation credentials, so a caller inside the node need not read or trigger the process-wide settings. Unset fields keep the process-wide behavior.
Announce a final transaction so that nothing a recipient observes can be tied to the user's node and nothing the network does can steer the sender. Both properties hold by construction: the tool is a separate process with no address manager, ban list, connection table, caches, RPC or wallet, and every decision that shapes traffic is fixed when the job starts.
Each connection speaks one constant profile, serves the transaction once on the request its advertised services make possible, and closes on the PONG. All wire-visible values are compile-time constants shared by all users. Unit tests fix the session's profile and its strict deadlines; the fuzz target drives the session with arbitrary messages, callbacks and ticks.
Discovery resolves the release DNS seeds through Tor RESOLVE and takes onion peers from the bundled fixed seeds, all on separate isolated streams with one absolute deadline.
An attempt dials one candidate through the connector, completes a v2 handshake and drives a session over it. There is no v1 fallback. The result records whether a failure came before the INV was handed to the transport; the job retries only those. RunSession takes any Transport, so the unit tests drive it over a v1 transport, including the receive cap and a peer close. The fuzz target runs attempts against a scripted hostile peer that speaks v2, or only v1 so our handshake fails.
Delivery uses six slots: three open together at delivery start (two exit-path, one onion), one onion slot opens at a time drawn in 35-180 s, and two exit-path slots at times drawn in 185-240 s, at least 5 s apart. A slot that fails before announcing tries its next pre-assigned peer 50-60 s later, at most three times. Every time is drawn when the job starts, so nothing observed later moves it. Input parsing covers the bounded stdin read, the loopback-only -tor argument and the bundled fixed-seed list. Unit tests fix the schedule and assignment arithmetic, input parsing and attempt decisions, and run whole jobs through the connector seam at a fraction of real time so scheduling rules (missed and empty opportunities, exit status, cancellation reaching a blocked connector) are checked without Tor. Fuzz targets cover discovery freezing with assignment, and input parsing.
Input is the transaction hex on stdin, output a JSON report; acceptance is checked beforehand with testmempoolaccept and receipt observed with getmempoolentry. Regtest-only flags exist for the tests. doc/design/private-broadcast-tool.md states the principle. The functional test runs jobs against the framework's SOCKS5 server, extended with RESOLVE, a delayed CONNECT reply and a larger backlog, with one behaviour per seed so every outcome path is taken on every run, and checks a bystander node's state is untouched.
…man/PeerManager implementation A job uses the node's Tor SOCKS5 proxy (GetProxy(NET_ONION)) wherever it listens, trusted like the node's other proxy settings; the standalone tool refuses a proxy that is not on loopback, since SOCKS5 carries destinations and the per-stream credentials in plaintext up to the proxy.
instagibbs
force-pushed
the
privbcast-in-node
branch
from
September 29, 2026 19:57
6c73b5d to
cb3aff3
Compare
…e mutation run found missing
instagibbs
force-pushed
the
privbcast-in-node
branch
from
October 1, 2026 12:53
b6927be to
c52a5dd
Compare
instagibbs
pushed a commit
that referenced
this pull request
Nov 10, 2026
…:__pad_and_output fa3821e test: Add missing suppression for race:std::__1::__pad_and_output (MarcoFalke) Pull request description: From https://github.com/bitcoin/bitcoin/actions/runs/41684419453/job/126086262840?pr=35990#step:11:8669: ``` WARNING: ThreadSanitizer: data race (pid=17903) Write of size 8 at 0x7ff5c1990c20 by thread T12 (mutexes: write M0): #0 width /llvm-project/libcxx/include/ios:498:18 (libc++.so.1+0xd3816) (BuildId: 6e001266114c9106207bb18363e2d5a09b534306) #1 std::__1::ostreambuf_iterator<char, std::__1::char_traits<char>> std::__1::__pad_and_output[abi:dee230102]<char, std::__1::char_traits<char>>(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char>>, char const*, char const*, char const*, std::__1::ios_base&, char) /llvm-project/libcxx/include/__locale_dir/pad_and_output.h:67:9 (libc++.so.1+0xd3816) #2 std::__1::ostreambuf_iterator<char, std::__1::char_traits<char>> std::__1::num_put<char, std::__1::ostreambuf_iterator<char, std::__1::char_traits<char>>>::__do_put_integral[abi:dee230102]<long long>(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char>>, std::__1::ios_base&, char, long long) const /llvm-project/libcxx/include/__locale_dir/num.h:907:10 (libc++.so.1+0xbcfa0) (BuildId: 6e001266114c9106207bb18363e2d5a09b534306) #3 std::__1::num_put<char, std::__1::ostreambuf_iterator<char, std::__1::char_traits<char>>>::do_put(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char>>, std::__1::ios_base&, char, long long) const /llvm-project/libcxx/include/__locale_dir/num.h:919:16 (libc++.so.1+0xbcb79) (BuildId: 6e001266114c9106207bb18363e2d5a09b534306) #4 put /llvm-project/libcxx/include/__locale_dir/num.h:780:12 (libc++.so.1+0x9b40c) (BuildId: 6e001266114c9106207bb18363e2d5a09b534306) #5 std::__1::basic_ostream<char, std::__1::char_traits<char>>& std::__1::basic_ostream<char, std::__1::char_traits<char>>::__put_num[abi:dee230102]<long long>(long long) /llvm-project/libcxx/include/__ostream/basic_ostream.h:104:21 (libc++.so.1+0x9b40c) #6 std::__1::basic_ostream<char, std::__1::char_traits<char>>::operator<<(long long) /llvm-project/libcxx/include/__ostream/basic_ostream.h:316:10 (libc++.so.1+0x9b2a0) (BuildId: 6e001266114c9106207bb18363e2d5a09b534306) #7 KernelLog::LogMessage(btck::LogEntry const&) /home/runner/work/_temp/src/bitcoin-chainstate.cpp:49:33 (bitcoin-chainstate+0xf2667) (BuildId: cff46198c8fd29997404a749cd55fdd6fcb3e865) ACKs for top commit: fanquake: utACK fa3821e Tree-SHA512: 383705fe33e429d40baaf7811a3edd6ce5164c423a1450c7a7a5d749d1ba44b8dac7a1270cbb593fcd0888dd9a2efbe7507650adf69b2f46ac09db4488cb9aec
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The currently deployed private broadcast feature has a fundamental weakness: It is tied to the node's peer, mempool, gossip, and other state.
Rather than play whackamole with the surface level symptoms, we can completely remove these issues via correctness through construction: Do not let the local bitcoin node influence the private broadcast operation whenever possible.
The goal is one thing: broadcast a transaction without ever revealing the sender's permanent
identity, its IP address or its onion address. Everything else here serves that.
This PR consists of a number of steps which can be merged sequentially:
Even if we get to step 3 only for a given release, the tool is of use on its own, and would offer much higher assurances for users who seek additional privacy, though the final steps are significantly smaller.
The design is specified in
doc/design/private-broadcast-tool.md: goals, threat model, invariants, parameters, interface, assumptions and non-goals. Usage is indoc/private-broadcast.md.Compared with
-privatebroadcaston masterbitcoindup to 18 jobs overlapNODE_NONE, no wtxid relay, announces by txidNODE_WITNESS, protocol 70017, wtxid relay required (BIP339)bitcoin-privbcastprogramGiven up: I2P, peers that speak only v1, the node's address manager, and re-sending when the transaction does not come back. The remedy for a transaction that did not arrive is another job.
The commits after cb3aff3 come from writing the spec: the receive cap raised to 128 KiB, a seed's kept answers made independent of their arrival order,
tie_orderdropped from the report, the functional tests checking the spec from outside (exit statuses, RPC codes, outcomes and what scripted peers receive, not message text), RPC help aligned, and the spec and user guide themselves. They will be folded into the steps above.