user109850: hello friends here is the code to find reuse R values of bitcoin transaction but unfortunately it is not scanning more than 51 transaction secondly it can only use one address at a time and i want to use text file to check multiple addresses as well as i want to save the output in a text file please help me to sort out 


import json


import urllib2


import time


import sys


#for some reason blockchain.info api-chain is 59711 blocks short..


blockstart = 170399


blockstart += 59711


blockcount = urllib2.urlopen("https://blockchain.info/de/q/getblockcount").read()


print "WELCOME TO R-scan v0.1.2!"


print "ADDRESS-R-SCAN: "


addr = raw_input("type address:  ")


urladdr = "https://blockchain.info/de/rawaddr/" + str(addr)


#control api-url


print urladdr


addrdata = json.load(urllib2.urlopen(urladdr))


print "Data for pubkey: " + str(addr)


print "number of txs: " + str(addrdata['n_tx'])


#tx-details:


y = -0


inputs = []


while y < addrdata['n_tx']:


print "#################################################################################"


print "TX nr :" + str(y+1)


print "hash: " + str(addrdata['txs'][y]['hash'])


print "number of inputs: " + str(addrdata['txs'][y]['vin_sz'])


#only if


#if addrdata['txs'][y]['vin_sz'] > 1:


zy = 0


while zy < addrdata['txs'][y]['vin_sz']:


  print "Input-ScriptNR " + str(zy+1) + " :" + str(addrdata['txs'][y]['inputs'][zy]['script'])



  inputs.append(addrdata['txs'][y]['inputs'][zy]['script'])



  zy += 1



y += 1


print "compare: "


xi = 0


zi = 1


lenx = len(inputs)


alert = 0


#compare the sig values in each input script


while xi < lenx-1:


x = 0


while x < lenx-zi:


  if inputs[xi][10:74] == inputs[x+zi][10:74]:



      print "In Input NR: " + str(xi) + "[global increment] " + str(inputs[xi])



      print('\a')



                   print "Resued R-Value: "



      print inputs[x+zi][10:74]



                   alert += 1



  x += 1



zi += 1


xi += 1


#check duplicates


#alert when everything ok


if alert < 1:


print "Good pubKey. No problems."


sys.exit()


user38618: Use my code located here:

