<p>I'm using btcsuite (especially <a href="https://github.com/foxnut/go-hdwallet/blob/master/example/createRawTransaction/main.go" rel="nofollow noreferrer">this example</a>) package to listen and send unspent inputs for specific address.</p>
<p>Tx <a href="https://www.blockchain.com/btc-testnet/tx/690059e82dcee13678c45f2c583207d357af254624f5037b4d4d12b39caf74ca" rel="nofollow noreferrer">hash</a>: <code>690059e82dcee13678c45f2c583207d357af254624f5037b4d4d12b39caf74ca</code></p>
<p>From address: <code>mkdaWH9TeZB79vJsLkAU9vYKgAASkjRtWh</code></p>
<p>To address: <code>mkirYMeQ8WNCHRFo7rRjADHNDVTqYjrNUg</code></p>
<p>Raw transaction: <code>0100000001ca74af9cb3124d4d7b03f5244625af57d30732582c5fc47836e1ce2de8590069000000008b483045022100d50f5c0a49cc7307ee8ee450622a6442606aeed02bd7835ee8cde8f553ac25da02201c3fe5c99f3264cd70bc0837d136839ea1fb5b807d10205d1a54a9cb5419cb780141047da316f92b23e3235a0d2ef8ea8ee66a85f2864dd3aa01da669a108c90ef18212c3a4a233e9409a124e0e04f0d1341a6e58f36a62c1c4c04601e6230fe601365ffffffff0127110000000000001976a9143918d158eb42fbc602da0795d0664b9830ef08db88ac00000000</code></p>
<p>Result: <code>-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)</code></p>
<p>Gist code example (some values are hardcoded): <a href="https://gist.github.com/aemet93/252ed5479d5db74b3da5cc0b608b4d57" rel="nofollow noreferrer">https://gist.github.com/aemet93/252ed5479d5db74b3da5cc0b608b4d57</a></p>

CC BY-SA 4.0
2022-02-20T10:38:13.190Z
Doesn't that just mean the HASH160 of the key you specified does not equal the expected value 38195a17cb2a6e7f9992c40aa0adeec12570c407 in the referenced input TX?
RedGrittyBrick
CC BY-SA 4.0
2022-02-20T12:11:41.767Z
Don't you have working example with github.com/foxnut/go-hdwallet manager?
nomvd
CC BY-SA 4.0
2022-02-20T12:32:44.467Z
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
<raw-transaction><btcd>
Cant send raw transaction from golang with OP_EQUALVERIFY failed
nomvd
# Cant send raw transaction from golang with OP_EQUALVERIFY failed

(Asked by: username_0 on 2022-02-19)

I'm using btcsuite (especially [this example](https://github.com/foxnut/go-hdwallet/blob/master/example/createRawTransaction/main.go)) package to listen and send unspent inputs for specific address.

Tx [hash](https://www.blockchain.com/btc-testnet/tx/690059e82dcee13678c45f2c583207d357af254624f5037b4d4d12b39caf74ca): `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>

**Tags:** raw-transaction, btcd

> **Comments:**
> **username_1**: Doesn't that just mean the HASH160 of the key you specified does not equal the expected value 38195a17cb2a6e7f9992c40aa0adeec12570c407 in the referenced input TX?  
> **username_0**: Don't you have working example with github.com/foxnut/go-hdwallet manager?  
> **username_0**: 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 @username_1 for the way to think.  

---

## 0 answers

