<p>The signature is actually correct. However something may be going on with the tool, either you are introducing the parameters in an unexpected format or the tool is not properly working (I haven't been able to verify the signature using the tool either). </p>

<p>Here you have some simple code that uses <a href="https://github.com/vbuterin/pybitcointools" rel="nofollow noreferrer">VButerin's Bitcoin tools python library</a> and verifies that the signature is correct:</p>

<pre><code>from bitcoin import ecdsa_tx_verify

unsigned_tx = "0100000001eccf7e3034189b851985d871f91384b8ee357cd47c3024736e5676eb2debb3f2010000001976a914010966776006953d5567439e5e39f86a0d273bee88acffffffff01605af405000000001976a914097072524438d003d23a2f23edb65aae1bb3e46988ac00000000"
sig = "30460221009e0339f72c793a89e664a8a932df073962a3f84eda0bd9e02084a6a9567f75aa022100bd9cbaca2e5ec195751efdfac164b76250b1e21302e51ca86dd7ebd7020cdc0601"  # WITH SIG_FLAG
pk = "0450863ad64a87ae8a2fe83c1af1a8403cb53f53e486d8511dad8a04887e5b23522cd470243453a299fa9e77237716103abc11a1df38855ed6f2ee187e9c582ba6"
sig_flag = 1  #SIGHASH_ALL

print ecdsa_tx_verify(unsigned_tx, sig, pk, sig_flag)
</code></pre>

<p>That outputs:</p>

<pre><code>True
</code></pre>

<p>Notice that <code>unsigned_tx</code> has been built using all the field from <a href="https://bitcoin.stackexchange.com/questions/3374/how-to-redeem-a-basic-tx">Step 13</a> but the very last one, that corresponds to the hashtype (4 bytes, 01000000). <code>sig</code> corresponds to the signature adding the hashtype (1 byte, 01), and the pk (<code>public key</code>) corresponds to the one given in <a href="https://bitcoin.stackexchange.com/questions/3374/how-to-redeem-a-basic-tx">Step 15</a>.</p>

CC BY-SA 3.0
2017-07-19T17:13:27.710Z
Why is the signature in Hex but when I generate it using Multibit or some library, it will return Base64?
user2349425
CC BY-SA 3.0
2017-07-19T18:32:10.383Z
This may help you: https://bitcoin.stackexchange.com/q/12554/30668
sr_gi
CC BY-SA 3.0
2017-07-19T15:15:29.910Z
2017-07-19T15:23:51.240Z
2017-07-19T15:23:51.240Z
sr_gi
<p>I refer to this site <a href="https://bitcoin.stackexchange.com/questions/3374/how-to-redeem-a-basic-tx">How to redeem a basic Tx?</a></p>
<blockquote>
<ol start="14">
<li><p>(signing stage) Now we double-SHA256 hash this entire structure, which
yields the hash
9302bda273a887cb40c13e02a50b4071a31fd3aae3ae04021b0b843dd61ad18e</p>
</li>
<li><p>We then create a public/private key pair out of the provided private key.
We sign the hash from step 14 with the private key, which yields the
following DER-encoded signature (this signature will be different in
your case):
30460221009e0339f72c793a89e664a8a932df073962a3f84eda0bd9e02084a6a9567f75aa022100bd9cbaca2e5ec195751efdfac164b76250b1e21302e51ca86dd7ebd7020cdc06
To this signature we append the one-byte hash code type: 01. The
public key is:
0450863ad64a87ae8a2fe83c1af1a8403cb53f53e486d8511dad8a04887e5b23522cd470243453a299fa9e77237716103abc11a1df38855ed6f2ee187e9c582ba6</p>
</li>
</ol>
</blockquote>
<p>I try to verify whether the message is correct</p>
<p>The message is <strong>9302bda273a887cb40c13e02a50b4071a31fd3aae3ae04021b0b843dd61ad18e</strong>,
The public key is <strong>mfcSEPR8EkJrpX91YkTJ9iscdAzppJrG9j</strong>, and The signature is <strong>30460221009e0339f72c793a89e664a8a932df073962a3f84eda0bd9e02084a6a9567f75aa022100bd9cbaca2e5ec195751efdfac164b76250b1e21302e51ca86dd7ebd7020cdc06</strong></p>
<p>However, when I verify it on <a href="http://www.coinig.com/" rel="nofollow noreferrer">http://www.coinig.com/</a>, signature is wrong. Why is it so? Thank you</p>

<signature>
Signature on Bitcoin. What am I doing wrong?
user2349425
# Signature on Bitcoin. What am I doing wrong?

(Asked by: username_0 on 2017-07-19)

I refer to this site [How to redeem a basic Tx?](https://bitcoin.stackexchange.com/questions/3374/how-to-redeem-a-basic-tx)

> 14. (signing stage) Now we double-SHA256 hash this entire structure, which
>     yields the hash
>     9302bda273a887cb40c13e02a50b4071a31fd3aae3ae04021b0b843dd61ad18e
> 15. We then create a public/private key pair out of the provided private key.
>     We sign the hash from step 14 with the private key, which yields the
>     following DER-encoded signature (this signature will be different in
>     your case):
>     30460221009e0339f72c793a89e664a8a932df073962a3f84eda0bd9e02084a6a9567f75aa022100bd9cbaca2e5ec195751efdfac164b76250b1e21302e51ca86dd7ebd7020cdc06
>     To this signature we append the one-byte hash code type: 01. The
>     public key is:
>     0450863ad64a87ae8a2fe83c1af1a8403cb53f53e486d8511dad8a04887e5b23522cd470243453a299fa9e77237716103abc11a1df38855ed6f2ee187e9c582ba6

I try to verify whether the message is correct

The message is **9302bda273a887cb40c13e02a50b4071a31fd3aae3ae04021b0b843dd61ad18e**,
The public key is **mfcSEPR8EkJrpX91YkTJ9iscdAzppJrG9j**, and The signature is **30460221009e0339f72c793a89e664a8a932df073962a3f84eda0bd9e02084a6a9567f75aa022100bd9cbaca2e5ec195751efdfac164b76250b1e21302e51ca86dd7ebd7020cdc06**

However, when I verify it on <http://www.coinig.com/>, signature is wrong. Why is it so? Thank you

**Tags:** signature


---

## 1 answers

### Answer by username_1 on 2017-07-19. Score: 0 | Accepted answer

The signature is actually correct. However something may be going on with the tool, either you are introducing the parameters in an unexpected format or the tool is not properly working (I haven't been able to verify the signature using the tool either). 
Here you have some simple code that uses VButerin's Bitcoin tools python library and verifies that the signature is correct:
from bitcoin import ecdsa_tx_verify

unsigned_tx = "0100000001eccf7e3034189b851985d871f91384b8ee357cd47c3024736e5676eb2debb3f2010000001976a914010966776006953d5567439e5e39f86a0d273bee88acffffffff01605af405000000001976a914097072524438d003d23a2f23edb65aae1bb3e46988ac00000000"
sig = "30460221009e0339f72c793a89e664a8a932df073962a3f84eda0bd9e02084a6a9567f75aa022100bd9cbaca2e5ec195751efdfac164b76250b1e21302e51ca86dd7ebd7020cdc0601"  # WITH SIG_FLAG
pk = "0450863ad64a87ae8a2fe83c1af1a8403cb53f53e486d8511dad8a04887e5b23522cd470243453a299fa9e77237716103abc11a1df38855ed6f2ee187e9c582ba6"
sig_flag = 1  #SIGHASH_ALL

print ecdsa_tx_verify(unsigned_tx, sig, pk, sig_flag)

That outputs:
True

Notice that unsigned_tx has been built using all the field from Step 13 but the very last one, that corresponds to the hashtype (4 bytes, 01000000). sig corresponds to the signature adding the hashtype (1 byte, 01), and the pk (public key) corresponds to the one given in Step 15.

> **Comments:**
> **username_0**: Why is the signature in Hex but when I generate it using Multibit or some library, it will return Base64?  
> **username_1**: This may help you: https://bitcoin.stackexchange.com/q/12554/30668  

---

