Repository navigation
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. External sites
ReviewsSee the guideline and AI policy for information on the review process. ConflictsReviewers, this pull request conflicts with the following ones:
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. |
ec12202 to
89d2246
Compare
89d2246 to
882e58a
Compare
|
Rebased. #36277 got merged, which caused the first commit to be substantially changed, but behavior is the same. |
|
Putting the current block height in Lines 1020 to 1030 in acaf322 So an artificial delay must be combined with a non-default Delaying in order to make linking transactions (that are otherwise unrelated) by creation time harder makes sense if private broadcast is used. If send-to-all broadcast is used, then the otherwise unrelated transactions can be linked as coming from the same node. The delay does not play nice with node restart (unbroadcast transactions would be lost).
Hmm? Nit, from the OP:
probably you meant "submitted but not yet broadcast". |
|
@vasild, thanks for the general remarks!
The Core wallet could be enhanced, to use matching nLockTime if using delyed broadcast (in a followup). Also, delayed broadcast could check and warn on nLockTime (closer to submission time than broadcast time, or too much in the future). Even better, nLockTime could be used to set/extend the requested broadcast time. (The time-based option should be there nonetheless, as it makes the feature more accessible.)
True, but delayed broadcast is available only in conjunction with private broadcast.
|
|
Applied a fix to the new functional test. One CI run failed, and it turned out to be a timing issue in the test. Note that the failing run was a no wallet run, but the sporadic failure is not specific to the no-wallet config. Pre-#36277 the test was correct, but now it had to be adapted. |
882e58a to
f692a48
Compare
|
Hmm, I am tending towards concept ~0, As I mentioned here #34118, the delay itself seems like something a client can already do: sleep for a random time, then call sendrawtransaction on a node running with -privatebroadcast. I had Claude write a ~30 line shell script that reproduces the algorithm here. But the shell script has downsides, the client/shell process has to stay running for up to 12 hours, whereas with this PR the node holds it instead, which is better. Info calls like visibility in It would be a bit more ideal if this were implemented for our wallet users, since it'd be awkward for them to create a tx and then have to use a script to delay broadcasting it. Also see the recent discussion in #36403, which attempts to revive a lot of old ideas like a node rebroadcast module, improving wallet rebroadcast, e.t.c. it would involve some machinery to distinguish between delayed-rebroadcast txs, mempool txs, private-rebroadcast txs, and wallet txs, since they'd all need to be taken into account, but in practice can be done correctly with good SOC. Fwiw, I am not completely dismissing this, I'd like to understand the privacy goal better. "Making time-correlation-based tracking more difficult" is a bit vague can you be more explicit, e.g. with scenarios and data? Because I think I'm missing something:
|
|
Hey @ismaelsadeeq , thanks for sharing your concerns!
That's true, most client could do the delay themselves (this is not true for private broadcast, for which the core node must be involved). However, many clients can not do this easily, as wallets are typically not used in an always-on mode. If someone uses a third-party wallet software (e.g. Sparrow, Nunchuk, etc.), connected to his own core node (directly or indirectly via an electrum server), ultimately the core node is the always-on component interfacing with the bitcoin network, and it's a good fit to offer scheduled/delayed broadcast support. I don't think shell script is a practical solution for an average user, even a power user. For more concrete examples, here are some use cases:
I think private broadcast, delayed broadcast, rebroadcast all fit in a larger picture: locally-originated transactions. Transactions originated in/through the node are special in many ways compared to relayed transactions originated elsewhere. Sources:
Functionalities:
I would argue that an abstraction for local-originated transactions and a pool for such transactions would make a lot of sense. (Note: added '[RFC]' prefix to title) |
Yes, I like this idea - use
If the point is to hide the transaction creation time and the wallet puts current height for |
|
Following some recent discussions, I plan to do some changes to the feature:
Keeping in Draft status until the above changes are applied. |
@vasild , thanks for this and previous feedback! I also arrived at the same conclusion, see the previous comment. I am thinking to also support the option for using a past lock time for obfuscation (wallet fingerprinting). One idea I came up with:
Examples (assume current height is 1000:
Scheme to be refined. It should also support time-based lock time. |
Core support for scheduled private broadcast: - Add an optional release height to submitted transactions; `release_height` field added to `TxBroadcastInfo` and `TxSendStatus` - Add ReleaseDue() to release the scheduled transactions whose release height has been reached by the given block height - Adapt logic to handle scheduled submission (Add, Remove, etc.): a transaction is not sent before it is released, has no planned sends to cancel on Remove(), and is forgotten by MarkResolved() - Measure staleness from the time of release
Only send scheduled transactions after the active chain reaches their release height. A periodic task, similar to ReattemptPrivateBroadcast(), releases the transactions that became due, re-validates them, and requests connections for the ones that are still valid.
If set, and private broadcast is enabled (prerequisite), the broadcast of the submitted transaction is scheduled for the block height nLockTime + delay_after_lock_time. Only height-based lock times are supported. If the release height has already been reached, the transaction is broadcast immediately. A scheduled transaction is validated at submission. If it is rejected only as TX_PREMATURE_SPEND (e.g. its nLockTime is in the future), it is still accepted, as it may become valid by its release height; the checks that ATMP did not get to are then only done at release, when the transaction is fully validated again. getprivatebroadcastinfo shows the release height of scheduled transactions.
f692a48 to
8960630
Compare
|
Reworked the whole PR (code, description, title) in light of the above, to timelock-based. |

Minimal implementation for "Scheduled Transaction Broadcast" new feature.
Goal: Allow a user to submit a transaction to be broadcast later, at a specified time (block height). This can be done for convenience, or to hide the exact time of the transaction creation (for increased privacy).
Goal in this PR: Extend the
sendrawtransactionRPC with an option to schedule the broadcast at a later time, determined by the lock time of the transaction.Use case details, with the limitations of the current changeset:
sendrawtransactionhas an optional parameter,delay_after_lock_timedelay_after_lock_timeis set to 0, thenLockTimeof the transaction determines the scheduled broadcast time (in the future).delay_after_lock_timeis set to a positive number, the broadcast time will be the sum of the transactionnLockTimeand the parameter value.getprivatebroadcastinfoRPC.abortprivatebroadcastRPC can be used to cancel a pending transaction submission.delay_after_lock_timewith a positive value can be used to distance the submission time from the lock time.Solution Details:
m_transactionscollection.ReattemptPrivateBroadcast). Alternative: triggered by new blocks.Further improvements:
delay_after_lock_timein 10-minute units if time-based lock is used.ProcessTransactionandAcceptToMemoryPool).Related issue: #34118
EDIT (Nov-03): Reworked, see #36429 (comment)