1

I am trying to do some tests using multisig transactions without importing the private key in bitcoind (watch only addresses). Bitcoind runs in regtest mode.

These are the steps I have done:

  1. createmultisig 2, [three_public_keys] (address: 2MzNBD51VvSPU1w6vp2Z6zyRzVGwEHco5Wj)
  2. importaddress multisig_address multisig_label true
  3. sendtoaddress multisig_address 0.1. At this point I have a multisig address with 0.1 BTC
  4. createrawtransaction from multisig address to a normal BTC address (miSXv45UamdKCBrb9DoWrzdQFzquqeVrhj) that is present in my wallet, amount 0.03
  5. signrawtransaction with first key
  6. signrawtransaction with third key -> the tx is "complete"
  7. sendrawtransaction

I have omitted the confirmations steps.

As a result:

  1. The listunspent command shows 0.03 BTC for the normal address and 0.07 BTC for the the multisig address
  2. The normal address, which is in my wallet, is increased by 0.03 BTC (listaccounts)

At this point I would like to check the balance for the multisig address. I have some issues:

  1. getbalance always returns 0. I have the feeling that the provided label is not associated to an account, so, simply put, it does recognize it as an account and provides 0.
  2. listaccounts does not show the multisig_account
  3. EVERY single unspent block owned by the multisig address results to be "unspendable". I could not find any info about that field, but it does not seem to prevent that block from being used as an input. In fact, I use it as an input to send 0.03 BTC to the normal address. Is it normal?

Currently I am using listunspent to get all the unspent blocks, filter by multisig label and sum up all the amounts to get the balance. While it is true that it works (is it a correct way to get the balance?), it is also true that it might not scale.

This is my final transaction:

    bcli gettransaction 852ddf5c61a9f7bf2f16a9e0430eee738927cd9a8cd99cbab22ba55e0ac013bd
{
        "amount" : 0.10000000,
        "confirmations" : 10,
        "blockhash" : "000046caadc57b88f298e2409eff4370ad223d50c56631fae00d8fc4604e4039",
        "blockindex" : 1,
        "blocktime" : 1413096038,
        "txid" : "852ddf5c61a9f7bf2f16a9e0430eee738927cd9a8cd99cbab22ba55e0ac013bd",
        "walletconflicts" : [
        ],
        "time" : 1413096038,
        "timereceived" : 1413096038,
        "details" : [
            {
                "involvesWatchonly" : true,
                "account" : "mirko",
                "address" : "miSXv45UamdKCBrb9DoWrzdQFzquqeVrhj",
                "category" : "receive",
                "amount" : 0.03000000,
                "vout" : 0
            }
        ],
        "hex" : "010000000169b15f8599522a5f87d8edbeec3da95351b9bd5a1febb7eb3aa4498f5a9286fc01000000fdfe0000483045022100b77d6e54a3084587067ddbc08ddbb3bab5aac407f0d1dafbadf191cc8250954f022029503f2f32ae6d5513632a5e184ae3f8fcf09e49d392c39f70437651bef7a6a301483045022100fe41efff9176cfd6c108afcd5234cc4fa66cd5f0b652b5e9bb68a0b85c27e5d60220587c2045b9efab07abb17a652d500ffcb72c299194f84808a4d3bb820c69e174014c6952210286c7ae03f02252fa801e04db1df2f2f8e27878a1736480e4fc51e2ac4cba08e721039f682869cbbfb89aad9d0af1e10cf7d3f5ade3e6ad9546fde9a969a92abcf53f2103449784f470d86e75779d4faa9d98f4cd4aafa66332f9e4c824e9fc14a7dfb5c553aeffffffff02c0c62d00000000001976a91420125cd88147d3f1d16b453589f687500b0a606388acc0cf6a000000000017a9144e1978d2bed81a0af3d3e7759ab0bc8540717c548700000000"
    }

This is the decoded raw transaction:

