Browse Source

Utilities for exporting/importing private keys

master
Jonathan "Duke" Leto 6 years ago
parent
commit
5b9b524870
  1. 19
      bin/immature_privkeys.pl
  2. 21
      bin/privkeys.pl

19
bin/immature_privkeys.pl

@ -0,0 +1,19 @@
#!/usr/bin/perl
use strict;
use warnings;
use POSIX qw(strftime);
use JSON;
my $rescan = shift || "true";
my $num_blocks = int( shift || 1000 );
my $output = qx{./fiat/verus listtransactions "" $num_blocks};
my $blocks = decode_json($output);
for my $block (@$blocks) {
next unless $block->{category} eq 'immature';
my $address = $block->{address};
chomp(my $privkey = qx{./fiat/verus dumpprivkey $address});
# print the commands to import these keys into another node
print qq{./fiat/verus importprivkey $privkey "" $rescan # $address \n};
}

21
bin/privkeys.pl

@ -0,0 +1,21 @@
#!/usr/bin/perl
use strict;
use warnings;
use POSIX qw(strftime);
use JSON;
my $cli = shift || "komodo-cli";
my $rescan = shift || "true";
my $output = qx{$cli getaddressesbyaccount ""};
my $addrs = decode_json($output);
# Print a bash script that you can use to import privkeys on another node
# DO NOT LEAVE THIS LYING AROUND WHERE OTHER CAN FIND IT
print "#!/bin/bash\n";
for my $address (@$addrs) {
chomp(my $privkey = qx{./fiat/verus dumpprivkey $address});
# print the commands to import these keys into another node
print qq{./fiat/verus importprivkey $privkey "" $rescan # $address \n};
}
Loading…
Cancel
Save