Not able to complete signing of transaction for Multisignature address

+3 votes
Created 2 addresses using createkeypairs :

Address 1: { "address" : "1SxbigBX5yi7CAxXaPqQdcawbfWHPRWHGpVETN",

        "privkey" : "V8MZV1BLv3o1RbkzAj7M1j2mYZf2DC6h14T517HW7jE66MqJrePvWM6T"    }

Address 2 :     { "address" : "1cwJE98kdMfoYSSnhSVPoxGb1xJqLG9QgRMWh",

        "privkey" : "V9rApqjqNpZstuL59vesDxYHFdWJTz4xqz5AEye7VYCtgY5qmfQhFtnD"}

Using the above addresses I was also able to create 1 Multi-sig account
Multisig Address :
    {
        "address" : "44gMSB3z4qw4WHDhHa2pgEqbbFqywH57AUnKDY",
        "ismine" : false,
        "iswatchonly" : true,
        "isscript" : true,
        "script" : "multisig",
        "hex" : "5221037eb7f908e67f60b4b38f2a5254690351d74619f69d53b2fe5af53ac4171bea1e2102f3d385cbe481c0813393286d00e8a7861d6d07f4e0ed7373b13f0d1acb6c691a52ae",
        "addresses" : [
            "1SxbigBX5yi7CAxXaPqQdcawbfWHPRWHGpVETN",
            "1cwJE98kdMfoYSSnhSVPoxGb1xJqLG9QgRMWh"
        ],
        "sigsrequired" : 2,
        "account" : "",
        "synchronized" : false,
        "startblock" : 203
    }

I loaded some assets to Multisig address "44gMSB3z4qw4WHDhHa2pgEqbbFqywH57AUnKDY"
        "name" : "USD",
        "qty" : 150

After referring to
1. https://www.multichain.com/qa/833/multiple-multisig-address-different-addresses-same-wallet

2. https://www.multichain.com/qa/6028/transactions-multisig-explicitly-using-addresses-privkeys?show=6055#a6055
3.https://www.multichain.com/qa/5941/random-previous-output-scriptpubkey-mismatch-error?show=5983#c5983
4. https://www.multichain.com/developers/multisignature-transactions/

5. https://www.multichain.com/developers/external-key-management/

I was able to do
COMMAND 1:
createrawsendfrom 44gMSB3z4qw4WHDhHa2pgEqbbFqywH57AUnKDY '{"1UeHUhZ5bqyoLRKnaseerQZJEajgAQhYiWSaTN":{"USD":100}}'     
                          
RESPONSE:
FIRST-HEX-BLOB

COMMAND 2:

decoderawtransaction FIRST-HEX-BLOB

RESPONSE:

{
    "txid" : "f9f5f34bafb1872c636e4a0f4bdb8e87f0ec9566f060a49b2aee1454f13ef6c3",
    "version" : 1,
    "locktime" : 0,
    "vin" : [
        {
            "txid" : "ae03b2126cb31254a4f49324c2bf07d75ec911bb85788e7914e46de83df053a1",
            "vout" : 0,
            "scriptSig" : {
                "asm" : "",
                "hex" : ""
            },
            "sequence" : 4294967295
        }
    ],
    "vout" : [
        {
            "value" : 0,
            "n" : 0,
            "scriptPubKey" : {
                "asm" : "OP_DUP OP_HASH160 cc86f94dfe7d496036d0b95f67498990e7c35339 OP_EQUALVERIFY OP_CHECKSIG 73706b718c19495c2f875d848174192401260d3a1027000000000000 OP_DROP",
                "hex" : "76a914cc86f94dfe7d496036d0b95f67498990e7c3533988ac1c73706b718c19495c2f875d848174192401260d3a102700000000000075",
                "reqSigs" : 1,
                "type" : "pubkeyhash",
                "addresses" : [
                    "1UeHUhZ5bqyoLRKnaseerQZJEajgAQhYiWSaTN"
                ]
            },
            "assets" : [
                {
                    "name" : "USD",
                    "issuetxid" : "3a0d260124197481845d872f5c49198ca7e23f4ab7a6f56a4bb66af0597e9d1d",
                    "assetref" : "77-265-3386",
                    "qty" : 100,
                    "raw" : 10000,
                    "type" : "transfer"
                }
            ]
        },
        {
            "value" : 0,
            "n" : 1,
            "scriptPubKey" : {
                "asm" : "OP_HASH160 22a14405491d1981d08816b0a9465ba444ab2090 OP_EQUAL 73706b718c19495c2f875d848174192401260d3a8813000000000000 OP_DROP",
                "hex" : "a91422a14405491d1981d08816b0a9465ba444ab2090871c73706b718c19495c2f875d848174192401260d3a881300000000000075",
                "reqSigs" : 1,
                "type" : "scripthash",
                "addresses" : [
                    "44gMSB3z4qw4WHDhHa2pgEqbbFqywH57AUnKDY"
                ]
            },
            "assets" : [
                {
                    "name" : "USD",
                    "issuetxid" : "3a0d260124197481845d872f5c49198ca7e23f4ab7a6f56a4bb66af0597e9d1d",
                    "assetref" : "77-265-3386",
                    "qty" : 50,
                    "raw" : 5000,
                    "type" : "transfer"
                }
            ]
        }
    ]
}

