0

I'm using btcsuite (especially this example) package to listen and send unspent inputs for specific address.

Tx hash: 690059e82dcee13678c45f2c583207d357af254624f5037b4d4d12b39caf74ca

From address: mkdaWH9TeZB79vJsLkAU9vYKgAASkjRtWh

To address: mkirYMeQ8WNCHRFo7rRjADHNDVTqYjrNUg

Raw transaction: 0100000001ca74af9cb3124d4d7b03f5244625af57d30732582c5fc47836e1ce2de8590069000000008b483045022100d50f5c0a49cc7307ee8ee450622a6442606aeed02bd7835ee8cde8f553ac25da02201c3fe5c99f3264cd70bc0837d136839ea1fb5b807d10205d1a54a9cb5419cb780141047da316f92b23e3235a0d2ef8ea8ee66a85f2864dd3aa01da669a108c90ef18212c3a4a233e9409a124e0e04f0d1341a6e58f36a62c1c4c04601e6230fe601365ffffffff0127110000000000001976a9143918d158eb42fbc602da0795d0664b9830ef08db88ac00000000

Result: -25: TX rejected: failed to validate input 9a2f1724f86540620c1f976cc5c294ba0a59e03ccbdeadf3fe2cbe470d0b9f45:0 which references output 690059e82dcee13678c45f2c583207d357af254624f5037b4d4d12b39caf74ca:0 - OP_EQUALVERIFY failed (input witness [], input script bytes 483045022100d50f5c0a49cc7307ee8ee450622a6442606aeed02bd7835ee8cde8f553ac25da02201c3fe5c99f3264cd70bc0837d136839ea1fb5b807d10205d1a54a9cb5419cb780141047da316f92b23e3235a0d2ef8ea8ee66a85f2864dd3aa01da669a108c90ef18212c3a4a233e9409a124e0e04f0d1341a6e58f36a62c1c4c04601e6230fe601365, prev output script bytes 76a91438195a17cb2a6e7f9992c40aa0adeec12570c40788ac)

Gist code example (some values are hardcoded): https://gist.github.com/aemet93/252ed5479d5db74b3da5cc0b608b4d57

3
  • Doesn't that just mean the HASH160 of the key you specified does not equal the expected value 38195a17cb2a6e7f9992c40aa0adeec12570c407 in the referenced input TX? Feb 20, 2022 at 10:38
  • Don't you have working example with github.com/foxnut/go-hdwallet manager?
    – nomvd
    Feb 20, 2022 at 12:11
  • I just realised what was wrong. Here is it: sig, err := txscript.SignatureScript(tx, index, script, txscript.SigHashAll, wif.PrivKey, false) <- last argument is compressed was set to false. It needs to be true. Thank you @RedGrittyBrick for the way to think.
    – nomvd
    Feb 20, 2022 at 12:32

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.