<p>Seems to me that it is not correct</p>

<p><strike>Sorry, I do not have a tool rigth now, and creating data manually is a little bit difficult and I may create errors also</strike> See update below</p>

<p>There should be something like this</p>

<pre><code>01000000
01
e3dbc4fada0034ad8581cb429af4953d7d092b137ebd9e193344db376314ab65 00000000
1976a914 f65d5c02866b8cea5840b2f9fb739f2e6ee6c8f4 88ac
ffffffff
02
1004df0200000000 1976a914 7e7fe35e49f0e8a920780c00d40b7171d8808119 88ac
c05f3b0400000000 1976a914 942920e041353162b0d8bd006d09c2ca25cdc278 88ac
00000000
01000000
</code></pre>

<p><strong>Update</strong>: Here is a piece of my checking code. </p>

<pre><code>const QByteArray xx ( QByteArray::fromHex ( "01000000"
"01"
"e3dbc4fada0034ad8581cb429af4953d7d092b137ebd9e193344db376314ab65 00000000"
"1976a914 f65d5c02866b8cea5840b2f9fb739f2e6ee6c8f4 88ac"
"ffffffff"
"02"
"1004df0200000000 1976a914 7e7fe35e49f0e8a920780c00d40b7171d8808119 88ac"
"c05f3b0400000000 1976a914 942920e041353162b0d8bd006d09c2ca25cdc278 88ac"
"00000000"
"01000000" ) );
const MyKey32 digest ( xx.constData ( ), xx.size ( ) ); // construct object of sha256 (sha256 ( xx ) )
_trace ( digest.toStringRev ( ) );                      // print result
const QByteArray pubkey ( QByteArray::fromHex ( "036a6d9c781613b2f07607b240e019fb2344704258e63df4802a436302942e73d3" ) );
const QByteArray signature ( QByteArray::fromHex ( "30450221008f1bcf2624da3b423ca19eb9eb6c8fb84e6614cd603cbf9f2f1d8c7103534138022038190065341fd3cd4a697ee1ca02f5b1f1131a5268ba9df5d976e782a5edc379" ) );
_trace ( QString ( "verify=%1" ).arg ( digest.verify ( pubkey, signature ) ) );
</code></pre>

<p>and the result is</p>

<pre><code>"f71aa6b6127ce9229d9607c0ee133d8195f91b14fe7d554ef8a6a40d99338426"
"verify=1"
</code></pre>

CC BY-SA 3.0
2016-10-31T09:08:50.353Z
I'd like to know how you got `f65d5c02866b8cea5840b2f9fb739f2e6ee6c8f4`
prof.Zoom
CC BY-SA 3.0
2016-10-31T09:52:45.840Z
this is funding script from https://blockchain.info/tx/65ab146337db4433199ebd7e132b097d3d95f49a42cb8185ad3400dafac4dbe3?show_adv=true
amaclin
CC BY-SA 3.0
2016-10-31T09:58:55.673Z
Thanks!
 sha256(sha256(your modified transaction)) gives: `0xf71aa6b6127ce9229d9607c0ee133d8195f91b14fe7d554ef8a6a40d99338426`
Is there any way I can verify the z value?
prof.Zoom
CC BY-SA 3.0
2016-10-31T10:05:39.550Z
sorry, i do not have a tool mentioned in http://bitcoin.stackexchange.com/questions/32305/how-does-the-ecdsa-verification-algorithm-work-during-transaction right now. you have to check signature yourself
amaclin
CC BY-SA 3.0
2016-10-31T12:12:40.117Z
Thanks! your explanation is convincing. Although I couldn't verify due to my limited knowledge about ECDSA signature. I'll accept this answer if I'm able to verify.
prof.Zoom
CC BY-SA 3.0
2016-10-31T18:45:39.780Z
I've checked the digest. It was created correctly and the signature matches the public key. The answer updated.
amaclin
CC BY-SA 3.0
2016-10-31T08:52:11.433Z
2016-10-31T19:04:21.230Z
2016-10-31T19:04:21.230Z
amaclin
<p>After reading this:
<a href="https://bitcoin.stackexchange.com/questions/25814/ecdsa-signature-and-the-z-value">ECDSA Signature and the &quot;z&quot; value</a></p>

<p>I'm still confused about the 'Z' value, for this transaction:
 <a href="https://blockchain.info/tx/ea6aa5d49b8e351e307bf9220f2d7cd31d41e640683539e00580e17cb4cf3e36?show_adv=true" rel="nofollow noreferrer">https://blockchain.info/tx/ea6aa5d49b8e351e307bf9220f2d7cd31d41e640683539e00580e17cb4cf3e36?show_adv=true</a></p>

<blockquote>
  <p>the signature is in the input script, and uses the output script of it's source transaction when calculating the message hash. So the nr of outputs to the transaction does not matter, they are always hashed unmodified into the messagehash for each input. – Willem Hengeveld </p>
</blockquote>

<p>I find the above quote confusing, sorry!</p>

<p>This is what I hashed:
<code>
01000000
01
e3dbc4fada0034ad8581cb429af4953d7d092b137ebd9e193344db376314ab65000000001976a9147e7fe35e49f0e8a920780c00d40b7171d880811988ac1976a914942920e041353162b0d8bd006d09c2ca25cdc27888acffffffff
02
1004df02000000001976a9147e7fe35e49f0e8a920780c00d40b7171d880811988ac
c05f3b04000000001976a914942920e041353162b0d8bd006d09c2ca25cdc27888ac
00000000
01000000</code></p>

