signing doesnt seem to be filling in the scriptSig:
create a raw transaction
bitcoin-cli -regtest createrawtransaction '[{"txid" : "3341d9c785babbbc7af1d85493c4ba55edff41b4ff8489844f9c3ecdcb02f0fe","vout" : 0}]' '{"bcrt1qzlxnp6kh87m8zczdy7fjamy8ed66r5ecwjyqd3" : 0.00001, "bcrt1qfv6au9q2u2gmdf7q0059ls85detepmhrdp3k8s" : 0.01}'
0200000001fef002cbcd3e9c4f848984ffb441ffed55bac49354d8f17abcbbba85c7d941330000000000ffffffff02e80300000000000016001417cd30ead73fb671604d27932eec87cb75a1d33840420f00000000001600144b35de140ae291b6a7c07be85fc0f46e5790eee300000000
bitcoin-cli -regtest decoderawtransaction 0200000001fef002cbcd3e9c4f848984ffb441ffed55bac49354d8f17abcbbba85c7d941330000000000ffffffff02e80300000000000016001417cd30ead73fb671604d27932eec87cb75a1d33840420f00000000001600144b35de140ae291b6a7c07be85fc0f46e5790eee300000000
{
"txid": "e13fb06c235a458cac144670cf245fc0f1e8b8b3352a708057c5446fd9b28f47",
"hash": "e13fb06c235a458cac144670cf245fc0f1e8b8b3352a708057c5446fd9b28f47",
"version": 2,
"size": 113,
"vsize": 113,
"weight": 452,
"locktime": 0,
"vin": [
{
"txid": "3341d9c785babbbc7af1d85493c4ba55edff41b4ff8489844f9c3ecdcb02f0fe",
"vout": 0,
"scriptSig": {
"asm": "",
"hex": ""
},
"sequence": 4294967295
}
],
"vout": [
{
"value": 0.00001000,
"n": 0,
"scriptPubKey": {
"asm": "0 17cd30ead73fb671604d27932eec87cb75a1d338",
"hex": "001417cd30ead73fb671604d27932eec87cb75a1d338",
"reqSigs": 1,
"type": "witness_v0_keyhash",
"addresses": [
"bcrt1qzlxnp6kh87m8zczdy7fjamy8ed66r5ecwjyqd3"
]
}
},
{
"value": 0.01000000,
"n": 1,
"scriptPubKey": {
"asm": "0 4b35de140ae291b6a7c07be85fc0f46e5790eee3",
"hex": "00144b35de140ae291b6a7c07be85fc0f46e5790eee3",
"reqSigs": 1,
"type": "witness_v0_keyhash",
"addresses": [
"bcrt1qfv6au9q2u2gmdf7q0059ls85detepmhrdp3k8s"
]
}
}
]
}
sign it:
bitcoin-cli -regtest signrawtransactionwithwallet 0200000001fef002cbcd3e9c4f848984ffb441ffed55bac49354d8f17abcbbba85c7d941330000000000ffffffff02e80300000000000016001417cd30ead73fb671604d27932eec87cb75a1d33840420f00000000001600144b35de140ae291b6a7c07be85fc0f46e5790eee300000000
{
"hex": "02000000000101fef002cbcd3e9c4f848984ffb441ffed55bac49354d8f17abcbbba85c7d941330000000000ffffffff02e80300000000000016001417cd30ead73fb671604d27932eec87cb75a1d33840420f00000000001600144b35de140ae291b6a7c07be85fc0f46e5790eee30247304402200d9d7c05551740ce78d5ba54d62cf103a388c68ef7662a3e09a69e7b03681166022071456a90fd1ce149dd662d251b3a2dddbce3a52f52db1bb76f33fda34e441edb0121033430f2bdff5c1ddca22ba75402febb7e0671004ebbb6aef0582ee47b4590f33e00000000",
"complete": true
}
Decode again
Emmett@MDs-MacBook-Pro bitcoin % bitcoin-cli -regtest decoderawtransaction 0200000001fef002cbcd3e9c4f848984ffb441ffed55bac49354d8f17abcbbba85c7d941330000000000ffffffff02e80300000000000016001417cd30ead73fb671604d27932eec87cb75a1d33840420f00000000001600144b35de140ae291b6a7c07be85fc0f46e5790eee300000000
{
"txid": "e13fb06c235a458cac144670cf245fc0f1e8b8b3352a708057c5446fd9b28f47",
"hash": "e13fb06c235a458cac144670cf245fc0f1e8b8b3352a708057c5446fd9b28f47",
"version": 2,
"size": 113,
"vsize": 113,
"weight": 452,
"locktime": 0,
"vin": [
{
"txid": "3341d9c785babbbc7af1d85493c4ba55edff41b4ff8489844f9c3ecdcb02f0fe",
"vout": 0,
"scriptSig": {
"asm": "",
"hex": ""
},
"sequence": 4294967295
}
],
"vout": [
{
"value": 0.00001000,
"n": 0,
"scriptPubKey": {
"asm": "0 17cd30ead73fb671604d27932eec87cb75a1d338",
"hex": "001417cd30ead73fb671604d27932eec87cb75a1d338",
"reqSigs": 1,
"type": "witness_v0_keyhash",
"addresses": [
"bcrt1qzlxnp6kh87m8zczdy7fjamy8ed66r5ecwjyqd3"
]
}
},
{
"value": 0.01000000,
"n": 1,
"scriptPubKey": {
"asm": "0 4b35de140ae291b6a7c07be85fc0f46e5790eee3",
"hex": "00144b35de140ae291b6a7c07be85fc0f46e5790eee3",
"reqSigs": 1,
"type": "witness_v0_keyhash",
"addresses": [
"bcrt1qfv6au9q2u2gmdf7q0059ls85detepmhrdp3k8s"
]
}
}
]
}
shouldnt script sig been filled in above ?
Now we need to broadcast the transaction:
Emmett@MDs-MacBook-Pro bitcoin % bitcoin-cli -regtest sendrawtransaction 0200000001fef002cbcd3e9c4f848984ffb441ffed55bac49354d8f17abcbbba85c7d941330000000000ffffffff02e80300000000000016001417cd30ead73fb671604d27932eec87cb75a1d33840420f00000000001600144b35de140ae291b6a7c07be85fc0f46e5790eee300000000
error code: -26
error message:
non-mandatory-script-verify-flag (Witness program hash mismatch)