{
    "txid" : "852ddf5c61a9f7bf2f16a9e0430eee738927cd9a8cd99cbab22ba55e0ac013bd",
    "version" : 1,
    "locktime" : 0,
    "vin" : [
        {
            "txid" : "fc86925a8f49a43aebb7eb1f5abdb95153a93decbeedd8875f2a5299855fb169",
            "vout" : 1,
            "scriptSig" : {
                "asm" : "0 3045022100b77d6e54a3084587067ddbc08ddbb3bab5aac407f0d1dafbadf191cc8250954f022029503f2f32ae6d5513632a5e184ae3f8fcf09e49d392c39f70437651bef7a6a301 3045022100fe41efff9176cfd6c108afcd5234cc4fa66cd5f0b652b5e9bb68a0b85c27e5d60220587c2045b9efab07abb17a652d500ffcb72c299194f84808a4d3bb820c69e17401 52210286c7ae03f02252fa801e04db1df2f2f8e27878a1736480e4fc51e2ac4cba08e721039f682869cbbfb89aad9d0af1e10cf7d3f5ade3e6ad9546fde9a969a92abcf53f2103449784f470d86e75779d4faa9d98f4cd4aafa66332f9e4c824e9fc14a7dfb5c553ae",
                "hex" : "00483045022100b77d6e54a3084587067ddbc08ddbb3bab5aac407f0d1dafbadf191cc8250954f022029503f2f32ae6d5513632a5e184ae3f8fcf09e49d392c39f70437651bef7a6a301483045022100fe41efff9176cfd6c108afcd5234cc4fa66cd5f0b652b5e9bb68a0b85c27e5d60220587c2045b9efab07abb17a652d500ffcb72c299194f84808a4d3bb820c69e174014c6952210286c7ae03f02252fa801e04db1df2f2f8e27878a1736480e4fc51e2ac4cba08e721039f682869cbbfb89aad9d0af1e10cf7d3f5ade3e6ad9546fde9a969a92abcf53f2103449784f470d86e75779d4faa9d98f4cd4aafa66332f9e4c824e9fc14a7dfb5c553ae"
            },
            "sequence" : 4294967295
        }
    ],
    "vout" : [
        {
            "value" : 0.03000000,
            "n" : 0,
            "scriptPubKey" : {
                "asm" : "OP_DUP OP_HASH160 20125cd88147d3f1d16b453589f687500b0a6063 OP_EQUALVERIFY OP_CHECKSIG",
                "hex" : "76a91420125cd88147d3f1d16b453589f687500b0a606388ac",
                "reqSigs" : 1,
                "type" : "pubkeyhash",
                "addresses" : [
                    "miSXv45UamdKCBrb9DoWrzdQFzquqeVrhj"
                ]
            }
        },
        {
            "value" : 0.07000000,
            "n" : 1,
            "scriptPubKey" : {
                "asm" : "OP_HASH160 4e1978d2bed81a0af3d3e7759ab0bc8540717c54 OP_EQUAL",
                "hex" : "a9144e1978d2bed81a0af3d3e7759ab0bc8540717c5487",
                "reqSigs" : 1,
                "type" : "scripthash",
                "addresses" : [
                    "2MzNBD51VvSPU1w6vp2Z6zyRzVGwEHco5Wj"
                ]
            }
        }
    ]
}

This is the transaction that is the input for the previous one:

bcli gettransaction fc86925a8f49a43aebb7eb1f5abdb95153a93decbeedd8875f2a5299855fb169
{
    "amount" : 0.00000000,
    "fee" : 0.00000000,
    "confirmations" : 20,
    "blockhash" : "0000cf9fcd9b3dc7e08062284d84c184f76610c908cb96a5b19621d486c7ec0d",
    "blockindex" : 1,
    "blocktime" : 1413096031,
    "txid" : "fc86925a8f49a43aebb7eb1f5abdb95153a93decbeedd8875f2a5299855fb169",
    "walletconflicts" : [
    ],
    "time" : 1413096031,
    "timereceived" : 1413096031,
    "details" : [
        {
            "involvesWatchonly" : true,
            "account" : "",
            "address" : "2MzNBD51VvSPU1w6vp2Z6zyRzVGwEHco5Wj",
            "category" : "send",
            "amount" : -0.10000000,
            "vout" : 1,
            "fee" : 0.00000000
        }
    ],
    "hex" : "0100000001699191ffbe514553f4a9dcd02e3c7e351448d4e7c67f2e3ee3ec9a18a37a9a04010000006a4730440220359b170acf9650994549b6520bba440950c9904774eba4174bd7ada81a2702830220324f628c130bbcc5e54c3ee4702eb0e954dbd66f09944aa24a81992987d81e95012103080765b50062e774366f9be2f4adfeb28c27905e1dc48e41c3a54ca436f46ee2ffffffff0200c5d428010000001976a91452b3aef6dcab929528588f5a3fed742ac0f107e888ac809698000000000017a9144e1978d2bed81a0af3d3e7759ab0bc8540717c548700000000"
}

