Skip to content
This repository has been archived by the owner on Dec 4, 2024. It is now read-only.

🟧 Enabling sBTC users to pay transaction fees in sBTC #27

Open
andrerserrano opened this issue Jul 28, 2023 · 13 comments
Open

🟧 Enabling sBTC users to pay transaction fees in sBTC #27

andrerserrano opened this issue Jul 28, 2023 · 13 comments
Assignees
Labels
enhancement New feature or request

Comments

@andrerserrano
Copy link
Collaborator

andrerserrano commented Jul 28, 2023

Enabling sBTC users to pay transaction fees in sBTC will remove friction from the UX and provide a better Bitcoin-native experience.

There is strong user demand for this. For example, Gamma cannot issue NFTs on sBTC without the native mint and gas fees in the same asset (effects the mint contracts).

Some ideas being explored:

  1. Sponsored transactions. Transaction fees are handled at the application level. Key questions on implementation: who would pay for the tx fees? Does this approach scale?
  2. Users pay in sBTC and an AMM converts to STX. This could present potential edge case issues around slippage and liquidity.
  3. Accept as native gas fees on the network. Requires research on Stacks tokeneconomics

Creating this issue to track ideas about how to simplify this UX.

@andrerserrano andrerserrano added the enhancement New feature or request label Jul 28, 2023
@netrome
Copy link
Contributor

netrome commented Jul 31, 2023

As I understand it, the idea behind sponsored transactions is to create a marketplace for these transactions where people would broadcast their transactions and essentially say:
"Hey! I'll give you this much sBTC if you sponsor this transaction for me". Thus creating an economic incentive for STX holders to sponsor the transactions.

@netrome
Copy link
Contributor

netrome commented Jul 31, 2023

@MarvinJanssen has been working on a proof of concept for sponsored transactions. Link: https://github.com/Trust-Machines/stacks-sbtc/pull/595

@MarvinJanssen
Copy link
Collaborator

@netrome that's right!

@jferrant
Copy link
Contributor

jferrant commented Aug 1, 2023

I know that the original idea of sBTC would be that it was feeless though (stackers are expected to cover the transaction fees associated with fulfilling a transaction) The original SIP specifically points out this is a main advantage of sBTC over other wrapped BTC though it does seem a bit of a tough sell to make a coordinator cover the fee out of their own pocket and it may result in a hot potato situation. This sounds like a good option to have anyway, but should probably get early feedback from @jcnelson. I am confused a bit by the incentives behind sBTC as a whole and we should really have some proper game theory analysis XD

@andrerserrano
Copy link
Collaborator Author

@jferrant this is specifically to handle the transaction fees on the Stacks network. The fees mentioned in SIP021 refer to the wrapping/unwrapping mechanism. Since Stackers are already receiving POX incentives to maintain the peg, the protocol doesn't need to charge any additional fees to wrap sBTC. Users are still required to pay the network fee for the gas.

The protocol exposes a mechanism to submit the withdrawals by means of a sponsored Stacks transaction. The sponsor will then receive an amount of sBTC in return for sponsoring the transaction. A sponsor can decide to sponsor the transaction if they find the fee acceptable.

@MarvinJanssen you wrote this in regards to the sBTC withdraw component, would it also be applicable to general peer to peer transfers, enabled by the wallet?

@soju-drinker
Copy link
Contributor

soju-drinker commented Aug 3, 2023

@andrerserrano When you say tx fees, do you mean tx fees for any arbitrary tx on the stacks network and not just sBTC interactions?

@andrerserrano
Copy link
Collaborator Author

Yes, I suppose there are two components:

  • Tx fees for sBTC interactions
  • Any sBTC transfer / contract call (ie a wallet transfer or to deploy in a DeFi app)

@MarvinJanssen
Copy link
Collaborator

You can do that on Stacks today but you will have to deploy proxy contracts. If a hard fork in the future would allow us to bundle transactions into one atomic action then we don't need proxy contracts anymore.

If this is desired then we can add an sBTC-based fee sponsor call to transfer sBTC.

@andrerserrano
Copy link
Collaborator Author

You can do that on Stacks today but you will have to deploy proxy contracts. If a hard fork in the future would allow us to bundle transactions into one atomic action then we don't need proxy contracts anymore.

If this is desired then we can add an sBTC-based fee sponsor call to transfer sBTC.

Great. Yes, I think this would would solve a big UX hurdle. @markmhx Does this satisfy the requirement you have in mind for how to handle this?

@andrerserrano andrerserrano moved this from 🆕 New to 💻 In Progress in Stacks Core Eng Aug 7, 2023
@markmhendrickson
Copy link

If this is desired then we can add an sBTC-based fee sponsor call to transfer sBTC.

I'm not exactly sure how this would work. @MarvinJanssen mind explaining some details? And if it requires a hard fork, would the idea be here that it get included in Nakamoto?

@MarvinJanssen
Copy link
Collaborator

@markmhx take a look at this example. It allow sBTC holders that do not own any STX to still request a peg out via Stacks. Instead they will pay a transaction fee of their choosing in sBTC to a sponsor.

https://github.com/Trust-Machines/stacks-sbtc/blob/978fc8cbd1fc5ae836e4f2a415944cd1e81a1101/sbtc-mini/contracts/sbtc-peg-out-request-stx.clar#L55-L68

We can generalise it and create a proxy contract to allow for sponsored calls paid for in sBTC for all functions, like the token transfer function.

@john-neoswap
Copy link

Can this problem be solved on the wallet side through solution number 2 at the top?

Maybe if leather and xverse add support for sBTC usage as gas through auto conversion, that's good enough

@MarvinJanssen
Copy link
Collaborator

The problem is how will you do that atomically? In most cases for Stacks it will mean deploying a wrapper or proxy contract that does both of these actions. But as it stands now, there are only two parties that can pay the fees: the tx-sender or the tx-sponsor. It is a chicken and egg problem because a user without STX cannot send a transaction to convert sBTC to STX to use it to pay fees. It is theoretically possible to craft a zero-fee transaction that will pay the miner in some currency but as far as I know there is no custom Stacks node that would pick up such a transaction.

@cuevasm cuevasm changed the title Enabling sBTC users to pay transaction fees in sBTC 🟧 Enabling sBTC users to pay transaction fees in sBTC Jan 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

7 participants