<blockquote>
  <p><strong>calculating z1</strong></p>
  
  <p>replace the input with the corresponding output script</p>
</blockquote>

<p>This is the step where you made a small mistake.</p>

<p>The UTXO that's being spent is from <a href="https://blockchain.info/tx/9312ccafb8aa624afe7fb7b4201a0ccc2a14ca2b8b8a3253093b975a6a85a280" rel="nofollow">txid 9312ccafb8aa624afe7fb7b4201a0ccc2a14ca2b8b8a3253093b975a6a85a280</a> which contains two txouts. When you did the script replacement, you chose txout #0 (with a hash160 of cf3aaf67c964d5c239f4cf2d9c2d2a7257d85b5d), but the tx being signed is spending txout #1 (with a hash160 of 09a4cb092dc30da1354369fc78f482365ce2767a).</p>

<p>Doing the replacement with the correct txout script results in this, which hashes to the z1 value you were expecting:</p>

<pre><code>010000000180a2856a5a973b0953328a8b2bca142acc0c1a20b4b77ffe4a62aab8afcc1293010000001976a91409a4cb092dc30da1354369fc78f482365ce2767a88acffffffff01a0252600000000001976a914cf3aaf67c964d5c239f4cf2d9c2d2a7257d85b5d88ac0000000001000000
</code></pre>

CC BY-SA 3.0
2015-06-08T05:27:53.947Z
Christopher Gurnee thank you now i get correct output
Prabu r
CC BY-SA 3.0
2015-06-08T13:30:55.257Z
@Prabur If this has completely answered your question, please consider Accepting it (and of course the same goes for any other answers). More info on Accepting answers can be found here: http://meta.stackexchange.com/questions/5234/
Christopher Gurnee
CC BY-SA 3.0
2015-05-31T14:21:09.333Z
2015-05-31T14:21:09.333Z
Christopher Gurnee
<p><a href="https://blockchain.info/tx/9312ccafb8aa624afe7fb7b4201a0ccc2a14ca2b8b8a3253093b975a6a85a280" rel="nofollow">tx1</a></p>

<p>from the trans1 i got</p>

<p>Input Scripts</p>

<pre><code>30450220262e481b6d8905b5adba67aff05eb8261501b0a9434c0b7f043d00cf8d23c91b022100bf82c0d212f30d3a0599e9b879516d762eaf5688ab83787cf470e99af5a6917101       
046578188abe5aaf9f3d1809d972e87307493dfefa3a5b6c94c870e8f58743179678f059c6402d9806ccce5d0672dc171d962fe392f8ef77cc9827c3eb633966b4
</code></pre>

<p>R = 262e481b6d8905b5adba67aff05eb8261501b0a9434c0b7f043d00cf8d23c91b</p>

<p>S2 = bf82c0d212f30d3a0599e9b879516d762eaf5688ab83787cf470e99af5a69171</p>

<p><strong>tx1 raw trans</strong></p>

<pre><code>01000000012eb64643254262722e33e72cb2ad67fecb6ae2fd812d2f2bff217458715e11a0000000008b4830450220262e481b6d8905b5adba67aff05eb8261501b0a9434c0b7f043d00cf8d23c91b022100bf82c0d212f30d3a0599e9b879516d762eaf5688ab83787cf470e99af5a691710141046578188abe5aaf9f3d1809d972e87307493dfefa3a5b6c94c870e8f58743179678f059c6402d9806ccce5d0672dc171d962fe392f8ef77cc9827c3eb633966b4ffffffff02a0252600000000001976a914cf3aaf67c964d5c239f4cf2d9c2d2a7257d85b5d88aca0252600000000001976a91409a4cb092dc30da1354369fc78f482365ce2767a88ac00000000
</code></pre>

<p><strong>calculating z2</strong></p>

<p>replace the input with the corresponding output script</p>

<pre><code>01000000012eb64643254262722e33e72cb2ad67fecb6ae2fd812d2f2bff217458715e11a0000000001976a91409a4cb092dc30da1354369fc78f482365ce2767a88acffffffff02a0252600000000001976a914cf3aaf67c964d5c239f4cf2d9c2d2a7257d85b5d88aca0252600000000001976a91409a4cb092dc30da1354369fc78f482365ce2767a88ac0000000001000000
</code></pre>

