Multisig transaction with native assets not working

+1 vote
Hi,

    I am trying to create a multisig transaction with native assets, But I am facing problem at the last, Can you please help me?
    
    I have four nodes, I am listing four nodes address, public key and private below.
    I have created 1000 native assets and sending 100 assets to node and then i would like to test it.
    first three nodes are involved in agreement.
    
    I am getting "error: {"code":-26,"message":"18: bad-txns-inputs-spent"}."

Address                                        Public Key                                                                Private Key
"1FhRuH65hzP67hrtqatux8b8nrZQBumD4eCsFb"    "03f556f52a571daa024d59472976594ea47f213bf1e205e1661d175e8bc017e27e"     VEvGpKJ324h4x3d7s7osnWs9P4hLm4rwVrVwh9UEDUMAkPNgLJpicvpi
"12a11jYx4qswT7jfcQtbhcaKdAVnWn2kv8M6AE"    "025890ba3ae7a2b2c512230874ef879128781f127261e80aaef00bfa3dc98d6efb"    VCng8mbQM1qLrLLPj5Vtu8XzK1Wh2sWJumx7GVgJxTYjJHiaDCt5DGpW
"1EQjP6SAFvwf8FAQBicL5vjsJmYfLVyVZwyZVX"    "0323b96f508ef1ad49403523bdc1d3d4d4dd9d9cdf4daed6d3cc20863e1e0f91be"    V9QhkmYefbFTV21aa5TvBQdsFpRpU7rMptuJ8XtWxFnwRFjJfQrLvUaR
"12iBfyF2YTviuRyYxAhf6vbgmFWygt8uEdVs7b"    "02480418fe560f6557e9caf031ed27a969d8d1e1bf291592eebd28fcf7e00a0726"    VGquA5MSLJANH23fuV2J7gaJB3FciVHGa2WqkkCvjbm3Bz92t4HHiQy1

multichain-cli ms createmultisig 2 '["03f556f52a571daa024d59472976594ea47f213bf1e205e1661d175e8bc017e27e","025890ba3ae7a2b2c512230874ef879128781f127261e80aaef00bfa3dc98d6efb","0323b96f508ef1ad49403523bdc1d3d4d4dd9d9cdf4daed6d3cc20863e1e0f91be"]'

{
    "address" : "4CYABQBXhCAbDDWDjg4pHrFtT71EWgGCDZXuFQ",
    "redeemScript" : "522103f556f52a571daa024d59472976594ea47f213bf1e205e1661d175e8bc017e27e21025890ba3ae7a2b2c512230874ef879128781f127261e80aaef00bfa3dc98d6efb210323b96f508ef1ad49403523bdc1d3d4d4dd9d9cdf4daed6d3cc20863e1e0f91be53ae"
}

multichain-cli ms issue 1FhRuH65hzP67hrtqatux8b8nrZQBumD4eCsFb AltCoin 1000 0.01

multichain-cli ms sendassettoaddress 12a11jYx4qswT7jfcQtbhcaKdAVnWn2kv8M6AE AltCoin 100

bc2@bc2:~$ m listunspent
{"method":"listunspent","params":[],"id":1,"chain_name":"ms"}

[
    {
        "txid" : "4db710191d713b5c3349e7bd204ca19f7d361961655970f22242d0b6c17b7e1c",
        "vout" : 0,
        "address" : "12a11jYx4qswT7jfcQtbhcaKdAVnWn2kv8M6AE",
        "account" : "",
        "scriptPubKey" : "76a9140b9bd2ece34f77ced23eb024ec283dbdd89f369988ac1473706b700700000000000000ffffffff198eca5675",
        "amount" : 0.00000000,
        "confirmations" : 482,
        "cansend" : true,
        "spendable" : true,
        "assets" : [
        ],
        "permissions" : [
            {
                "connect" : true,
                "send" : true,
                "receive" : true,
                "issue" : false,
                "mine" : false,
                "admin" : false,
                "activate" : false,
                "startblock" : 0,
                "endblock" : 4294967295,
                "timestamp" : 1456115225
            }
        ]
    },
    {
        "txid" : "8b5feff895de3c9843da64739b968580877309ffbe30fc3701d991c041acb3c6",
        "vout" : 0,
        "address" : "12a11jYx4qswT7jfcQtbhcaKdAVnWn2kv8M6AE",
        "account" : "",
        "scriptPubKey" : "76a9140b9bd2ece34f77ced23eb024ec283dbdd89f369988ac1673706b71b90000000a0100006b5c102700000000000075",
        "amount" : 0.00000000,
        "confirmations" : 86,
        "cansend" : true,
        "spendable" : true,
        "assets" : [
            {
                "name" : "AltCoin",
                "assetref" : "185-266-23659",
                "qty" : 100.00000000
            }
        ],
        "permissions" : [
        ]
    }
]

multichain-cli ms createrawtransaction '[{"txid":"8b5feff895de3c9843da64739b968580877309ffbe30fc3701d991c041acb3c6","vout":0}]' '{"4CYABQBXhCAbDDWDjg4pHrFtT71EWgGCDZXuFQ":{"AltCoin":50}}'

0100000001c6b3ac...

multichain-cli ms signrawtransaction 0100000001c6b3ac...

{
    "hex" : "0100000001c6b3ac...",
    "complete" : true
}

m decoderawtransaction 0100000001c6b3ac...