COMMAND 3:

signrawtransaction FIRST-HEX-BLOB '[{"txid":"ae03b2126cb31254a4f49324c2bf07d75ec911bb85788e7914e46de83df053a1","vout":0,"scriptPubKey":"a91422a14405491d1981d08816b0a9465ba444ab2090871c73706b718c19495c2f875d848174192401260d3a983a00000000000075","redeemScript":"5221037eb7f908e67f60b4b38f2a5254690351d74619f69d53b2fe5af53ac4171bea1e2102f3d385cbe481c0813393286d00e8a7861d6d07f4e0ed7373b13f0d1acb6c691a52ae"}]' '["V9rApqjqNpZstuL59vesDxYHFdWJTz4xqz5AEye7VYCtgY5qmfQhFtnD","V9rApqjqNpZstuL59vesDxYHFdWJTz4xqz5AEye7VYCtgY5qmfQhFtnD"]'

Response:
{
    "hex" : SECOND-HEX-BLOB , "complete" : false
}

COMMAND 4:
signrawtransaction SECOND-HEX-BLOB  '[{"txid":"ae03b2126cb31254a4f49324c2bf07d75ec911bb85788e7914e46de83df053a1","vout":0,"scriptPubKey":"a91422a14405491d1981d08816b0a9465ba444ab2090871c73706b718c19495c2f875d848174192401260d3a983a00000000000075","redeemScript":"5221037eb7f908e67f60b4b38f2a5254690351d74619f69d53b2fe5af53ac4171bea1e2102f3d385cbe481c0813393286d00e8a7861d6d07f4e0ed7373b13f0d1acb6c691a52ae"}]' '["V9rApqjqNpZstuL59vesDxYHFdWJTz4xqz5AEye7VYCtgY5qmfQhFtnD","V9rApqjqNpZstuL59vesDxYHFdWJTz4xqz5AEye7VYCtgY5qmfQhFtnD"]'
Response:
{
    "hex" : "SECOND-HEX-BLOB ",
    "complete" : false
}

So Even after completing the Multisig addresses sending the assets The transaction is not getting completed. Hence, the wallet balance is the same.

Please Let me know the reason for the problem. And the solution as well.
Note: The second hex-blob is bigger thank the first.
asked Mar 26 by Pavan123

1 Answer

+1 vote

The procedure is almost the same but some of the inputs that are missing while signing the transaction are redeemScript of the multisig address and the scriptpubkey hex of the txid that you have retrieved from the decoderawtransaction API.

So if all these inputs are passed while signing the transaction then it will work fine.

answered Mar 26 by gimmick
Thank you gimmick!
Can you please inspect the COMMAND 3 and COMMAND 4 segment on the browser, as the both redeemScript and scriptpubkey is there?
COMMAND 3:

{"method":"signrawtransaction","params":["First Hex Blob", [{"txid":"decodeMultisigVinTxid","vout":decoddVout,"scriptPubKey":"scriptPubKeyhex", "redeemScript": "redeemScript"}], ["private_key"]],"id":1,"chain_name":"chainname"}

See you try something like this for your signtransaction API. Hope it works well.
...