[Feature] Get utxos for non-wallet addresses #16388

issue mikemilla opened this issue on July 14, 2019
  1. mikemilla commented at 7:17 PM on July 14, 2019: none

    Hey team,

    Adding a feature request here for the ability to query all utxos for a given address(s) regardless if it's in the nodes wallet or not.

    I understand the reasoning here of why it's not included out-of-the-box as it could add a significant amount of overhead to the core requirements of running the node.

    However, it's fairly concerning that the most of the articles about how to get this functionality just point to using an external api to fetch this info. Tutorials of how to get this functionality on the developer side are also painful when just trying to get this fairly common feature up and running. Isn't part of the point of running a full node to be able to get anything you need without the reliance of a third party? "Don't trust, verify"

    I would imagine the best implementation for this would be to add a flag in the bitcoin.conf of something like indexAddrs=1 or something like that.

    Anyway, just putting the idea out there. Thanks

  2. mikemilla renamed this:
    FR: Get utxos for non-wallet addresses
    [Feature] Get utxos for non-wallet addresses
    on Jul 14, 2019
  3. achow101 commented at 7:19 PM on July 14, 2019: member

    You can use the scantxoutset RPC to do this already. This will give you all UTXOs for an address or a descriptor. I will not scan the blockchain for all transactions or transaction outputs for it, just the UTXO set.

  4. mikemilla commented at 7:34 PM on July 14, 2019: none

    You can use the scantxoutset RPC to do this already. This will give you all UTXOs for an address or a descriptor. I will not scan the blockchain for all transactions or transaction outputs for it, just the UTXO set.

    Ok sweet! How would I write something like this then? bitcoin-cli scantxoutset muXQpwvT2NNEXB5keSPmaPFnKpTnR2ZSNV

    I've tried many different ways of writing this command but can't seem to get it correct.

  5. jb55 commented at 8:03 PM on July 14, 2019: member

    @mikemilla

    utxo () { bitcoin-cli scantxoutset start '["'"addr($1)"'"]'

    $ utxo 34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo
    [..]
      "total_amount": 165204.35005579
    }
    
  6. mikemilla commented at 10:14 PM on July 14, 2019: none

    @jb55 looking for a basic command line example. Tried about 2 dozen different implementations of your snippet.

    Some resulted in nothing, others with errors, others saying I need a descriptor.

  7. promag commented at 11:09 PM on July 14, 2019: member

    Try

    bitcoin-cli scantxoutset start '["addr(34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo)"]'
    
  8. MarcoFalke commented at 12:06 PM on July 15, 2019: member

    Usually the issue tracker is used to track technical issues related to the Bitcoin Core code base. Keep in mind that general bitcoin questions and/or support requests are best directed to the Bitcoin StackExchange.

  9. MarcoFalke closed this on Jul 15, 2019

  10. MarcoFalke added the label Questions and Help on Jul 15, 2019
  11. mikemilla commented at 2:49 PM on July 16, 2019: none

    @promag I tried that several times and it returned an error.

  12. promag commented at 2:53 PM on July 16, 2019: member

    Please open an issue in stackexchange and provide more detailed information, like version used, output of commands etc.

  13. mikemilla commented at 11:39 PM on August 9, 2019: none

    For those still curious about this. I was able to get a node running and connected to a javascript app. Here is the command that will work with bitcoin-core via javascript.

    https://www.npmjs.com/package/bitcoin-core

    const utxos = await client.command('scantxoutset', 'start', ['addr(some_valid_address), addr(some_valid_address)'])
    
  14. MarcoFalke locked this on Dec 16, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 21:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me