listunspent does not list transactions sent to multisignature addresses #3218

issue ThePiachu opened this issue on November 7, 2013
  1. ThePiachu commented at 7:59 AM on November 7, 2013: none

    I called listunspent, got a bunch of results for normal addresses in the wallet, but none for the multisignature addresses in my wallet. I searched the results both by the address and the transactionID and I did not find any results.

  2. sipa commented at 12:28 PM on November 7, 2013: member

    This is intentional, as the wallet only considers multisig addresses where it has all keys to be owned by itself. This is to prevent multiple wallets from considering the same coins spendable.

    I won't close this bug, however, as I think this requirement isn't necessary for the raw transaction API. One possible solution is via watch-only wallets, which can monitor and track any address - even without any key at all.

  3. ThePiachu closed this on Feb 26, 2014

  4. ThePiachu reopened this on Feb 26, 2014

  5. ShawnKimble commented at 2:01 AM on July 27, 2015: none

    I imported all the keys related to a Multisig in version 0.10.2, and listunspent does not show transactions related to this multisig, nor does the balance include these transactions. Per sipa's comments on 11/7/2013, I'm under the impression I should see this transactions as part of my balance and these transactions should display via listunspent.

  6. jonasschnelli commented at 7:57 AM on July 27, 2015: contributor

    @ShawnKimble: do your wallet owns all keys for the multisig or only some? Event if you have a 2 of 3 multisig-address and you only own two keys (which would be sufficient to spend to coin), you won't be able to spend it as well as you won't see the coin in `listunspent?. This could be changed once. Mind: #5958 (comment)

  7. ShawnKimble commented at 10:50 AM on July 27, 2015: none

    Yes, all three keys were imported for a 2 of 3 multisig. So according to current understanding this should work, but does not.

    Shawn

    On Jul 27, 2015, at 3:58 AM, Jonas Schnelli notifications@github.com wrote:

    @ShawnKimble: do your wallet owns all keys for the multisig or only some? Event if you have a 2 of 3 multisig-address and you only own two keys (which would be sufficient to spend to coin), you won't be able to spend it as well as you won't see the coin in `listunspent?. This could be changed once. Mind: #5958 (comment)

    — Reply to this email directly or view it on GitHub.

  8. jonasschnelli commented at 10:56 AM on July 27, 2015: contributor

    If you have all three keys, it should be included in the balance calculation and in listunspents response. Mind the minconf argument if your wtx has no confirmation (probably not).

    If it's not listed, could you give us some more informations like the raw transaction and a output of listreceivedbyaddress 0 true?

  9. sipa commented at 10:58 AM on July 27, 2015: member

    Did you use the addmultisigaddress RPC to make the wallet aware of the P2SH address to look for?

  10. ShawnKimble commented at 11:45 AM on July 27, 2015: none

    I created the three standard bitcoin addresses independently of bitcoin core and funded two MS addresses created from the 2 of 6 permutations of those addresses. I then imported all three private keys using importprivkey. I then used addmultisigaddress to add the 6 different permutations of addresses. My listunspent only lists existing transactions in the wallet.

  11. ShawnKimble commented at 11:51 AM on July 27, 2015: none

    Here is a transaction related to one of the MS - 3QRhXMcBS8fwm2o9jvz9TVPdeW1SJ8sWWY

    dd4cfddd6bbddbfa7c6270c3455bf5a7408831f6fd9e304f6d6be3651072cb84

    07:50:15  validateaddress 3QRhXMcBS8fwm2o9jvz9TVPdeW1SJ8sWWY

    07:50:15  { "isvalid" : true, "address" : "3QRhXMcBS8fwm2o9jvz9TVPdeW1SJ8sWWY", "ismine" : true, "iswatchonly" : false, "isscript" : true, "script" : "multisig", "hex" : "5221039cf3c2f439cebf811c342aa833d477b114cdcae1ad4ea58c8c0000bdaedd4c1621030519ad4f1c71a3d1089ef4b6e84286757acd3d62e6a55f6b04753edc5508537e2103614c3e73928b001532cc8c4779a1597497bf2c56109fa198fefa93c058dba6c353ae", "addresses" : [ "1MEzw8VK8MMehi8PhhRgwtsmdA8KAC4BPp", "1L1Tp1EnaKBKNhfbJyRyP6ANy1ReigwbXb", "14a4Gp2bDpKks8Q2YgULz8hLRnW97AMERK" ], "sigsrequired" : 2, "account" : "" }

    07:50:22  listunspent

    07:50:22  [ { "txid" : "4ef0a429d0d42e27e0a37cf31ac14cc852e790b8fb0e1065c5d4095ea123bc6c", "vout" : 335, "address" : "13BkQV7Z94QWyX4rj3AemT7kvJebDvzEBi", "account" : "2048", "scriptPubKey" : "76a91417f8a4ceacb09d23ae3ac1df78d63be39cda2fee88ac", "amount" : 0.00007880, "confirmations" : 6012, "spendable" : true }, { "txid" : "57d2c95e5f8b352480b21c64e4a1890ffa106bfbf3bd6ddef2126c7ca9f89eeb", "vout" : 1, "address" : "1DB2P2mYS8L3BwPimS3GqQYCiD8SY1thqt", "account" : "", "scriptPubKey" : "76a9148586d2235f1de1ffe863be2a6865ad74cddb5b9288ac", "amount" : 0.00010000, "confirmations" : 25998, "spendable" : true } ]

  12. ShawnKimble commented at 12:06 PM on July 27, 2015: none

    Not sure if this helps, but the MS addresses only show in the "Sending list" of addresses, since they were created offline and then funded by this bitcoin core wallet. Then they were added to the wallet later. So they were funded by this wallet before they were owned by this wallet.

  13. meshcollider commented at 2:32 PM on March 7, 2018: contributor

    Possibly related to #9421 in that case, restarting the wallet may make it appear

  14. jnewbery commented at 9:59 PM on April 2, 2018: member

    @ShawnKimble - are you able to confirm @MeshCollider's comment above? Does restarting resolve this for you?

  15. sipa commented at 10:10 PM on April 2, 2018: member

    You need to import the multisig address itself as a watch-only address. Importing public keys does not make them be treated as yours; it just helps signing.

  16. fjahr commented at 9:42 PM on December 23, 2019: member

    I tested this behavior on current master and for me it worked as @ShawnKimble has intended/described it.

    Creation of multisig address:

    $ src/bitcoin-cli -regtest getnewaddress
    bcrt1q5p3phykmrqwrgvqny2z5kehfkze266xjcae4ga
    
    $ src/bitcoin-cli -regtest getnewaddress
    bcrt1qzpql5326l06smym4hl53j4kp5t9a2l8ja2vv7w
    
    $ src/bitcoin-cli -regtest getnewaddress
    bcrt1q433rmur64v8cdmq490055kuugrcnhz70umsu0j
    
    $ src/bitcoin-cli -regtest dumpprivkey "bcrt1q5p3phykmrqwrgvqny2z5kehfkze266xjcae4ga"
    cNfskKz4eem3QQ7j4C4YjgWt83Mqp1EkdigUzJ3nreAMZZKd7bhq
    
    $ src/bitcoin-cli -regtest dumpprivkey "bcrt1qzpql5326l06smym4hl53j4kp5t9a2l8ja2vv7w"
    cS8Ue7EvELGe1zTaNg2WJi1JCefutNuNkDZ6hWyC1ub69ZxKgMiv
    
    $ src/bitcoin-cli -regtest dumpprivkey "bcrt1q433rmur64v8cdmq490055kuugrcnhz70umsu0j"
    cRYEwe1sZdTTKadmWJcYkyH7RxYBB8KCupgPvjxNV1NceK7zhfiU
    
    $ src/bitcoin-cli -regtest addmultisigaddress 2 "[\"bcrt1q5p3phykmrqwrgvqny2z5kehfkze266xjcae4ga\",\"bcrt1qzpql5326l06smym4hl53j4kp5t9a2l8ja2vv7w\",\"bcrt1q433rmur64v8cdmq490055kuugrcnhz70umsu0j\"]"
    {
      "address": "bcrt1qdgf33symeyy4gnuxuwmwxg2qx9nlv3m747ecsrxdgjqqssnnpu4s3wjx2d",
      "redeemScript": "522102e5d20ccc7e23a63db57da007d704cb6dd1910687235f0a741872d37cfe47e49c2103adc7153f986f9721f737a63ccec8fb9180f2bcffd39f4bf57cc10a18b6d1530321032bce4f39feb2c7ca4632dd11a7ae2ae2f07b55fb77134133ffb9b2277303188f53ae"
    }
    

    Then I set up a completely new regtest environment and generated some blocks. All following commands are in that fresh environment.

    Funding of (currently foreign) multisig address:

    $ src/bitcoin-cli -regtest sendtoaddress "bcrt1qdgf33symeyy4gnuxuwmwxg2qx9nlv3m747ecsrxdgjqqssnnpu4s3wjx2d" 10
    469f07602c4b8160b65cb715781d1faf68eaa34ed3eb44223006f68afe1f3134
    

    Importing privkeys:

    $ src/bitcoin-cli -regtest importprivkey cNfskKz4eem3QQ7j4C4YjgWt83Mqp1EkdigUzJ3nreAMZZKd7bhq
    
    $ src/bitcoin-cli -regtest importprivkey cS8Ue7EvELGe1zTaNg2WJi1JCefutNuNkDZ6hWyC1ub69ZxKgMiv
    
    $ src/bitcoin-cli -regtest importprivkey cRYEwe1sZdTTKadmWJcYkyH7RxYBB8KCupgPvjxNV1NceK7zhfiU
    

    Adding multisig again:

    $ src/bitcoin-cli -regtest addmultisigaddress 2 "[\"bcrt1q5p3phykmrqwrgvqny2z5kehfkze266xjcae4ga\",\"bcrt1qzpql5326l06smym4hl53j4kp5t9a2l8ja2vv7w\",\"bcrt1q433rmur64v8cdmq490055kuugrcnhz70umsu0j\"]"
    {
      "address": "bcrt1qdgf33symeyy4gnuxuwmwxg2qx9nlv3m747ecsrxdgjqqssnnpu4s3wjx2d",
      "redeemScript": "522102e5d20ccc7e23a63db57da007d704cb6dd1910687235f0a741872d37cfe47e49c2103adc7153f986f9721f737a63ccec8fb9180f2bcffd39f4bf57cc10a18b6d1530321032bce4f39feb2c7ca4632dd11a7ae2ae2f07b55fb77134133ffb9b2277303188f53ae"
    }
    

    List unspent:

    $ src/bitcoin-cli -regtest listunspent 0 0
    [
      {
        "txid": "469f07602c4b8160b65cb715781d1faf68eaa34ed3eb44223006f68afe1f3134",
        "vout": 0,
        "address": "bcrt1qranj3kjvequyq9pchtwj49hdwrfcqa9w54tz8m",
        "scriptPubKey": "00141f6728da4cc838401438badd2a96ed70d38074ae",
        "amount": 39.99999694,
        "confirmations": 0,
        "spendable": true,
        "solvable": true,
        "desc": "wpkh([bc53f24c/0'/1'/0']03363ae5cf261f872f26ff9fd2ba720c92ed83688d1ba9040a389aea22d87fbc3f)#xu9rmm87",
        "safe": true
      },
      {
        "txid": "469f07602c4b8160b65cb715781d1faf68eaa34ed3eb44223006f68afe1f3134",
        "vout": 1,
        "address": "bcrt1qdgf33symeyy4gnuxuwmwxg2qx9nlv3m747ecsrxdgjqqssnnpu4s3wjx2d",
        "label": "",
        "witnessScript": "522102e5d20ccc7e23a63db57da007d704cb6dd1910687235f0a741872d37cfe47e49c2103adc7153f986f9721f737a63ccec8fb9180f2bcffd39f4bf57cc10a18b6d1530321032bce4f39feb2c7ca4632dd11a7ae2ae2f07b55fb77134133ffb9b2277303188f53ae",
        "scriptPubKey": "00206a1318c09bc909544f86e3b6e321403167f6477eafb3880ccd44800842730f2b",
        "amount": 10.00000000,
        "confirmations": 0,
        "spendable": true,
        "solvable": true,
        "desc": "wsh(multi(2,[a0621b92]02e5d20ccc7e23a63db57da007d704cb6dd1910687235f0a741872d37cfe47e49c,[1041fa45]03adc7153f986f9721f737a63ccec8fb9180f2bcffd39f4bf57cc10a18b6d15303,[ac623df0]032bce4f39feb2c7ca4632dd11a7ae2ae2f07b55fb77134133ffb9b2277303188f))#yadryzqn",
        "safe": true
      }
    ]
    

    I did not want to speculate on what went wrong initially and I did not research if any changes fixed this issue in the meantime but I think this can be closed :)

  17. Bushstar referenced this in commit 9dad60386c on Apr 8, 2020
  18. MarcoFalke commented at 5:53 PM on May 8, 2020: member

    I think this can be closed :)

    ok

  19. MarcoFalke closed this on May 8, 2020

  20. DrahtBot locked this on Feb 15, 2022

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-21 18:16 UTC

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