teensy:~$ curl -L http://cpanmin.us > cpanm 2>/dev/nullteensy:~$ chmod +x cpanm
teensy:~$ ./cpanm -l lib JSON::RPC::Client--> Working on JSON::RPC::ClientFetching http://search.cpan.org/CPAN/authors/id/M/MA/MAKAMAKA/JSON-RPC-0.96.tar.gz ... OKConfiguring JSON-RPC-0.96 ... OKBuilding and testing JSON-RPC-0.96 ... OKSuccessfully installed JSON-RPC-0.961 distribution installed
teensy:~$ gpg --recv-keys --keyserver keyserver.ubuntu.com 6A2A7D39gpg: directory `/home/teensy/.gnupg' createdgpg: new configuration file `/home/teensy/.gnupg/gpg.conf' createdgpg: WARNING: options in `/home/teensy/.gnupg/gpg.conf' are not yet active during this rungpg: keyring `/home/teensy/.gnupg/secring.gpg' createdgpg: keyring `/home/teensy/.gnupg/pubring.gpg' createdgpg: requesting key 6A2A7D39 from hkp server keyserver.ubuntu.comgpg: /home/teensy/.gnupg/trustdb.gpg: trustdb createdgpg: key 6A2A7D39: public key "Toby Inkster <mail@tobyinkster.co.uk>" importedgpg: no ultimately trusted keys foundgpg: Total number processed: 1gpg: imported: 1
teensy:~$ ./cpanm -l lib Finance::Bitcoin--> Working on Finance::BitcoinFetching http://search.cpan.org/CPAN/authors/id/T/TO/TOBYINK/Finance-Bitcoin-0.002.tar.gz ... OKConfiguring Finance-Bitcoin-0.002 ... OKBuilding and testing Finance-Bitcoin-0.002 ... OKSuccessfully installed Finance-Bitcoin-0.0021 distribution installed
teensy:~$ ./cpanm -l lib Math::Integral::Romberg--> Working on Math::Integral::RombergFetching http://search.cpan.org/CPAN/authors/id/B/BO/BOESCH/Math-Integral-Romberg-0.04.tar.gz ... OKConfiguring Math-Integral-Romberg-0.04 ... OKBuilding and testing Math-Integral-Romberg-0.04 ... FAIL! Installing Math::Integral::Romberg failed. See /home/teensy/.cpanm/build.log for details.
teensy:~$ cp -Rfv ~/.cpanm/latest-build/Math-Integral-Romberg-0.04/blib/lib/* lib/lib/perl5/`/home/teensy/.cpanm/latest-build/Math-Integral-Romberg-0.04/blib/lib/Math' -> `lib/lib/perl5/Math'`/home/teensy/.cpanm/latest-build/Math-Integral-Romberg-0.04/blib/lib/Math/Integral' -> `lib/lib/perl5/Math/Integral'`/home/teensy/.cpanm/latest-build/Math-Integral-Romberg-0.04/blib/lib/Math/Integral/Romberg.pm' -> `lib/lib/perl5/Math/Integral/Romberg.pm'
teensy:~$ ls lib/lib/perl5/Finance JSON JSONRPC.pm Math x86_64-linux-gnu-thread-multi
teensy:~$ PERL5LIB="lib/lib/perl5/x86_64-linux-gnu-thread-multi:lib/lib/perl5" perl -c Multipool.pl Multipool.pl syntax OK
use strict;use lib 'lib/lib/perl5', 'lib/lib/perl5/x86_64-linux-gnu-thread-multi';
$ ls Multipool.pl # we are in the same directory where Multipool.pl isMultipool.pl$ cat ~/.bitcoin/bitcoin.conf server=1rpcuser=myusernamerpcpassword=mypasswordrpcallowip=192.168.1.*rpcport=8332gen=0$ cat bitcoind.confmyusername mypassword$
sub bitcoinslc_rewards { print "parsing bitcoin.lc rewards\n"; my $url1='https://www.bitcoins.lc/'; my $url2='https://www.bitcoins.lc/transactions'; my $pool=$pools{"bitcoins-lc"}; $pool->{rounds_time}=shared_clone({}) unless $pool->{rounds_time}; foreach my $account (values %{$accounts{"bitcoins-lc"}}) { $_=wget($url1, "--keep-session-cookies --save-cookie bitcoins-lc-cookie.txt"); if (!$_){ print "error: unable to fetch bitcoins-lc login page $url1\n"; return; } m{.* name="_csrf_token" value="(\w.*)"}; my $token=$1; my $ok=($token=~/^[a-z0-9]+$/); if ($ok){ $_=wget($url1, "'--post-data=_csrf_token=$token&action=login&email=$account->{web_user}&password=$account->{web_pass}&login=Proceed'", "--load-cookies bitcoins-lc-cookie.txt", "--keep-session-cookies --save-cookie bitcoins-lc-cookie2.txt"); $ok=!!$_; } if ($ok){ $_=wget($url2, "--load-cookies bitcoins-lc-cookie2.txt"); $ok=!!$_; } my @lines; if ($ok){ @lines=split/\n/; $ok=@lines; # puts the number of lines in $ok } if (!$ok){ print "error: cannot login into/parse stats page for bitcoin-lc using account $account->{name}\n"; return; } @lines = grep { /Your Transactions/ .. /div id="rightcol"/ } @lines; if (!@lines) { print "error: no lines matched between Your Transactions and div id=rightcol; code needs changed!\n"; return; } my @new_rounds; my $blockid = 0; my $date; my $shares = 0; my $reward = 0; my $epoch = 0; foreach (@lines){ if (/Received Block (\d+)<span> - (.*)<\/span>/) { $blockid = $1; $date = $2; $date =~ s/ (\d\d?) (...) / $2 $1 /; $epoch=qx(date -d '$date' +%s); chomp $epoch; } if (/Based upon (\d+) valid shares/) { $shares = $1; next if (!$blockid); } if (/<p class="amount">\+([\d.]+)/) { $reward = $1; if ($blockid) { #print "Debug: block $blockid, date '$date', epoch '$epoch', shares $shares, amount $reward\n"; $ok=($blockid=~/^[a-z0-9]+$/ and $reward=~/^\d+\.\d+$/ and $epoch=~/^\d+$/ and $shares=~/^\d+$/); if (!$ok){ print "error parsing stats page for bitcoins-lc using account $account->{name}: line=$_\n"; foreach my $round (@new_rounds){ delete $account->{rounds}->{$round}; } return; } my $round=$pool->{rounds_time}->{$epoch}; if (!$round){ $round=guess_round($epoch, $pool, $epoch); next if !$round; $pool->{rounds}->{$round}=shared_clone({time => $epoch, shares => $shares}); $pool->{rounds_time}->{$epoch} = $round; } if (!$account->{rounds}->{$round}){ $account->{rounds}->{$round}=shared_clone({earned => $reward, shares_web => $shares}); push @new_rounds, $round; } # Then reset data $blockid = $shares = $reward = $epoch = 0; $date = ""; } else { next; } } last if (/Recent Transactions/); } consolidate_rounds($account, @new_rounds); }}