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

Proposed Specification for Asynchronous Rune Sell Offers #4290

Open
joshdoman opened this issue Mar 22, 2025 · 0 comments
Open

Proposed Specification for Asynchronous Rune Sell Offers #4290

joshdoman opened this issue Mar 22, 2025 · 0 comments

Comments

@joshdoman
Copy link

joshdoman commented Mar 22, 2025

Following the closure of PR #4280, I'd like to start a discussion around adding asynchronous PSBT sell offer capabilities to ord wallet, initially for runes and later for inscriptions.

PSBT Specification

Sell Offer PSBT

A PSBT sell offer consists of a single input and output. The input UTXO holds the offered runes, and the output value equals the input value plus the value required to sell the runes. The input UTXO is signed using the sighash SINGLE|ANYONECANPAY.

Finalized PSBT

The finalized funded PSBT has the following structure:

Input 0: The buyer's input (signed with ALL)
Input 1: The seller's input (signed with SINGLE|ANYONECANPAY)
Input 2+: Additional buyer inputs needed to fund the transaction

Output 0: The buyer's receive output (with postage)
Output 1: The seller's output
Output 2: The buyer's change output (if non-dust)

Runes transfer to the first output by default, so this structure ensures that the seller's runes land on the buyer's receive output, without needing an OP_RETURN in the transaction.

CLI Interface

This feature would add a new subcommand async-offer which can accept any Outgoing. The initial implementation will accept only Outgoing::Rune, with support for Outgoing::InscriptionId to follow in a subsequent PR.

Creating a Runes Sell Offer

A user can offer to sell the rune balance <DECIMAL:RUNE> for AMOUNT using:

ord wallet async-offer create --outgoing <DECIMAL:RUNE> --amount <AMOUNT>

This will generate a partially signed bitcoin transaction (PSBT), which the user can broadcast for anyone to fund and sign.

In the initial implementation, the user may only offer to sell an amount of runes <DECIMAL:RUNE> that equals the exact rune balance in a UTXO in their wallet.

Accepting a Runes Sell Offer

A user can accept the offer in PSBT to sell at least <DECIMAL:RUNE> for AMOUNT using:

ord wallet async-offer accept --outgoing <DECIMAL:RUNE> --amount <AMOUNT> --fee-rate <FEE_RATE>

Additional Thoughts

I included several additional features in PR #4280, which might make sense to discuss if/when rune sell offers get implemented. These features include:

  1. Accept a PSBT with multiple sub-offers for the same rune (i.e. multiple inputs signed with SINGLE|ANYONECANPAY with corresponding outputs)
  2. Create a PSBT with multiple sub-offers (with each sub-offer made at the same price per rune)
  3. Create a PSBT offering the maximum exact balance at or below a given target

Request for Feedback

  1. Is PSBT sell offers something the community wants implemented in ord? I recognize there are concerns about mempool sniping and MEV.
  2. Is there a more efficient way to format the PSBT?
  3. How do we feel about creating a new subcommand async-offer that is distinct from the existing offer subcommand? The idea is to make it clear that the existing offer command is for synchronous trades between a buyer and a seller where all the inputs are signed with sighash ALL.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant