Post
Topic
Board Bitcoin Technical Support
Using Createrawtransaction Got no-witness-yet Error
by
haoqian
on 03/05/2018, 14:32:40 UTC
Hi, I am trying to use createrawtransaction.

When I use following code:

Code:
op_return_data="4d79206e616d65"
utxo_txid=$(~/bitcoin/src/bitcoin-cli listunspent | jq -r '.[0] | .txid')
utxo_vout=$(~/bitcoin/src/bitcoin-cli listunspent | jq -r '.[0] | .vout')
utxo_balance=$(~/bitcoin/src/bitcoin-cli listunspent | jq -r '.[0] | .amount')
new_balance=$(echo "$utxo_balance - 0.0001" | bc | awk '{printf "%f", $0}')
changeaddress=$(~/bitcoin/src/bitcoin-cli getrawchangeaddress)
rawtxhex=$(~/bitcoin/src/bitcoin-cli -named createrawtransaction inputs='''[ { "txid": "'$utxo_txid'", "vout": '$utxo_vout' } ]''' outputs='''{ "data": "'$op_return_data'", "'$changeaddress'": "'$new_balance'" }''')
signedhex=$(~/bitcoin/src/bitcoin-cli signrawtransaction $rawtxhex | jq -r .hex)
~/bitcoin/src/bitcoin-cli sendrawtransaction $signedhex

It will get :

Code:
error code: -26
error message:
64: no-witness-yet

I do not know why. How to solve it? Could you help me?

Thanks!