I attempt to signal the next transaction:
020000000001012ca7795bc5ca18f0fd5a1ffb27f31d693b813f6b73b0fd31f4868f88f2d727980100000000ffffffff01e803000000000000160014c221f41ace22b7272a0ab3289bb2df3c36a9e0250000000000
Parsed:
{
"addresses": [
"tb1q4rmg2ah0f5skv9yg43kwzgp457430navtmvwv6",
"tb1qcgslgxkwy2mjw2s2kv5fhvkl8sm2ncp9xanaux"
],
"block_height": -1,
"block_index": -1,
"confirmations": 0,
"double_spend": false,
"charges": 0,
"hash": "01071bbceb3ab921873325bfadef0382fba0e6a74709f96cc4f8799af635cab3",
"inputs": [
{
"addresses": [
"tb1q4rmg2ah0f5skv9yg43kwzgp457430navtmvwv6"
],
"age": 2868502,
"output_index": 1,
"output_value": 1000,
"prev_hash": "9827d7f2888f86f431fdb0736b3f813b691df327fb1f5afdf018cac55b79a72c",
"script_type": "pay-to-witness-pubkey-hash",
"sequence": 4294967295
}
],
"outputs": [
{
"addresses": [
"tb1qcgslgxkwy2mjw2s2kv5fhvkl8sm2ncp9xanaux"
],
"script": "0014c221f41ace22b7272a0ab3289bb2df3c36a9e025",
"script_type": "pay-to-witness-pubkey-hash",
"worth": 1000
}
],
"choice": "low",
"acquired": "2024-07-22T11:23:44.915543755Z",
"relayed_by": "44.192.67.93",
"measurement": 85,
"whole": 1000,
"ver": 2,
"vin_sz": 1,
"vout_sz": 1,
"vsize": 83
}
I take advantage of the next enter (index 1): https://blockstream.information/testnet/tx/9827d7f2888f86f431fdb0736b3f813b691df327fb1f5afdf018cac55b79a72c?develop
In line with this doc (https://github.com/bitcoin/bips/blob/grasp/bip-0143.mediawiki#user-content-Native_P2WPKH), the pre-image hash is:
Double SHA256 of the serialization of:
1. nVersion of the transaction (4-byte little endian)
2. hashPrevouts (32-byte hash)
3. hashSequence (32-byte hash)
4. outpoint (32-byte hash + 4-byte little endian)
5. scriptCode of the enter (serialized as scripts inside CTxOuts)
6. worth of the output spent by this enter (8-byte little endian)
7. nSequence of the enter (4-byte little endian)
8. hashOutputs (32-byte hash)
9. nLocktime of the transaction (4-byte little endian)
10. sighash sort of the signature (4-byte little endian)
My pre-image earlier than double sha256: 0200000032a17c92a47c5d4be8d6238132c848017f59ddacdac33b6c8d3c3ac4508a64ef3bb13029ce7b1f559ef5e747fcac439f1455a2ec7c5f09b72290795e706650442ca7795bc5ca18f0fd5a1ffb27f31d693b813f6b73b0fd31f4868f88f2d72798010000001976a914a8f68576ef4d21661488ac6ce12035a7ab17cfac88ace803000000000000ffffffff39faa805af04ff44720fa4e3de5476ee3cb833676531f48ad8ebf1e6d3001fc20000000001000000
After the signature: 020000000001012ca7795bc5ca18f0fd5a1ffb27f31d693b813f6b73b0fd31f4868f88f2d727980100000000ffffffff01e803000000000000160014c221f41ace22b7272a0ab3289bb2df3c36a9e025024830450221008dab2d55de0b7862b5f2f4bca0d8517915fad356ac38ae1f802034e6e9ec15aa02200f84f0f9e1a239a4bbd1bde5c3d8b0900d91ed0af9fd666922a794c182b658fb01210318e6317e8cb99d5be4fe863a63c9a365f58361f9196448c569a8ee3802ddd70300000000
Public Key: 0418e6317e8cb99d5be4fe863a63c9a365f58361f9196448c569a8ee3802ddd703cd7cd3767ad5330d27ef4db83adb02554decc2ed45fd7a16aa0cd663384693a7
Compressed Public Key: 0318e6317e8cb99d5be4fe863a63c9a365f58361f9196448c569a8ee3802ddd703
when I attempt to broadcast it, I get: error code: -25 error message: bad-txns-inputs-missingorspent
my questions are:
-
What ought to be the output script 76a914 output_address 88ac, or 0014 output_address? Why does this doc describe the legacy format of the output https://github.com/bitcoin/bips/blob/grasp/bip-0143.mediawiki#user-content-Native_P2WPKH ?
-
Is my pre-image right?
-
is my segwit script for the enter right?
{
“stackitems”: “02”,
“0”: {
“measurement”: “48”,
“merchandise”: “30450221008dab2d55de0b7862b5f2f4bca0d8517915fad356ac38ae1f802034e6e9ec15aa02200f84f0f9e1a239a4bbd1bde5c3d8b0900d91ed0af9fd666922a794c182b658fb01”
},
“1”: {
“measurement”: “21”,
“merchandise”: “0318e6317e8cb99d5be4fe863a63c9a365f58361f9196448c569a8ee3802ddd703”
} -
What sort of public key should be used for handle era and segwit? Full or compressed?
-
What else may be unsuitable right here? 🙂
Replace:
I diminished the output quantity:
Now pre-image is: 0200000032a17c92a47c5d4be8d6238132c848017f59ddacdac33b6c8d3c3ac4508a64ef3bb13029ce7b1f559ef5e747fcac439f1455a2ec7c5f09b72290795e706650442ca7795bc5ca18f0fd5a1ffb27f31d693b813f6b73b0fd31f4868f88f2d72798010000001976a914a8f68576ef4d21661488ac6ce12035a7ab17cfac88ace803000000000000ffffffff9ad50ca3ecd096afa146edd608c66350fd1546c36876d728004cc40428b474250000000001000000
The ultimate transaction is: 020000000001012ca7795bc5ca18f0fd5a1ffb27f31d693b813f6b73b0fd31f4868f88f2d727980100000000ffffffff019001000000000000160014c221f41ace22b7272a0ab3289bb2df3c36a9e02502483045022100d13d1f8ec58cf0df2963986f36977bd7d12304bc69d375c8f02d959b23261f3702206d2e7f08eb3f67cb517a0ae9515ff22d676b944cf564d40ab54df6410b92a5c101210318e6317e8cb99d5be4fe863a63c9a365f58361f9196448c569a8ee3802ddd70300000000
And the error is: {"code":-26,"message":"non-mandatory-script-verify-flag (Signature should be zero for failed CHECK(MULTI)SIG operation)"}
- How can I confirm the signature?