In your working directory (that you cd'd into) create an addr.txt containing your list of addresses separated by space or a newline.
Run it as python3 rscan.py 2>out.txt. It'll print the progress and if anything bad is found it'll be in out.txt in your working directory.


109850: <pre><code>hello friends here is the code to find reuse R values of bitcoin transaction but unfortunately it is not scanning more than 51 transaction secondly it can only use one address at a time and i want to use text file to check multiple addresses as well as i want to save the output in a text file please help me to sort out 
</code></pre>
<blockquote>
<p>import json</p>
</blockquote>
<blockquote>
<p>import urllib2</p>
</blockquote>
<blockquote>
<p>import time</p>
</blockquote>
<blockquote>
<p>import sys</p>
</blockquote>
<blockquote>
<p>#for some reason blockchain.info api-chain is 59711 blocks short..</p>
</blockquote>
<blockquote>
<p>blockstart = 170399</p>
</blockquote>
<blockquote>
<p>blockstart += 59711</p>
</blockquote>
<blockquote>
<p>blockcount = urllib2.urlopen(&quot;https://blockchain.info/de/q/getblockcount&quot;).read()</p>
</blockquote>
<blockquote>
<p>print &quot;WELCOME TO R-scan v0.1.2!&quot;</p>
</blockquote>
<blockquote>
<p>print &quot;ADDRESS-R-SCAN: &quot;</p>
</blockquote>
<blockquote>
<p>addr = raw_input(&quot;type address:  &quot;)</p>
</blockquote>
<blockquote>
<p>urladdr = &quot;https://blockchain.info/de/rawaddr/&quot; + str(addr)</p>
</blockquote>
<blockquote>
<p>#control api-url</p>
</blockquote>
<blockquote>
<p>print urladdr</p>
</blockquote>
<blockquote>
<p>addrdata = json.load(urllib2.urlopen(urladdr))</p>
</blockquote>
<blockquote>
<p>print &quot;Data for pubkey: &quot; + str(addr)</p>
</blockquote>
<blockquote>
<p>print &quot;number of txs: &quot; + str(addrdata['n_tx'])</p>
</blockquote>
<blockquote>
<p>#tx-details:</p>
</blockquote>
<blockquote>
<p>y = -0</p>
</blockquote>
<blockquote>
<p>inputs = []</p>
</blockquote>
<blockquote>
<p>while y &lt; addrdata['n_tx']:</p>
</blockquote>
<blockquote>
<p>print &quot;#################################################################################&quot;</p>
</blockquote>
<blockquote>
<p>print &quot;TX nr :&quot; + str(y+1)</p>
</blockquote>
<blockquote>
<p>print &quot;hash: &quot; + str(addrdata['txs'][y]['hash'])</p>
</blockquote>
<blockquote>
<p>print &quot;number of inputs: &quot; + str(addrdata['txs'][y]['vin_sz'])</p>
</blockquote>
<blockquote>
<p>#only if</p>
</blockquote>
<blockquote>
<p>#if addrdata['txs'][y]['vin_sz'] &gt; 1:</p>
</blockquote>
<blockquote>
<p>zy = 0</p>
</blockquote>
<blockquote>
<p>while zy &lt; addrdata['txs'][y]['vin_sz']:</p>
</blockquote>
<blockquote>
<pre><code>  print &quot;Input-ScriptNR &quot; + str(zy+1) + &quot; :&quot; + str(addrdata['txs'][y]['inputs'][zy]['script'])
</code></pre>
</blockquote>
<blockquote>
<pre><code>  inputs.append(addrdata['txs'][y]['inputs'][zy]['script'])
</code></pre>
</blockquote>
<blockquote>
<pre><code>  zy += 1
</code></pre>
</blockquote>
<blockquote>
<p>y += 1</p>
</blockquote>
<blockquote>
<p>print &quot;compare: &quot;</p>
</blockquote>
<blockquote>
<p>xi = 0</p>
</blockquote>
<blockquote>
<p>zi = 1</p>
</blockquote>
<blockquote>
<p>lenx = len(inputs)</p>
</blockquote>
<blockquote>
<p>alert = 0</p>
</blockquote>
<blockquote>
<p>#compare the sig values in each input script</p>
</blockquote>
<blockquote>
<p>while xi &lt; lenx-1:</p>
</blockquote>
<blockquote>
<p>x = 0</p>
</blockquote>
<blockquote>
<p>while x &lt; lenx-zi:</p>
</blockquote>
<blockquote>
<pre><code>  if inputs[xi][10:74] == inputs[x+zi][10:74]:
</code></pre>
</blockquote>
<blockquote>
<pre><code>      print &quot;In Input NR: &quot; + str(xi) + &quot;[global increment] &quot; + str(inputs[xi])
</code></pre>
</blockquote>
<blockquote>
<pre><code>      print('\a')
</code></pre>
</blockquote>
<blockquote>
<pre><code>                   print &quot;Resued R-Value: &quot;
</code></pre>
</blockquote>
<blockquote>
<pre><code>      print inputs[x+zi][10:74]
</code></pre>
</blockquote>
<blockquote>
<pre><code>                   alert += 1
</code></pre>
</blockquote>
<blockquote>
<pre><code>  x += 1
</code></pre>
</blockquote>
<blockquote>
<p>zi += 1</p>
</blockquote>
<blockquote>
<p>xi += 1</p>
</blockquote>
<blockquote>
<p>#check duplicates</p>
</blockquote>
<blockquote>
<p>#alert when everything ok</p>
</blockquote>
<blockquote>
<p>if alert &lt; 1:</p>
</blockquote>
<blockquote>
<p>print &quot;Good pubKey. No problems.&quot;</p>
</blockquote>
<blockquote>
<p>sys.exit()</p>
</blockquote>
 38618: <p>Use my code located <a href="https://gist.github.com/DesWurstes/8bfeac78dad31011dddd511cb0c1526d" rel="nofollow noreferrer">here</a>:</p>
<ul>
<li>In your working directory (that you cd'd into) create an <code>addr.txt</code> containing your list of addresses separated by space or a newline.</li>
<li>Run it as <code>python3 rscan.py 2&gt;out.txt</code>. It'll print the progress and if anything bad is found it'll be in <code>out.txt</code> in your working directory.</li>
</ul>
