Author

Topic: Salvaging only used addresses and moving them to new wallet.dat? (Read 661 times)

full member
Activity: 178
Merit: 100
Along the lines of bitsta post use listaccounts and check if any fields such as txid have values. The confirmations field would be a good one to check too to make sure you don't send it out before the confirmations come in (maybe).
hero member
Activity: 518
Merit: 500
r00t-dev
this would require a script with the following logic:

pseudocode: (rpc functions existent)
Code:

dyn array accounts[] = listaccounts(); //all accounts
array keys[accounts.length()];  //array for the private keys
dyn array addresses[]; //array for the addresses
//this for-loop just puts every private-key from a public-key which has at least one transaction
//into an array (key[]). this array will be later used to import the keys into the new wallet.
for(i
       if( listtransactions(accounts[i]) != empty){
       addresses[i]=getaddressesbyaccount(accounts[i]);
       key[i]=importprivkey(accounts[i]);
       
       }

       

}

fstream f;

f.write(file, keys); //now save the private keys on a file

//this for loop will be used on the
fstream.f;
dyn array keys[];

f.read(file, keys[]); //open the saved keys and put them into this 

for(i
     importprivkey(keys[i]); //import every single key to the new wallet.dat

}


inform yourself about json-rpc and its methods and usage on the
different languages. i recommend the usage of an python or php
file as it s probably the fastest way. java is also simple via http reqs.
hope it s clear now.

cheers,
bitsta


P.S. if you wan to manually do this procedure manually
you can list all accounts and check them all manually.
afterwards just export those keys with associated tx.
sr. member
Activity: 910
Merit: 302
What would be the best way to salvage only the addresses that actually received anything and move them to new wallet.dat?
the old one is corrupt for some reason and is 90mb so we need some automatic way?
Jump to: