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

Indexing mempool txs #4161

Open
gregdhill opened this issue Jan 2, 2025 · 10 comments
Open

Indexing mempool txs #4161

gregdhill opened this issue Jan 2, 2025 · 10 comments

Comments

@gregdhill
Copy link

We have front-end wallet logic (in Javascript) that uses Esplora to fetch UTXOs for users to sign but we've had some issues with users accidentally sending their Ordinals or Runes. For example the OKX wallet doesn't use a separate address like Xverse which reserves P2TR exclusively for Ordinals. We're now using the Ord API to fetch the Cardinals but from what we can tell Ord doesn't support indexing mempool txs which results in a degraded user experience since it then takes some time to see the current wallet balance. Is this something that is possible to support here easily?

@cryptoni9n
Copy link
Collaborator

cryptoni9n commented Jan 2, 2025

@gregdhill please ignore the scammy scammers above. don't click their fake tech support links.

@raphjaph @casey I've reported both the scammers above - can you drop the banhammer on them, please? [mark8700-bit and Berge511]

@cryptoni9n
Copy link
Collaborator

We have front-end wallet logic (in Javascript) that uses Esplora to fetch UTXOs for users to sign but we've had some issues with users accidentally sending their Ordinals or Runes. For example the OKX wallet doesn't use a separate address like Xverse which reserves P2TR exclusively for Ordinals. We're now using the Ord API to fetch the Cardinals but from what we can tell Ord doesn't support indexing mempool txs which results in a degraded user experience since it then takes some time to see the current wallet balance. Is this something that is possible to support here easily?

Hi greg, ord works in tandem with Bitcoin Core. Using the -txindex=1 flag when running Bitcoin Core will index the transactions, and ord references those transactions and indexes the ordinals, inscriptions, runes, addresses, etc. ord even has options to build the txindex itself.

If you're running a fully indexed ord node, you will be able to see live bitcoin balances for any receiving address.

I'm not sure if this helps answer your question though - if not, please provide more context on what ord is not doing for you and what you'd like it to do.

@gregdhill
Copy link
Author

gregdhill commented Jan 2, 2025

We want to use GET /outputs/${address}?type=cardinal in the frontend to select the safe UTXOs we can use for signing and calculating the current balance, but from what we can tell this does not include mempool txs?

Edit: are you saying we need -txindex=1 for this to work? I'll check if we're running our server with that configured.

@cryptoni9n
Copy link
Collaborator

We want to use GET /outputs/${address}?type=cardinal in the frontend to select the safe UTXOs we can use for signing and calculating the current balance, but from what we can tell this does not include mempool txs?

Edit: are you saying we need -txindex=1 for this to work? I'll check if we're running our server with that configured.

If you're running a fully indexed ord node alongside a Bitcoin Core node that is indexing transactions, you can run ord wallet cardinals to see the list of cardinal UTXO's that are in the currently loaded wallet. You can also query the recursive UTXO endpoint via the api to see a breakdown of what is inside each output, as described here.

Do you have a need to query addresses outside of your own?

@ordinals ordinals deleted a comment Jan 2, 2025
@ordinals ordinals deleted a comment Jan 2, 2025
@gregdhill
Copy link
Author

Yes we need to query for all users, our frontend allows users to sign Bitcoin txs we (currently) construct using Esplora and sign with a web wallet such as Xverse or UniSat. This is why we need to use the REST API, will that return also mempool UTXOs or that is only available for the current user locally?

@cryptoni9n
Copy link
Collaborator

Yes we need to query for all users, our frontend allows users to sign Bitcoin txs we (currently) construct using Esplora and sign with a web wallet such as Xverse or UniSat. This is why we need to use the REST API, will that return also mempool UTXOs or that is only available for the current user locally?

I think you should be able to use ord's GET /outputs/<ADDRESS> endpoint - documentation:

curl -s -H "Accept: application/json" \
  "http://0.0.0.0:80/outputs/358mMRwcxuCSkKheuVWaXHJBGKrXo3f6JW?type=cardinal"

@gregdhill
Copy link
Author

@cryptoni9n I still need to run some more tests, but we're pretty sure Ord is not returning UXTOs in the mempool. We can see the difference when we check esplora for example.

@emilcondrea
Copy link
Contributor

@gregdhill you are right, ord does not have support for mempool txs and it would be great to have them.

I think there is a misunderstanding @cryptoni9n , ord does not index unconfirmed/mempool transactions and this is a feature request which makes sense. I remember sometime ago @casey mentioned it will be great to have someone to add this.

You can actually look at the source code that ord only indexes confirmed blocks:

let fut = fetcher.get_transactions(txids);

self.index_block(

@cryptoni9n
Copy link
Collaborator

thanks guys - I wasn't making the connection that mempool = uncomfirmed, which is obvious when I think about it. I think @emilcondrea is right - I also remember Casey mentioning that he'd love to have mempool integration in ord, but that it would be a lot of work.

Sorry for the confusion.

@raphjaph
Copy link
Collaborator

raphjaph commented Jan 6, 2025

Yes, unfortunately ord does not index the mempool. We do want to support it in the future though.

@raphjaph raphjaph added this to Tracker Jan 6, 2025
@raphjaph raphjaph moved this to To Do in Tracker Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: To Do
Development

No branches or pull requests

4 participants