Author

Topic: Using Createrawtransaction Got no-witness-yet Error (Read 252 times)

newbie
Activity: 1
Merit: 0
Hi there i meet the same problem,Could i know did u slove the problem?
newbie
Activity: 20
Merit: 0
How can I spend money using createrawtransaction? I am not familiar with Segwit...
createrawtransaction is unrelated to this or to segwit. The problem is that the wallet assumes segwit is enabled by default, but segwit is not enabled according to your network rules. So you either have to enable segwit in the network rules, or change the wallet to assume segwit is disabled. How you do that you will need to figure out yourself.

Thank you. You gave me a helpful info.
staff
Activity: 3374
Merit: 6530
Just writing some code
How can I spend money using createrawtransaction? I am not familiar with Segwit...
createrawtransaction is unrelated to this or to segwit. The problem is that the wallet assumes segwit is enabled by default, but segwit is not enabled according to your network rules. So you either have to enable segwit in the network rules, or change the wallet to assume segwit is disabled. How you do that you will need to figure out yourself.
newbie
Activity: 20
Merit: 0
Code:
      "txid": "551ba4bde3460bca6a6cae7da57ffd8b3f1baf18ad7a2e6d50f8d4f5b0a94e14",
      "vout": 1,
      "scriptSig": {
        "asm": "0014620cfaeb631c99d45490cc6560a7258835c260f8",
        "hex": "160014620cfaeb631c99d45490cc6560a7258835c260f8"
      },
      "txinwitness": [
        "3045022100a1e4403c6327fb787ef498cfaf6c54f8372f2792c06a7156cad6cf15c729de2802201eb1b48e2443b04688091897caf0fc9afbfc002227c05441a5f1723be9a532e401",
        "02533dc7b0e2d8f359fb235fd52bcda6135cfb0e39c6d9d93a10704457ff30e6ff"
      ],
      "sequence": 4294967295
    }
This is your problem, the input you are spending is a segwit input. You will need to figure out how to prevent your fork from creating segwit outputs that can be spent as inputs.

Thank you very much for your reply.

How can I spend money using createrawtransaction? I am not familiar with Segwit...
staff
Activity: 3374
Merit: 6530
Just writing some code
Code:
      "txid": "551ba4bde3460bca6a6cae7da57ffd8b3f1baf18ad7a2e6d50f8d4f5b0a94e14",
      "vout": 1,
      "scriptSig": {
        "asm": "0014620cfaeb631c99d45490cc6560a7258835c260f8",
        "hex": "160014620cfaeb631c99d45490cc6560a7258835c260f8"
      },
      "txinwitness": [
        "3045022100a1e4403c6327fb787ef498cfaf6c54f8372f2792c06a7156cad6cf15c729de2802201eb1b48e2443b04688091897caf0fc9afbfc002227c05441a5f1723be9a532e401",
        "02533dc7b0e2d8f359fb235fd52bcda6135cfb0e39c6d9d93a10704457ff30e6ff"
      ],
      "sequence": 4294967295
    }
This is your problem, the input you are spending is a segwit input. You will need to figure out how to prevent your fork from creating segwit outputs that can be spent as inputs.
newbie
Activity: 20
Merit: 0
Can you also post what your final signed transaction looks like?

getrawchangeaddress shows this:

Code:
3PgBJaR5fCw9nBtij7THqfHbbENdCdFEuv
This will be a problem for you later because that is a segwit address and you do not have segwit enabled.

Thank you for your reply.

It looks like this:

Code:
{
  "txid": "391c0428614cb7f966bba368c3b83050d81f17190125b686e1434562bb82edd4",
  "hash": "6dc00133fa2043cda29d610f087c739fcc65f4a4efc4f0bc5058bcd003bd7f61",
  "version": 2,
  "size": 251,
  "vsize": 169,
  "locktime": 0,
  "vin": [
    {
      "txid": "551ba4bde3460bca6a6cae7da57ffd8b3f1baf18ad7a2e6d50f8d4f5b0a94e14",
      "vout": 1,
      "scriptSig": {
        "asm": "0014620cfaeb631c99d45490cc6560a7258835c260f8",
        "hex": "160014620cfaeb631c99d45490cc6560a7258835c260f8"
      },
      "txinwitness": [
        "3045022100a1e4403c6327fb787ef498cfaf6c54f8372f2792c06a7156cad6cf15c729de2802201eb1b48e2443b04688091897caf0fc9afbfc002227c05441a5f1723be9a532e401",
        "02533dc7b0e2d8f359fb235fd52bcda6135cfb0e39c6d9d93a10704457ff30e6ff"
      ],
      "sequence": 4294967295
    }
  ],
  "vout": [
    {
      "value": 0.00000000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_RETURN 4d79206e616d65206973205a68616e672048616f7169616e",
        "hex": "6a184d79206e616d65206973205a68616e672048616f7169616e",
        "type": "nulldata"
      }
    },
    {
      "value": 48.99984900,
      "n": 1,
      "scriptPubKey": {
        "asm": "OP_HASH160 360ba84dc5961b64e67d75dd623a26c31d98beb9 OP_EQUAL",
        "hex": "a914360ba84dc5961b64e67d75dd623a26c31d98beb987",
        "reqSigs": 1,
        "type": "scripthash",
        "addresses": [
          "36cnNsjRuaP6cLGPFRXycaetmvmog5Wnyn"
        ]
      }
    }
  ]
}
staff
Activity: 3374
Merit: 6530
Just writing some code
Can you also post what your final signed transaction looks like?

getrawchangeaddress shows this:

Code:
3PgBJaR5fCw9nBtij7THqfHbbENdCdFEuv
This will be a problem for you later because that is a segwit address and you do not have segwit enabled.
newbie
Activity: 20
Merit: 0
I did not include any Segwit in any transaction. why does it show here?
Are you sure? If you forked from the latest Bitcoin Core, it uses segwit by default. Can you post what the changeaddress looks like and what the output of listunspent looks like?

Thank you for your reply.

I forked 0.16 bitcoin core.

getrawchangeaddress shows this:

Code:
3PgBJaR5fCw9nBtij7THqfHbbENdCdFEuv

listunspent shows this:

Code:
  {
    "txid": "4bffb171833ca3fe5fe5f272a482161809be371131f89f6c116d695096c60afe",
    "vout": 0,
    "address": "1A6csP8jrpyruyW4a9tX9Nonv4R8AviB1y",
    "account": "",
    "scriptPubKey": "76a91463c9274bf6297bd724ad66eafab4fd94f7c9714488ac",
    "amount": 50.00000000,
    "confirmations": 21,
    "spendable": true,
    "solvable": true,
    "safe": true
  },
  {
    "txid": "efd172501ea2760738987a3d4865dc41aae2cc988d02e08860f939166ad97bff",
    "vout": 0,
    "address": "1A6csP8jrpyruyW4a9tX9Nonv4R8AviB1y",
    "account": "",
    "scriptPubKey": "76a91463c9274bf6297bd724ad66eafab4fd94f7c9714488ac",
    "amount": 50.00000000,
    "confirmations": 46,
    "spendable": true,
    "solvable": true,
    "safe": true
  }
staff
Activity: 3374
Merit: 6530
Just writing some code
I did not include any Segwit in any transaction. why does it show here?
Are you sure? If you forked from the latest Bitcoin Core, it uses segwit by default. Can you post what the changeaddress looks like and what the output of listunspent looks like?
staff
Activity: 3374
Merit: 6530
Just writing some code
This error means that you are trying to spend from or create segwit outputs without segwit being activated yet. Is your node fully synced?
newbie
Activity: 20
Merit: 0
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!
Jump to: