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

Implement on-chain trusted gas swaps #2

Open
adambor opened this issue Dec 9, 2024 · 0 comments
Open

Implement on-chain trusted gas swaps #2

adambor opened this issue Dec 9, 2024 · 0 comments
Labels

Comments

@adambor
Copy link
Member

adambor commented Dec 9, 2024

We need on-chain gas swaps for users who don't know about lightning.

We can try to accept 0-conf payments by the method of burning the whole deposit to fees, this somewhat works, but requires the feerate to be low enough so that the burned amount results in a big-enough CPFP fee increase.

  1. Users sends a transaction of 2000 sats with all inputs confirmed at a fee of 3 sats/vB (paying ~2450 sats in total)
  2. LP accepts the transaction and pays out the gas token
  3. User tries to double spend the transaction by creating a tx at slighly higher fee rate, and 1-input & 1-output, paying 110 sats more, since it needs to cover the bandwidth cost (so user pays a total of 550 sats on fees, and keeps the deposit).
  4. LP detects the attempted double-spend and proceeds to burning the whole 2000 sats deposit to miner fees to CPFP the incoming transaction, bumping the fee rate to ~10 sats/vB (2000 sats new fee + 450 sats original fee), replacing the user's attempted double-spend attempt
  5. According to the mempool policy rules the user should now be unable to push any new double-spend through, unless paying more than 2450 sats + relay fee in total, making this uneconomical for user, in reality however this seems to not be the case, and the transaction which just pays the highest feerate is prioritized, i.e. the user is able to double-spend if he pays more than 11 sats/vB for his double spend attempt (paying ~1540 in fees in total).
@adambor adambor moved this to Todo in Gas swaps Dec 9, 2024
@adambor adambor added this to Gas swaps Dec 9, 2024
@adambor adambor moved this from Todo to In Progress in Gas swaps Dec 9, 2024
@adambor adambor added the WIP label Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: In Progress
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant