Problems sending raw transactions.

+1 vote
I am trying to sendrawtransaction for native and I keep getting this error code below.  This seemed to be working at some point but now only sometimes the transaction will actually send.  Most of the time it spits out this error. The unspent total native value is 345.757766. I am not sure if there is a syntax problem, maybe a floating point problem? All the values in the decoderawtransaction seem to add up correctly.  Listunspent shows the txid..... Any ideas?

error code -26
error message:
16 Asset transfer script rejected - mismatch in input/output quantities.

 

-- MY JSON --
Array
(
    [0] => Array
        (
            [txid] => 57facb59010af44a72c9a7b5835dd9deddbc558384366c98fe1dcb74dfafa46d
            [vout] => 2
        )

)

Array
(
    [1Ytu3iSuDabGMGhU2WreYYSy7SaxKhoa2hmr7q] => 32.33
    [1DXPfLtrGQ3Xjq1puWuA3S1wSkhaBKs5oBnB4m] => 0.16
    [1QhQCdGUHtY1E6CFryjCD1e92Meuk35gyf3V1m] => 313.267766
)

 

-- MY DECODED RAW TRANSACTION --

{
    "txid" : "d1ebfcc958a350ece3fcb1f19830d6066edcc32d505a63e2c1f739690bf3e24f",
    "version" : 1,
    "locktime" : 0,
    "vin" : [
        {
            "txid" : "57facb59010af44a72c9a7b5835dd9deddbc558384366c98fe1dcb74dfafa46d",
            "vout" : 2,
            "scriptSig" : {
                "asm" : "",
                "hex" : ""
            },
            "sequence" : 4294967295
        }
    ],
    "vout" : [
        {
            "value" : 32.33000000,
            "n" : 0,
            "scriptPubKey" : {
                "asm" : "OP_DUP OP_HASH160 ebfcb435272dd16700dff4d88e9afef9baaae5b4 OP_EQUAL                         VERIFY OP_CHECKSIG",
                "hex" : "76a914ebfcb435272dd16700dff4d88e9afef9baaae5b488ac",
                "reqSigs" : 1,
                "type" : "pubkeyhash",
                "addresses" : [
                    "1Ytu3iSuDabGMGhU2WreYYSy7SaxKhoa2hmr7q"
                ]
            },
            "assets" : [
            ],
            "permissions" : [
            ]
        },
        {
            "value" : 0.16000000,
            "n" : 1,
            "scriptPubKey" : {
                "asm" : "OP_DUP OP_HASH160 5ca9fab1e8094db51610429a54ad5928bf495f28 OP_EQUAL                         VERIFY OP_CHECKSIG",
                "hex" : "76a9145ca9fab1e8094db51610429a54ad5928bf495f2888ac",
                "reqSigs" : 1,
                "type" : "pubkeyhash",
                "addresses" : [
                    "1DXPfLtrGQ3Xjq1puWuA3S1wSkhaBKs5oBnB4m"
                ]
            },
            "assets" : [
            ],
            "permissions" : [
            ]
        },
        {
            "value" : 313.26776600,
            "n" : 2,
            "scriptPubKey" : {
                "asm" : "OP_DUP OP_HASH160 af543b2ff2d3fa139326a12548e64f9aaf0e5575 OP_EQUAL                         VERIFY OP_CHECKSIG",
                "hex" : "76a914af543b2ff2d3fa139326a12548e64f9aaf0e557588ac",
                "reqSigs" : 1,
                "type" : "pubkeyhash",
                "addresses" : [
                    "1QhQCdGUHtY1E6CFryjCD1e92Meuk35gyf3V1m"
                ]
            },
            "assets" : [
            ],
            "permissions" : [
            ]
        }
    ],
    "data" : [
    ]
}
asked Sep 14, 2016 by dtarsio
I also noticed that there is an asset tied to the same txid.  I am only trying to send some native. I think maybe because the asset is tied to the same txid it is throwing the error. How can I just spend native if the asset is tied to the same txid? Do I need to do something with the asset? Every time I want to move native around this same error seems to be popping up. Did I uncover a bug?
I also tried appendrawchange to this transaction to see if it has something to do with sending back asset change and now I get this error.

error code: -26
error message:
16: ConnectInputs failed
Ok made some progress but still unable to use appendrawchange correctly. For this txid I sent asset change back to an address which allows the transaction to go through. Why when I try using appendrawchange it does not work the same way. I assume if I do not specify native and asset change that calling appendrawchange will take care of the change, otherwise doesn't the native and asset change just get sent to a miner anyway?
Please post a full transcript of what you're doing, and the responses you received, then we can try to understand it.
I figured out the problem.  It was some code on my end that was not working right. Testing is running smooth now.  Thanks.
i have same problem. Do you tell me how to fix it, pls?

1 Answer

0 votes

In order to be able to explain or debug this, we need to see the following:

  • decoderawtransaction of the transaction you are trying to send, before calling appendrawchange
  • decoderawtransaction of the transaction after calling appendrawchange
  • output of gettxout for each of the inputs being spent by the transaction.
answered Sep 15, 2016 by MultiChain
I actually was able to debug the problem myself.  I think I found the problem and it seems to be running smoothly now in my test environment.  I will keep running more tests next week and see if it remains stable.
...