Getting mismatch error on sendrawtransaction problem

+1 vote

Okay I have a simple chain with the assets S and F with quantities of 100000.. Now I am making a project for educational purposes so no need to tell me that using blockchains are overkill for this because I know hah

 

Anyway I want to make sure that if a transaction can only be executed once, hence why I am experimenting with createrawtransaction at the moment.

First I call listunspent 0 and gets:

http://hardmech.com/listunspent.txt

 

Then I call getaddresses to get the distination address I want.

[
    "17fLCcymkJSu3AAkk4Qh5LEKDoeodjHt1YqvMM",
    "1Ynn2CyNSQoeHrsXZqvuygyVs9pBPfydoRhS9X"
]

Then I create a raw transaction.

createrawtransaction '[{"txid":"cd429cbd45b9e8f11e952643cee76853f10651b130aeb4124c0f4c77fe134ed6","vout":1}]' '{"17fLCcymkJSu3AAkk4Qh5LEKDoeodjHt1YqvMM":{"S":1.0}}'

 

I sign it.

signrawtransaction 0100000001d64e13fe774c0f4c12b4ae30b15106f15368e7ce4326951ef1e8b945bd9c42cd0100000000ffffffff0100000000000000003176a91431488a112f7120983744aa4ae8936f0cb5c2dc2588ac1673706b710b0000000901000063f301000000000000007500000000

 

Then I send it.

sendrawtransaction 0100000001d64e13fe774c0f4c12b4ae30b15106f15368e7ce4326951ef1e8b945bd9c42cd010000006b483045022100c0d231fc39a682ad66560e5e456cf53312dbd2b2fe51101a7e0d70c9cff5e7100220290958b19a11aa9c75aba8be7f4ffd2e3b44729d08f5bea268b8fb1d1745e19b0121037a6acdd32387f4fb6b4b48359c3be813f82861f926224b2785077aca2b872e82ffffffff0100000000000000003176a91431488a112f7120983744aa4ae8936f0cb5c2dc2588ac1673706b710b0000000901000063f301000000000000007500000000

 

And gets this error.

error: {"code":-26,"message":"16: Asset transfer script rejected - mismatch in input/output quantities"}

I have no idea how to proceed since from my perspective, the listunspent shows that I have more than enough to spent and it has send permissions... so what am I doing wrong?

 

asked Mar 10, 2016 by anonymous

1 Answer

0 votes
 
Best answer

A transaction needs to be balanced across inputs and outputs - this is why in many cases you need a 'change' output which returns what's left in the inputs back to the sender.

MultiChain makes this easy for you with the appendrawchange API call, which automatically adds on the correct amount of change, sent to the address you provide.

answered Mar 10, 2016 by MultiChain
...