Any advice for signing raw tx?

+2 votes

Hello all, 

I am working through the examples for working with raw transactions. I'm using createRawSendFrom + signRawTransaction to send a native asset, but I'm missing something. signRawTransaction appears to return the original TX, unmodified. 

  • The addresses I am sending to & from are both in the wallet
  • to has receive, from has send permission
  • from address has sufficient funds 
  • the selected output for vin has enough assets

Following are JSON formatted results of the operations & a couple queries I tried to sanity check.  I'm using v2.0.2 running in a docker container; I'm using the multichain-node RPC client to make calls. 

Any ideas re: where to dig next are appreciated. Thanks!

-Tom

createRawSendFrom:

{
    "txid": "eb138f65008f82191416140ada138a7c8b77fe775cd79c873b67e794d1abcd34",
    "vin": [
        {
            "txid": "51db4266eca9e7083057c608dfe2f731cf865cdbecf6845ffe7a538440756fc7",
            "vout": 0,
            "scriptSig": {
                "asm": "",
                "hex": ""
            }
        }
    ],
    "vout": [
        {
            "value": 5,
            "n": 0,
            "scriptPubKey": {
                "asm": "OP_DUP OP_HASH160 5f0e32e41487fd8bacfd2625b66593bd86a619d6 OP_EQUALVERIFY OP_CHECKSIG",
                "hex": "76a9145f0e32e41487fd8bacfd2625b66593bd86a619d688ac",
                "reqSigs": 1,
                "type": "pubkeyhash",
                "addresses": [
                    "1Dr8yVKr8wizJF6t3kF65qJctTN7uQxXsrwhFE"
                ]
            }
        },
        {
            "value": 94.769,
            "n": 1,
            "scriptPubKey": {
                "asm": "OP_DUP OP_HASH160 b535f52040ec5b85670c41bf354578eed6acefe7 OP_EQUALVERIFY OP_CHECKSIG",
                "hex": "76a914b535f52040ec5b85670c41bf354578eed6acefe788ac",
                "reqSigs": 1,
                "type": "pubkeyhash",
                "addresses": [
                    "1RVWQ3v8n6ffRWh4Ve9eRNZDdDZmbDq27uSSRW"
                ]
            }
        }
    ]
}

listaddresses
        "address": "1RVWQ3v8n6ffRWh4Ve9eRNZDdDZmbDq27uSSRW",
        "ismine": true

        "address": "1Dr8yVKr8wizJF6t3kF65qJctTN7uQxXsrwhFE",
        "ismine": true
 

vin[0]

{
    "txid": "51db4266eca9e7083057c608dfe2f731cf865cdbecf6845ffe7a538440756fc7",
    
    "vout": [
        {
            "value": 100,
            "n": 0,
            "scriptPubKey": {
                "asm": "OP_DUP OP_HASH160 b535f52040ec5b85670c41bf354578eed6acefe7 OP_EQUALVERIFY OP_CHECKSIG",
                "hex": "76a914b535f52040ec5b85670c41bf354578eed6acefe788ac",
                "reqSigs": 1,
                "type": "pubkeyhash",
                "addresses": [
                    "1RVWQ3v8n6ffRWh4Ve9eRNZDdDZmbDq27uSSRW"
                ]
            }
        }
    ]
}

signRawTransaction

{
    "hex": "0100000001c76f754084537afe5f84f6ecdb5c86cf31f7e2df08c6573008e7a9ec6642db510000000000ffffffff0288130000000000001976a9145f0e32e41487fd8bacfd2625b66593bd86a619d688ac31720100000000001976a914b535f52040ec5b85670c41bf354578eed6acefe788ac00000000",
    "complete": false,
}

 

 

asked Sep 9, 2019 by Thomas

If it helps; these are the calls: 

createRawSendFrom 1RVWQ3v8n6ffRWh4Ve9eRNZDdDZmbDq27uSSRW {1Dr8yVKr8wizJF6t3kF65qJctTN7uQxXsrwhFE: {'': 5}

signRawTransaction <txhex>

1 Answer

+1 vote
Actually, the issue was a little more subtle / not with multichain. I'm using a multichain-node client, and a call to signrawtransaction with just tx-hex (i.e., default params) would actually send a request for

signrawtransaction <tx-hex> ,,,ALL

this will not sign the tx; it needs to be just a request for

signrawtransaction <tx-hex>

to get the expected behavior.
answered Sep 10, 2019 by untom
Great, thanks for providing your own solution.
...