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

Buy and Sell Inscriptions/Rare Sats #2697

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

utxo-detective
Copy link

@utxo-detective utxo-detective commented Nov 19, 2023

This PR introduces two new commands ord wallet sell and ord wallet buy. Sell will return a signed psbt that you can share with your friends or publish somewhere publicly. Purchase will take the signature from a signed psbt and fund a transaction to move the asset into your wallet

Sell

Usage: ord wallet sell --amount <AMOUNT> <OUTGOING>

Buy

Usage: ord wallet buy --fee-rate <FEE_RATE> <PSBT>

Example

To sell an inscription for 100k sats:

ord wallet sell --amount 100000sat 47be43d0a33229846847215664e68de0fbdeb2cabf470d2f3e930ca097ae7bcbi0

Sell command returns signed psbt:

"70736274ff01005e02000000015a7c8f99c6c23eef83ca2e4d183f47c654ca39359c8f6f35e9f527759fa8a7410100000000fdffffff01a0860100000000002251209374dfb75605cc14a4044c864169ed895f29786f3130e007e73f367b23d94782000000000001012b2224000000000000225120c004d5e7eb0714854491f4f9cf4f0316d68163ac3b37851a564249d15471087d010304830000000108430141e09d184cc707499a5250eadadf646eb14c7a77f215e8e0d8a87ee2c2e8a3478384a5b7ebf60f2df0999f5e4022407f9980bdab288cee74a11369ca396da2ef0c830000"

Buying the the inscription:

ord wallet buy --fee-rate 2.0 70736274ff01005e02000000015a7c8f99c6c23eef83ca2e4d183f47c654ca39359c8f6f35e9f527759fa8a7410100000000fdffffff01a0860100000000002251209374dfb75605cc14a4044c864169ed895f29786f3130e007e73f367b23d94782000000000001012b2224000000000000225120c004d5e7eb0714854491f4f9cf4f0316d68163ac3b37851a564249d15471087d010304830000000108430141e09d184cc707499a5250eadadf646eb14c7a77f215e8e0d8a87ee2c2e8a3478384a5b7ebf60f2df0999f5e4022407f9980bdab288cee74a11369ca396da2ef0c830000

Results in a purchase:

Purchasing 47be43d0a33229846847215664e68de0fbdeb2cabf470d2f3e930ca097ae7bcbi0 for 100000 sats
{
  "setup_txid": null,
  "purchase_txid": "1a6c5641f90a96ff469cb31cb9d86e5d435c711a764fc679c495d931331d5ffa"
}

Tested on signet
https://mempool.space/signet/tx/1a6c5641f90a96ff469cb31cb9d86e5d435c711a764fc679c495d931331d5ffa#vin=4

@utxo-detective utxo-detective marked this pull request as ready for review November 19, 2023 20:33
@utxo-detective
Copy link
Author

Heres a psbt for an inscription that available for purchase for 100k signet satoshis:

70736274ff01005e0200000001fa5f1d3331d995c479c64f761a715c435d6ed8b91cb39c46ff960af941566c1a0100000000fdffffff01a0860100000000002251208314a233ef8bcb98a027cc045b9d849a91310ee5ee5122db8c52b92c8cd2c96d000000000001012b22240000000000002251203adaaaa60a717a9ec4effb1282fb188db0a556de16ba0a07ec717023cbe9659201030483000000010843014167cc91babeacbe8e9a7658eb30b8b11a4fdd2222944c76ee66846e946de4fab44d1507179b87bfab0059534668b66a86ea4c4d1902a4993ec1913d663c756f9d830000

@utxo-detective
Copy link
Author

@casey @raphjaph i can make any changes you want to see, just let me know. Starting to write tests now

@@ -51,6 +53,10 @@ pub(crate) enum Wallet {
Outputs,
#[command(about = "List unspent cardinal outputs in wallet")]
Cardinals,
#[command(about = "List and ordinal for sale")]

Choose a reason for hiding this comment

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

Suggested change
#[command(about = "List and ordinal for sale")]
#[command(about = "List an ordinal for sale")]

@casey casey mentioned this pull request Nov 20, 2023
@casey
Copy link
Collaborator

casey commented Nov 20, 2023

I think before we can start reviewing this, we need to design and agree on the design of offer PSBTs. I created this #2706 to track this. See that issue for my thoughts.

@casey casey marked this pull request as draft November 20, 2023 22:32
help = "The amount of sats to sell your inscription or rare sats for."
)]
pub amount: Amount,
pub outgoing: Outgoing,
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be nice if you could optionally specify a particular address for the sales funds to go to.


let mut total_fees = 0;

if bump_utxos.len() < 2 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of going with the bump pattern that market places use, it would be great if there was an option for the user to use any 2 random UTXOs for the first 2. That would allow UTXO consolidation as a nice byproduct of a purchase.

@casey casey mentioned this pull request Feb 12, 2024
@casey casey linked an issue Feb 12, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Offers
5 participants