Well hello. So, I got a script I need to write. But obviously it's been a while since I laid down any Perl. Hope things haven't changed too too much. In any case, I'm getting ready to--in between a bunch of other unrelated tasks--make a script to pull balances for a list of bitcoin addresses.

I searched for blockchain modules and see that there's not really anything in that department. I think I can use the api at https://blockchain.info/q though, so no worries.

We'll see how it goes. Hopefully well. This will also be a test to see where I need to brush up my coding abilities. Doomsday device is almost to beta, and I'll need to build a rudimentary interface soon.

. . . erp, shoulda checked CPAN. Still, don't think I need btc-specific libraries for this script. We'll see.

01222018--

So far, so good...

#!/bin/usr/perl use JSON; use LWP::Simple; use utf8; use warnings; use strict; open STDIN, "< addresses_in.txt"; open STDOUT, "> results_out.txt"; my @addresses_all = <STDIN>; chomp @addresses_all; my $ADDRS_ALL = @addresses_all; foreach $ADDRS_ALL(@addresses_all) { my $api = get("https://blockchain.info/rawaddr/" . $ADDRS_ALL); my $json_obj = new JSON; my $data = $json_obj->decode( $api ); my $balnce = $data->{final_balance}; print STDERR "Bitcoin address $ADDRS_ALL. Current balance is $baln +ce.\n"; printf("Bitcoin address $ADDRS_ALL. Current balance is $balnce.\n" +); sleep 10; }
[download]