And this is the decoded transaction that is the input for the previous one:

 {
    "txid" : "fc86925a8f49a43aebb7eb1f5abdb95153a93decbeedd8875f2a5299855fb169",
    "version" : 1,
    "locktime" : 0,
    "vin" : [
        {
            "txid" : "049a7aa3189aece33e2e7fc6e7d44814357e3c2ed0dca9f4534551beff919169",
            "vout" : 1,
            "scriptSig" : {
                "asm" : "30440220359b170acf9650994549b6520bba440950c9904774eba4174bd7ada81a2702830220324f628c130bbcc5e54c3ee4702eb0e954dbd66f09944aa24a81992987d81e9501 03080765b50062e774366f9be2f4adfeb28c27905e1dc48e41c3a54ca436f46ee2",
                "hex" : "4730440220359b170acf9650994549b6520bba440950c9904774eba4174bd7ada81a2702830220324f628c130bbcc5e54c3ee4702eb0e954dbd66f09944aa24a81992987d81e95012103080765b50062e774366f9be2f4adfeb28c27905e1dc48e41c3a54ca436f46ee2"
            },
            "sequence" : 4294967295
        }
    ],
    "vout" : [
        {
            "value" : 49.80000000,
            "n" : 0,
            "scriptPubKey" : {
                "asm" : "OP_DUP OP_HASH160 52b3aef6dcab929528588f5a3fed742ac0f107e8 OP_EQUALVERIFY OP_CHECKSIG",
                "hex" : "76a91452b3aef6dcab929528588f5a3fed742ac0f107e888ac",
                "reqSigs" : 1,
                "type" : "pubkeyhash",
                "addresses" : [
                    "mo4ExQhSqo4A1euJLK8FXDS2Qr9mbBLQXn"
                ]
            }
        },
        {
            "value" : 0.10000000,
            "n" : 1,
            "scriptPubKey" : {
                "asm" : "OP_HASH160 4e1978d2bed81a0af3d3e7759ab0bc8540717c54 OP_EQUAL",
                "hex" : "a9144e1978d2bed81a0af3d3e7759ab0bc8540717c5487",
                "reqSigs" : 1,
                "type" : "scripthash",
                "addresses" : [
                    "2MzNBD51VvSPU1w6vp2Z6zyRzVGwEHco5Wj"
                ]
            }
        }
    ]
}

Finally, these are the unspent blocks:

{
        "txid" : "852ddf5c61a9f7bf2f16a9e0430eee738927cd9a8cd99cbab22ba55e0ac013bd",
        "vout" : 1,
        "address" : "2MzNBD51VvSPU1w6vp2Z6zyRzVGwEHco5Wj",
        "account" : "rpctest_1413096031008",
        "scriptPubKey" : "a9144e1978d2bed81a0af3d3e7759ab0bc8540717c5487",
        "amount" : 0.07000000,
        "confirmations" : 10,
        "spendable" : false
    }
{
        "txid" : "852ddf5c61a9f7bf2f16a9e0430eee738927cd9a8cd99cbab22ba55e0ac013bd",
        "vout" : 0,
        "address" : "miSXv45UamdKCBrb9DoWrzdQFzquqeVrhj",
        "account" : "mirko",
        "scriptPubKey" : "76a91420125cd88147d3f1d16b453589f687500b0a606388ac",
        "amount" : 0.03000000,
        "confirmations" : 10,
        "spendable" : true
    }

Notice the "unspendable" attribute. Unfortunately I have lost the 0.1 BTC unspendable block, that is, before the final transaction, but I am completely sure that it was "unspendable" as well.

Thank you very much for your help.

P.S. Sorry for the long post...

  • from the multisig example on bitcoin.org: "Neither the address nor the redeem script are stored in the wallet when you use createmultisig. To store them in the wallet, use the addmultisigaddress RPC instead." Maybe this is why you don't see results for the "2..." address. – pebwindkraft Apr 9 '17 at 15:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.