{
    "txid" : "ea97d7cdac1d1e656e17b93f22c5ae27903e3f96ecb5ab10a6ae5d7c8dd3c23a",
    "version" : 1,
    "locktime" : 0,
    "vin" : [
        {
            "txid" : "8b5feff895de3c9843da64739b968580877309ffbe30fc3701d991c041acb3c6",
            "vout" : 0,
            "scriptSig" : {
                "asm" : "",
                "hex" : ""
            },
            "sequence" : 4294967295
        }
    ],
    "vout" : [
        {
            "value" : 0.00000000,
            "n" : 0,
            "scriptPubKey" : {
                "asm" : "OP_HASH160 5cc6ab859255a5cf108c90769d1948d831658741 OP_EQUAL 73706b71b90000000a0100006b5c8813000000000000 OP_DROP",
                "hex" : "a9145cc6ab859255a5cf108c90769d1948d831658741871673706b71b90000000a0100006b5c881300000000000075",
                "reqSigs" : 1,
                "type" : "scripthash",
                "addresses" : [
                    "4CYABQBXhCAbDDWDjg4pHrFtT71EWgGCDZXuFQ"
                ]
            },
            "assets" : [
                {
                    "name" : "AltCoin",
                    "issuetxid" : "6b5c67cf5b643c5955828fbfd8057ae1435e6dbe6163976adab7daedb2b2883d",
                    "assetref" : "185-266-23659",
                    "qty" : 50.00000000,
                    "raw" : 5000
                }
            ],
            "permissions" : [
            ]
        }
    ],
    "data" : [
    ]
}

multichain-cli ms createrawtransaction '[{"txid":"ea97d7cdac1d1e656e17b93f22c5ae27903e3f96ecb5ab10a6ae5d7c8dd3c23a","vout":0,"scriptPubKey":"a9145cc6ab859255a5cf108c90769d1948d831658741871673706b71b90000000a0100006b5c881300000000000075","redeemScript":"522103f556f52a571daa024d59472976594ea47f213bf1e205e1661d175e8bc017e27e21025890ba3ae7a2b2c512230874ef879128781f127261e80aaef00bfa3dc98d6efb210323b96f508ef1ad49403523bdc1d3d4d4dd9d9cdf4daed6d3cc20863e1e0f91be53ae"}]' '{"1EQjP6SAFvwf8FAQBicL5vjsJmYfLVyVZwyZVX":{"AltCoin":100}}'

01000000013ac2d38d7c5daea6

multichain-cli ms signrawtransaction '01000000013ac2d38d7c5daea6...' '[{"txid":"ea97d7cdac1d1e656e17b93f22c5ae27903e3f96ecb5ab10a6ae5d7c8dd3c23a","vout":0,"scriptPubKey":"a9145cc6ab859255a5cf108c90769d1948d831658741871673706b71b90000000a0100006b5c881300000000000075","redeemScript":"522103f556f52a571daa024d59472976594ea47f213bf1e205e1661d175e8bc017e27e21025890ba3ae7a2b2c512230874ef879128781f127261e80aaef00bfa3dc98d6efb210323b96f508ef1ad49403523bdc1d3d4d4dd9d9cdf4daed6d3cc20863e1e0f91be53ae"}]' '["VCng8mbQM1qLrLLPj5Vtu8XzK1Wh2sWJumx7GVgJxTYjJHiaDCt5DGpW"]'

{
    "hex" : "01000000013ac2d38d7c5daea6...",
    "complete" : false
}

move to Node 1

multichain-cli ms signrawtransaction '010000000126793101fcc47040545b0...' '[{"txid":"ea97d7cdac1d1e656e17b93f22c5ae27903e3f96ecb5ab10a6ae5d7c8dd3c23a","vout":0,"scriptPubKey":"a9145cc6ab859255a5cf108c90769d1948d831658741871673706b71b90000000a0100006b5c881300000000000075","redeemScript":"522103f556f52a571daa024d59472976594ea47f213bf1e205e1661d175e8bc017e27e21025890ba3ae7a2b2c512230874ef879128781f127261e80aaef00bfa3dc98d6efb210323b96f508ef1ad49403523bdc1d3d4d4dd9d9cdf4daed6d3cc20863e1e0f91be53ae"}]' '["VEvGpKJ324h4x3d7s7osnWs9P4hLm4rwVrVwh9UEDUMAkPNgLJpicvpi"]'

{
    "hex" : "010000000126793101fcc47040545b0...",
    "complete" : false
}

multichain-cli ms sendrawtransaction 010000000126793101fcc47040545b0...

bc1@bc1:~$ multichain-cli ms sendrawtransaction 010000000126793101fcc47040545b0...
{"method":"sendrawtransaction","params":["010000000126793101fcc47040545b0..."],"id":1,"chain_name":"ms"}

error: {"code":-26,"message":"18: bad-txns-inputs-spent"}

Move to Node 2

multichain-cli ms sendrawtransaction 01000000013ac2d38d7c5daea610ab...

bc2@bc2:~$ multichain-cli ms sendrawtransaction 01000000013ac2d38d7c5daea610ab...
{"method":"sendrawtransaction","params":["01000000013ac2d38d7c5daea610ab..."],"id":1,"chain_name":"ms"}

error: {"code":-26,"message":"18: bad-txns-inputs-spent"}
asked Feb 22, 2016 by ShenthilkumarCK

1 Answer

0 votes
It looks like you forgot to call sendrawtransaction 0100000001c6b3ac... (ea97d7cdac1d1e656e17b93f22c5ae27903e3f96ecb5ab10a6ae5d7c8dd3c23a) to multisig address. That's why you see "complete":false in the output of the subsequent signrawtransaction and error when trying to send transaction relying on non-existent input.

We also strongly recommend using of preparelockunspent API (http://www.multichain.com/developers/json-rpc-api/) for preparing inputs for createrawtransaction. Unlocked outputs can be spent by automatic wallet optimization procedure.
answered Feb 22, 2016 by Michael
...