<p>then do sha256(sha256(modified transaction))</p>

<p>Z2 = e2b8acb01c0ea6a2a1273fc9dbbe3cdd58c68afb54e240e1f51abcc652468204</p>

<p><a href="https://blockchain.info/tx/b4e7193c972ababd82b5feefe1af96b33bf062d2b959f44816a532e05940d032" rel="nofollow">tx2</a></p>

<p><strong>from tx2</strong></p>

<p>Input Scripts</p>

<pre><code>30450220262e481b6d8905b5adba67aff05eb8261501b0a9434c0b7f043d00cf8d23c91b022100d45c9ef85bb65a2a5bb3cf862124188adfe5fb8d430bc4b0d1222b1704d10d1901      
046578188abe5aaf9f3d1809d972e87307493dfefa3a5b6c94c870e8f58743179678f059c6402d9806ccce5d0672dc171d962fe392f8ef77cc9827c3eb633966b4
</code></pre>

<p>S1 = d45c9ef85bb65a2a5bb3cf862124188adfe5fb8d430bc4b0d1222b1704d10d19</p>

<p><strong>tx2 raw trans</strong></p>

<pre><code>010000000180a2856a5a973b0953328a8b2bca142acc0c1a20b4b77ffe4a62aab8afcc1293010000008b4830450220262e481b6d8905b5adba67aff05eb8261501b0a9434c0b7f043d00cf8d23c91b022100d45c9ef85bb65a2a5bb3cf862124188adfe5fb8d430bc4b0d1222b1704d10d190141046578188abe5aaf9f3d1809d972e87307493dfefa3a5b6c94c870e8f58743179678f059c6402d9806ccce5d0672dc171d962fe392f8ef77cc9827c3eb633966b4ffffffff01a0252600000000001976a914cf3aaf67c964d5c239f4cf2d9c2d2a7257d85b5d88ac00000000
</code></pre>

<p><strong>calculating z1</strong></p>

<p>replace the input with the corresponding output script</p>

<pre><code>010000000180a2856a5a973b0953328a8b2bca142acc0c1a20b4b77ffe4a62aab8afcc1293010000001976a914cf3aaf67c964d5c239f4cf2d9c2d2a7257d85b5d88acffffffff01a0252600000000001976a914cf3aaf67c964d5c239f4cf2d9c2d2a7257d85b5d88ac0000000001000000
</code></pre>

<p>then do sha256(sha256(modified transaction))</p>

<p>I got Z1 = f62dab861eb451dad7cc74fa9f754e4d233b5fb80b1327fd623f5617e1f46d21</p>

<p>but the correct z1 value is </p>

<p>z1 = 66042ab1a1befe137de5328ff1d4b263604824fe33c739d3a80565afdd94b34d</p>

<p>what wrong in the calculation</p>

<transactions><signature><hash><ecdsa>
Two identical R value finding z value from two transaction
Prabu r
# Two identical R value finding z value from two transaction

(Asked by: username_0 on 2015-05-31)

tx1
from the trans1 i got
Input Scripts
30450220262e481b6d8905b5adba67aff05eb8261501b0a9434c0b7f043d00cf8d23c91b022100bf82c0d212f30d3a0599e9b879516d762eaf5688ab83787cf470e99af5a6917101       
046578188abe5aaf9f3d1809d972e87307493dfefa3a5b6c94c870e8f58743179678f059c6402d9806ccce5d0672dc171d962fe392f8ef77cc9827c3eb633966b4

R = 262e481b6d8905b5adba67aff05eb8261501b0a9434c0b7f043d00cf8d23c91b
S2 = bf82c0d212f30d3a0599e9b879516d762eaf5688ab83787cf470e99af5a69171
tx1 raw trans
01000000012eb64643254262722e33e72cb2ad67fecb6ae2fd812d2f2bff217458715e11a0000000008b4830450220262e481b6d8905b5adba67aff05eb8261501b0a9434c0b7f043d00cf8d23c91b022100bf82c0d212f30d3a0599e9b879516d762eaf5688ab83787cf470e99af5a691710141046578188abe5aaf9f3d1809d972e87307493dfefa3a5b6c94c870e8f58743179678f059c6402d9806ccce5d0672dc171d962fe392f8ef77cc9827c3eb633966b4ffffffff02a0252600000000001976a914cf3aaf67c964d5c239f4cf2d9c2d2a7257d85b5d88aca0252600000000001976a91409a4cb092dc30da1354369fc78f482365ce2767a88ac00000000

