Bitcoin Forum
May 12, 2024, 06:37:49 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Salvaging only used addresses and moving them to new wallet.dat?  (Read 634 times)
CryptoPanda (OP)
Sr. Member
****
Offline Offline

Activity: 882
Merit: 302


View Profile
July 29, 2014, 01:30:38 PM
 #1

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?
1715495869
Hero Member
*
Offline Offline

Posts: 1715495869

View Profile Personal Message (Offline)

Ignore
1715495869
Reply with quote  #2

1715495869
Report to moderator
1715495869
Hero Member
*
Offline Offline

Posts: 1715495869

View Profile Personal Message (Offline)

Ignore
1715495869
Reply with quote  #2

1715495869
Report to moderator
1715495869
Hero Member
*
Offline Offline

Posts: 1715495869

View Profile Personal Message (Offline)

Ignore
1715495869
Reply with quote  #2

1715495869
Report to moderator
Whoever mines the block which ends up containing your transaction will get its fee.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715495869
Hero Member
*
Offline Offline

Posts: 1715495869

View Profile Personal Message (Offline)

Ignore
1715495869
Reply with quote  #2

1715495869
Report to moderator
1715495869
Hero Member
*
Offline Offline

Posts: 1715495869

View Profile Personal Message (Offline)

Ignore
1715495869
Reply with quote  #2

1715495869
Report to moderator
bitsta
Hero Member
*****
Offline Offline

Activity: 518
Merit: 500


r00t-dev


View Profile
July 29, 2014, 03:50:46 PM
 #2

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<accounts.length();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<keys.lenght();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.
Bungeebones
Full Member
***
Offline Offline

Activity: 178
Merit: 100



View Profile
July 29, 2014, 09:56:19 PM
 #3

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).
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!