fork(1) download
  1. #!/usr/bin/perl -w
  2. use strict;
  3. use diagnostics;
  4. #use encoding 'cp1251';
  5.  
  6.  
  7. use JSON::RPC::Legacy::Client;
  8. use Data::Dumper;
  9.  
  10. my $client = new JSON::RPC::Legacy::Client;
  11.  
  12. $client->ua->credentials(
  13. 'localhost:9357', 'jsonrpc', 'user' => 'pass' # REPLACE WITH YOUR bitcoin.conf rpcuser/rpcpassword
  14. );
  15. my $count=0;
  16. my $uri = 'http://localhost:9357/';
  17. my $i = 0;
  18. #my $j = 0;
  19. print STDERR "дерьмо \n";
  20. for ($i = 1; $i<=40000; $i++)
  21. {
  22. #sleep (10) unless ($i%500);
  23. #$j = $i;
  24. #for ($j; $j<=$i+100; $j++)
  25. #{
  26. my $obj = {
  27. method => 'getblockhash',
  28. params => [$i],
  29. };
  30.  
  31. my $res = $client->call( $uri, $obj );
  32.  
  33. if ($res){
  34. if ($res->is_error) { print STDERR "Error : ", $res->error_message," \n" ;sleep (30); }
  35. else {
  36. my $bh = $res->result;
  37. $obj = {
  38. method => 'getblock',
  39. params => [$bh],
  40. };
  41. $res = $client->call( $uri, $obj );
  42. unless (defined $res) {print STDERR "$i \n"; $i--; sleep (30); next;}
  43. #my $bc = $res->result;
  44. my $tidha = $res->result->{'tx'};
  45. #my %tid = %bc{'tx'};
  46. #$obj = {
  47. # method => 'getblock',
  48. # params => [$tid],
  49. #};
  50. while (defined( my $tid = pop @$tidha)){
  51. $obj = {
  52. method => 'getrawtransaction',
  53. params => [$tid],
  54. };
  55. $res = $client->call( $uri, $obj );
  56. unless (defined $res) {print STDERR "$i \n"; $i--; sleep (30); next;}
  57. $obj = {
  58. method => 'decoderawtransaction',
  59. params => [$res->result],
  60. };
  61. $res = $client->call( $uri, $obj );
  62. unless (defined $res) {print STDERR "$i \n"; $i--; sleep (30); next;}
  63.  
  64.  
  65. my $voita = $res->result->{'vout'};
  66. #print Dumper($voita);
  67. while (defined( my $wta = pop @$voita)){
  68. my $awa = $wta->{'scriptPubKey'}->{'addresses'};
  69. while (defined(my $aw = pop @$awa)){
  70. #print $aw, "\n";
  71. print $tid, "\n" if ($aw eq 'Sg2NdZywasiNUADzm5dxt6G1WWKyKkj9Mc');
  72. }
  73. $count++;
  74. #print Dumper($awa);
  75. ;
  76. #while (defined( my $aw = pop @$voita)){
  77. #}
  78. }
  79. #print @$voita, "\n";
  80. #$count = $res->result;
  81. #print $count, "\n";
  82. }
  83. #my $tid = pop @$tidh;
  84. #print $tid;
  85.  
  86. #print Dumper($tid);
  87. #print Dumper($tidh);
  88. #print Dumper($res->result);
  89. }
  90. } else {print STDERR $client->status_line, " \n"; sleep (30);}
  91.  
  92. #}
  93. #$i = $j;
  94. #print $count," $j", "\n";
  95. #sleep (1);
  96. }
  97. #my $obj = {
  98. #method => 'decoderawtransaction',
  99. #params => [$count],
  100. #};
  101. #my $res = $client->call( $uri, $obj );
  102. #print Dumper($res->result);
  103.  
  104. print $count, "\n";
Runtime error #stdin #stdout #stderr 0.09s 5696KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Can't locate JSON/RPC/Legacy/Client.pm in @INC (@INC contains: /usr/lib/perl5/site_perl/5.16.2/i686-linux /usr/lib/perl5/site_perl/5.16.2 /usr/lib/perl5/5.16.2/i686-linux /usr/lib/perl5/5.16.2 .) at prog.pl line 7.
BEGIN failed--compilation aborted at prog.pl line 7 (#1)
    (F) You said to do (or require, or use) a file that couldn't be found.
    Perl looks for the file in all the locations mentioned in @INC, unless
    the file name included the full path to the file.  Perhaps you need
    to set the PERL5LIB or PERL5OPT environment variable to say where the
    extra library is, or maybe the script needs to add the library name
    to @INC.  Or maybe you just misspelled the name of the file.  See
    "require" in perlfunc and lib.
    
Uncaught exception from user code:
	Can't locate JSON/RPC/Legacy/Client.pm in @INC (@INC contains: /usr/lib/perl5/site_perl/5.16.2/i686-linux /usr/lib/perl5/site_perl/5.16.2 /usr/lib/perl5/5.16.2/i686-linux /usr/lib/perl5/5.16.2 .) at prog.pl line 7.
	BEGIN failed--compilation aborted at prog.pl line 7.