calculating z2
replace the input with the corresponding output script
01000000012eb64643254262722e33e72cb2ad67fecb6ae2fd812d2f2bff217458715e11a0000000001976a91409a4cb092dc30da1354369fc78f482365ce2767a88acffffffff02a0252600000000001976a914cf3aaf67c964d5c239f4cf2d9c2d2a7257d85b5d88aca0252600000000001976a91409a4cb092dc30da1354369fc78f482365ce2767a88ac0000000001000000

then do sha256(sha256(modified transaction))
Z2 = e2b8acb01c0ea6a2a1273fc9dbbe3cdd58c68afb54e240e1f51abcc652468204
tx2
from tx2
Input Scripts
30450220262e481b6d8905b5adba67aff05eb8261501b0a9434c0b7f043d00cf8d23c91b022100d45c9ef85bb65a2a5bb3cf862124188adfe5fb8d430bc4b0d1222b1704d10d1901      
046578188abe5aaf9f3d1809d972e87307493dfefa3a5b6c94c870e8f58743179678f059c6402d9806ccce5d0672dc171d962fe392f8ef77cc9827c3eb633966b4

S1 = d45c9ef85bb65a2a5bb3cf862124188adfe5fb8d430bc4b0d1222b1704d10d19
tx2 raw trans
010000000180a2856a5a973b0953328a8b2bca142acc0c1a20b4b77ffe4a62aab8afcc1293010000008b4830450220262e481b6d8905b5adba67aff05eb8261501b0a9434c0b7f043d00cf8d23c91b022100d45c9ef85bb65a2a5bb3cf862124188adfe5fb8d430bc4b0d1222b1704d10d190141046578188abe5aaf9f3d1809d972e87307493dfefa3a5b6c94c870e8f58743179678f059c6402d9806ccce5d0672dc171d962fe392f8ef77cc9827c3eb633966b4ffffffff01a0252600000000001976a914cf3aaf67c964d5c239f4cf2d9c2d2a7257d85b5d88ac00000000

calculating z1
replace the input with the corresponding output script
010000000180a2856a5a973b0953328a8b2bca142acc0c1a20b4b77ffe4a62aab8afcc1293010000001976a914cf3aaf67c964d5c239f4cf2d9c2d2a7257d85b5d88acffffffff01a0252600000000001976a914cf3aaf67c964d5c239f4cf2d9c2d2a7257d85b5d88ac0000000001000000

then do sha256(sha256(modified transaction))
I got Z1 = f62dab861eb451dad7cc74fa9f754e4d233b5fb80b1327fd623f5617e1f46d21
but the correct z1 value is 
z1 = 66042ab1a1befe137de5328ff1d4b263604824fe33c739d3a80565afdd94b34d
what wrong in the calculation

**Tags:** transactions, signature, hash, ecdsa


---

## 1 answers

### Answer by username_1 on 2015-05-31. Score: 4 | Accepted answer

calculating z1
replace the input with the corresponding output script

This is the step where you made a small mistake.
The UTXO that's being spent is from txid 9312ccafb8aa624afe7fb7b4201a0ccc2a14ca2b8b8a3253093b975a6a85a280 which contains two txouts. When you did the script replacement, you chose txout #0 (with a hash160 of cf3aaf67c964d5c239f4cf2d9c2d2a7257d85b5d), but the tx being signed is spending txout #1 (with a hash160 of 09a4cb092dc30da1354369fc78f482365ce2767a).
Doing the replacement with the correct txout script results in this, which hashes to the z1 value you were expecting:
010000000180a2856a5a973b0953328a8b2bca142acc0c1a20b4b77ffe4a62aab8afcc1293010000001976a91409a4cb092dc30da1354369fc78f482365ce2767a88acffffffff01a0252600000000001976a914cf3aaf67c964d5c239f4cf2d9c2d2a7257d85b5d88ac0000000001000000

> **Comments:**
> **username_0**: username_1 thank you now i get correct output  
> **username_1**: @Prabur If this has completely answered your question, please consider Accepting it (and of course the same goes for any other answers). More info on Accepting answers can be found here: http://meta.stackexchange.com/questions/5234/  

---