<p>And got this: </p>

<p><code>0x76041b6949563e76d77012f9723bec3c7a1a21fd84c74bb58df47087cef056d7</code></p>

<p>Is it correct? Is there a way to verify it? </p>

<signature>
Calculating Z value in a tx with 1 input and 2 outputs
prof.Zoom
# Calculating Z value in a tx with 1 input and 2 outputs

(Asked by: username_0 on 2016-10-31)

After reading this:
[ECDSA Signature and the "z" value](https://bitcoin.stackexchange.com/questions/25814/ecdsa-signature-and-the-z-value)

I'm still confused about the 'Z' value, for this transaction:
<https://blockchain.info/tx/ea6aa5d49b8e351e307bf9220f2d7cd31d41e640683539e00580e17cb4cf3e36?show_adv=true>

> the signature is in the input script, and uses the output script of it's source transaction when calculating the message hash. So the nr of outputs to the transaction does not matter, they are always hashed unmodified into the messagehash for each input. – Willem Hengeveld

I find the above quote confusing, sorry!

This is what I hashed:
`01000000
01
e3dbc4fada0034ad8581cb429af4953d7d092b137ebd9e193344db376314ab65000000001976a9147e7fe35e49f0e8a920780c00d40b7171d880811988ac1976a914942920e041353162b0d8bd006d09c2ca25cdc27888acffffffff
02
1004df02000000001976a9147e7fe35e49f0e8a920780c00d40b7171d880811988ac
c05f3b04000000001976a914942920e041353162b0d8bd006d09c2ca25cdc27888ac
00000000
01000000`

And got this:

`0x76041b6949563e76d77012f9723bec3c7a1a21fd84c74bb58df47087cef056d7`

Is it correct? Is there a way to verify it?

**Tags:** signature


---

## 1 answers

### Answer by username_1 on 2016-10-31. Score: 1 | Accepted answer

Seems to me that it is not correct

Sorry, I do not have a tool rigth now, and creating data manually is a little bit difficult and I may create errors also See update below

There should be something like this

```
01000000
01
e3dbc4fada0034ad8581cb429af4953d7d092b137ebd9e193344db376314ab65 00000000
1976a914 f65d5c02866b8cea5840b2f9fb739f2e6ee6c8f4 88ac
ffffffff
02
1004df0200000000 1976a914 7e7fe35e49f0e8a920780c00d40b7171d8808119 88ac
c05f3b0400000000 1976a914 942920e041353162b0d8bd006d09c2ca25cdc278 88ac
00000000
01000000

```

**Update**: Here is a piece of my checking code.

```
const QByteArray xx ( QByteArray::fromHex ( "01000000"
"01"
"e3dbc4fada0034ad8581cb429af4953d7d092b137ebd9e193344db376314ab65 00000000"
"1976a914 f65d5c02866b8cea5840b2f9fb739f2e6ee6c8f4 88ac"
"ffffffff"
"02"
"1004df0200000000 1976a914 7e7fe35e49f0e8a920780c00d40b7171d8808119 88ac"
"c05f3b0400000000 1976a914 942920e041353162b0d8bd006d09c2ca25cdc278 88ac"
"00000000"
"01000000" ) );
const MyKey32 digest ( xx.constData ( ), xx.size ( ) ); // construct object of sha256 (sha256 ( xx ) )
_trace ( digest.toStringRev ( ) );                      // print result
const QByteArray pubkey ( QByteArray::fromHex ( "036a6d9c781613b2f07607b240e019fb2344704258e63df4802a436302942e73d3" ) );
const QByteArray signature ( QByteArray::fromHex ( "30450221008f1bcf2624da3b423ca19eb9eb6c8fb84e6614cd603cbf9f2f1d8c7103534138022038190065341fd3cd4a697ee1ca02f5b1f1131a5268ba9df5d976e782a5edc379" ) );
_trace ( QString ( "verify=%1" ).arg ( digest.verify ( pubkey, signature ) ) );

```

and the result is

```
"f71aa6b6127ce9229d9607c0ee133d8195f91b14fe7d554ef8a6a40d99338426"
"verify=1"

```

> **Comments:**
> **username_0**: I'd like to know how you got `f65d5c02866b8cea5840b2f9fb739f2e6ee6c8f4`  
> **username_1**: this is funding script from https://blockchain.info/tx/65ab146337db4433199ebd7e132b097d3d95f49a42cb8185ad3400dafac4dbe3?show_adv=true  
> **username_0**: Thanks!  sha256(sha256(your modified transaction)) gives: `0xf71aa6b6127ce9229d9607c0ee133d8195f91b14fe7d554ef8a6a40d99338426` Is there any way I can verify the z value?  
> **username_1**: sorry, i do not have a tool mentioned in http://bitcoin.stackexchange.com/questions/32305/how-does-the-ecdsa-verification-algorithm-work-during-transaction right now. you have to check signature yourself  
> **username_0**: Thanks! your explanation is convincing. Although I couldn't verify due to my limited knowledge about ECDSA signature. I'll accept this answer if I'm able to verify.  
> **username_1**: I've checked the digest. It was created correctly and the signature matches the public key. The answer updated.  

---

