Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contribute even when a sender makes no change #259

Merged
merged 6 commits into from
Jul 15, 2024

Conversation

DanGould
Copy link
Contributor

@DanGould DanGould commented May 21, 2024

A pure consolidation does not suffer from Unnecessary Input Heuristic. A Payjoin consolidation without sender change still breaks Common Input Heuristic. Allow it.


This is incomplete because the UIH checking should not be happening if only a consolidation is to occur. That does not suffer from change interpretation nor unnecessary input issues because there is no change to interpret, just a single output funded by all necessary inputs.

Supporting sweeps themselves introduce NO API change. It only allows a payjoin to be created with exactly 1 output paying the receiver.

HOWEVER I have taken the liberty to change RequestBuilder::build_non_incentivising to take a min_fee_rate as parameter. Without this, a sender could sign and broadcast transactions that have no chance of being mined. I've seen a persistent mempool for months!

These are my notes on Unnecessary Input Heuristic that a reviewer may find helpful in understanding the constraints of the try_preserving_privacy function modified here.

This ability should be is tested with both a sender / receiver integration test and data to show that these types of transactions might be ambiguous with existing payment activity (self spends or sweeps to others)

Data:

As of Jul 8, 2024, Out of Blockchair's 1,037,565,391 transactions, 53,232,056 of them

  • Have 2 or more inputs
  • Have exactly 1 non-zero output (i.e. not OP_RETURN)
  • Are not coinbase transactions
    transactions that are not Coinbase transactions have exactly one output with a non-zero amount.

This means approximately 5.13% of all transactions are sweeps that might suffer from Common-input heuristic.

Source monetary non-coinbase transactions count: https://blockchair.com/bitcoin/transactions?q=is_coinbase(false)#f=hash,is_coinbase,time

source sweeps: https://blockchair.com/bitcoin/transactions?s=time(desc)&q=output_count(1),is_coinbase(false),fee(1..),input_count(2..),output_total(1..)#f=hash,time,output_total,fee,is_coinbase,output_count,block_id,input_count

Of the transactions in the past year, since height 797844

There have been 175,639,552 transactions and 8,080,966 of them

  • Have 2 or more inputs
  • Have exactly 1 non-zero output (i.e. not OP_RETURN)
  • Are not coinbase transactions

This means approximately 4.57% of all non-coinbase transactions in the past year are sweeps that might suffer from common input heuristic.

source all non-coinbase: https://blockchair.com/bitcoin/transactions?s=time(desc)&q=is_coinbase(false),fee(1..),block_id(797844..)#f=hash,time,output_total,is_coinbase,block_id,fee,input_count,output_count

source sweeps: https://blockchair.com/bitcoin/transactions?s=time(desc)&q=output_count(1),is_coinbase(false),fee(1..),input_count(2..),output_total(1..),block_id(797844..)#f=hash,time,output_total,is_coinbase,block_id,fee,input_count,output_count

@DanGould DanGould added enhancement New feature or request receive receiving payjoin labels May 21, 2024
@DanGould DanGould requested a review from spacebear21 May 21, 2024 15:13
@DanGould DanGould marked this pull request as draft May 21, 2024 15:43
@DanGould DanGould removed the request for review from spacebear21 May 21, 2024 15:43
@DanGould DanGould added this to the 1.0 milestone Jun 17, 2024
@DanGould DanGould modified the milestones: payjoin-1.0, payjoin-0.19.0 Jul 8, 2024
A pure consolidation does not suffer from Unnecessary Input Heuristic.
A Payjoin consolidation without sender change still breaks Common Input
Heuristic. Allow it.
Avoid UIH for multiple inputs, and just select any input where UIH does
not apply.
Inputs naturally come before outputs in bitcoin transactions.
Such one-output transactions pay the base costs to transact and provide
an incentive for a receiver to contribute with reduced marginal cost of
adding an input rather than an explicit change output. Allowing payjoin
sweeps breaks common input heuristic for them. Sweeps with many inputs
are common, making ~5.2% or ~54M of ~1.037B monetary, non-coinbase txs.

Source monetary non-coinbase transactions count: https://blockchair.com/bitcoin/transactions?q=is_coinbase(false)#f=hash,is_coinbase,time

Source sweep transactions count: https://blockchair.com/bitcoin/transactions?s=time(desc)&q=is_coinbase(false),input_count(2..),output_count(1)#f=hash,time
Since these changes makes sweeps first-class payjoin transactions, make the
Requestbuilder recommend the appropriate parameters for sweeps too.
Without this, a sender would sign a receiver transaction that would get stuck.
@DanGould DanGould added the api label Jul 9, 2024
@DanGould DanGould marked this pull request as ready for review July 9, 2024 15:59
@DanGould DanGould requested a review from spacebear21 July 9, 2024 15:59
Copy link
Collaborator

@spacebear21 spacebear21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK 7361ba9

@DanGould DanGould merged commit eb51b35 into payjoin:master Jul 15, 2024
4 checks passed
@DanGould DanGould deleted the dont-force-change branch July 15, 2024 19:01
This was referenced Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api enhancement New feature or request receive receiving payjoin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants