Author

Topic: Importing addresses to wallet (Read 177 times)

newbie
Activity: 19
Merit: 1
February 13, 2020, 05:08:10 PM
#10
I indeed generated 20 million adresses for no reason which resulted in 2 GB of data...
The extracted keys or the addresses alone are roughly 750 MB each. the rest is "overhead" by the generator.

I think I will create a query on bitcoin-wall.com/check/ querying each address :/
Proly still gonna be slow as heck but I could split it on multiple threads...

Won't have any hits anyway, so you guys are probably right that I shouldn't import them if I just want to check if they have a balance..
But I was more interested in owning them "forever" in the first place.

Are there any solutions (maybe bitcoind?) that can handle a larger amount of adresses than the desktop solution?

It's unrealistic to expect that a service would allow you to do 20 million requests in any reasonable rate. You should run your own full node and check the addresses yourself. Unfortunately there seem to be no easy way to do it , which means you'll have to write your own code that works with raw blocks or UTXO set.

Or maybe you should stick with your method but modify it to periodically flush these empty addresses to free memory and save resources - e.g. delete all empty addresses every 1000 addresses.


Yea, 20 million single requests won't be good I guess.
I will partition the addresses to blocks of 1000 and query each 1k block on its own.

Oh, and .. I'm not having RAM issues during processing the addresses/keys.

Processing the 2GB raw content to extract the 20 million adresses or private keys takes barely 33 MB of RAM while the program is working and still less than 60 seconds to run it.
Streamreading one line -> writing every third line to the output.
Flush the output every 100k lines to be stored on the HDD.


See the C#-Code yourself:

Code:
static void Main(string[] args)
        {
            Console.WriteLine("Started.");
            string path = @"[MYDIRECTORYPATH]",
                file = "[INPUTFILENAME]",
                outputFile = "[OUTPUTFILENAME]";
            long readLines = 0;
            StringBuilder storage = new StringBuilder();

            StreamReader reader = new StreamReader(Path.Combine(path, file));
            try
            {
                using (reader)
                {
                    string line;
                    // Read and display lines from the file until the end of
                    // the file is reached.
                    while ((line = reader.ReadLine()) != null)
                    {
                        readLines++;
                        if (line.Contains("Address"))
                        {
                            storage.Append(line.Split(' ')[1] + Environment.NewLine);
                        }
                        //if (line.Contains("Privkey"))
                        //{
                        //    storage.Append(line.Split(' ')[1] + " DATE-UNKNOWN" + Environment.NewLine);
                        //}
                        if (readLines % 100000 == 0)
                        {
                            Console.WriteLine("Processing line {0}", AddDotsToLong(readLines));
                            File.AppendAllText(Path.Combine(path, outputFile), storage.ToString());
                            storage.Clear();
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("An error occured:");
                Console.WriteLine(e);
            }
            finally
            {
                File.AppendAllText(Path.Combine(path, outputFile), storage.ToString());
                storage.Clear();
                Console.WriteLine("Finished with line: {0}", AddDotsToLong(readLines));
                Console.WriteLine("Output file name: " + outputFile);
                reader.Close();
                // Deletion of input file commented out for security reasons
                //File.Delete(Path.Combine(path, file));
                reader.Dispose();
                Console.ReadLine();
            }
        }

        public static string AddDotsToLong(long number)
        {
            string output = number.ToString();
            int counter = 3;
            if (output.Length > 3)
            {
                for (int i = number.ToString().Length; i > 0; i--)
                {
                    if (counter++ % 3 == 0 && i < number.ToString().Length) output = output.Insert(i, ".");
                }
            }
            return output;
        }

This probably could be improved even further using a streamwriter rather than File.AppendAllText and by getting rid of the string.split method^^

Change  if (line.Contains("Address")) to  if (line.Contains("Privkey")) depending on what you wish to extract that moment.

This is only a development version for myself, definitely not ready to use for everyone!

(Test data can easily be created in large amounts using vanitygen.)
(Sidenote: To view the data without using 2GB RAM and keep RAM usage low in general you simply can create/use a paginated viewer.)

My problem definitely is the import of the data to the wallet.


Is this a project work or just another discoveries? Just wondering why importing just huge wallets to one platform, I will assume you are doing this for a company otherwise I can't understand.

Basically this is a private feasibility experiment.
member
Activity: 686
Merit: 15
February 13, 2020, 08:31:30 AM
#9
Is this a project work or just another discoveries? Just wondering why importing just huge wallets to one platform, I will assume you are doing this for a company otherwise I can't understand.
legendary
Activity: 3038
Merit: 2162
February 13, 2020, 02:03:15 AM
#8
I indeed generated 20 million adresses for no reason which resulted in 2 GB of data...
The extracted keys or the addresses alone are roughly 750 MB each. the rest is "overhead" by the generator.

I think I will create a query on bitcoin-wall.com/check/ querying each address :/
Proly still gonna be slow as heck but I could split it on multiple threads...

Won't have any hits anyway, so you guys are probably right that I shouldn't import them if I just want to check if they have a balance..
But I was more interested in owning them "forever" in the first place.

Are there any solutions (maybe bitcoind?) that can handle a larger amount of adresses than the desktop solution?

It's unrealistic to expect that a service would allow you to do 20 million requests in any reasonable rate. You should run your own full node and check the addresses yourself. Unfortunately there seem to be no easy way to do it , which means you'll have to write your own code that works with raw blocks or UTXO set.

Or maybe you should stick with your method but modify it to periodically flush these empty addresses to free memory and save resources - e.g. delete all empty addresses every 1000 addresses.
copper member
Activity: 2856
Merit: 3071
https://bit.ly/387FXHi lightning theory
February 12, 2020, 05:06:43 PM
#7
There aren't many for what you want. If you could program you could find a "blockchain data parser" and if you had a copy of the blockchain, that'd probably be faster.

Imo, for an actual wallet, you're better off using bitcoin core to generate your keys since you only need to backup one key... Not sure why you'd ever want millions lol. Although coming from the person who made an 8gb csv table for conversions a while ago I'll probably have to let it slide 🤣.
newbie
Activity: 19
Merit: 1
February 12, 2020, 04:40:47 PM
#6
What are you trying to accomplish? Even if you'd have enough RAM to import that many addresses, my gut feeling tells me it will make your wallet far too slow to do anything. Wallets aren't designed let alone optimized for these numbers.

Did you just generate hundreds of millions of addresses and now want to check if any of them holds any balance? If that's the case, I can think of an easier solution:

  • Create a list of all existing addresses with a balance.
  • Find duplicate addresses between that list and your own list.
I've posted the necessary (Linux) code for it a while ago, it's very fast to do as long as you have enough RAM.


I indeed generated 20 million adresses for no reason which resulted in 2 GB of data...
The extracted keys or the addresses alone are roughly 750 MB each. the rest is "overhead" by the generator.

I think I will create a query on bitcoin-wall.com/check/ querying each address :/
Proly still gonna be slow as heck but I could split it on multiple threads...

Won't have any hits anyway, so you guys are probably right that I shouldn't import them if I just want to check if they have a balance..
But I was more interested in owning them "forever" in the first place.

Are there any solutions (maybe bitcoind?) that can handle a larger amount of adresses than the desktop solution?
legendary
Activity: 3290
Merit: 16489
Thick-Skinned Gang Leader and Golden Feather 2021
February 12, 2020, 03:12:39 PM
#5
What are you trying to accomplish? Even if you'd have enough RAM to import that many addresses, my gut feeling tells me it will make your wallet far too slow to do anything. Wallets aren't designed let alone optimized for these numbers.

Did you just generate hundreds of millions of addresses and now want to check if any of them holds any balance? If that's the case, I can think of an easier solution:

  • Create a list of all existing addresses with a balance.
  • Find duplicate addresses between that list and your own list.
I've posted the necessary (Linux) code for it a while ago, it's very fast to do as long as you have enough RAM.
newbie
Activity: 19
Merit: 1
February 12, 2020, 03:06:35 PM
#4
Why would you want to do this, what are you trying to achieve and are these addresses yours?

I wouldn't want to suggest using something like electrum for that as it'll clog their servers and if you acutally need the data, just leave core running. The chain sync gets slower the closer it gets to the end too so you may as well just hold off until it does as long as it was still making progress (the number was going down on the blocks remaining tally).

When you mean with "yours" that I generated them myself, and didn't stole or obtained them illegally, then yes, I "own" them and they are "mine".



Importing more than a few tens of thousands of addresses into a regular Bitcoin Core Qt wallet is going to make that wallet slow to a crawl.

I tried.

The desktop wallet is not designed to be used with that many addresses, you'll need to find another solution.

I noticed this as well.
Maybe I figure out roughly where the bottlenecking starts and split the adresses onto enough wallets to stay below the bottlenecking threshold :/
newbie
Activity: 15
Merit: 3
February 12, 2020, 02:05:06 PM
#3
Importing more than a few tens of thousands of addresses into a regular Bitcoin Core Qt wallet is going to make that wallet slow to a crawl.

I tried.

The desktop wallet is not designed to be used with that many addresses, you'll need to find another solution.
copper member
Activity: 2856
Merit: 3071
https://bit.ly/387FXHi lightning theory
February 12, 2020, 02:01:14 PM
#2
Why would you want to do this, what are you trying to achieve and are these addresses yours?

I wouldn't want to suggest using something like electrum for that as it'll clog their servers and if you acutally need the data, just leave core running. The chain sync gets slower the closer it gets to the end too so you may as well just hold off until it does as long as it was still making progress (the number was going down on the blocks remaining tally).
newbie
Activity: 19
Merit: 1
February 12, 2020, 12:45:00 PM
#1
Hello,

I'm looking for an effective way to import hundreds of millions of addresses into a wallet.

I made a trial run with something around 350 000 addresses and I had to abort the process at 75%. It stucked for full 24 hours at 75% after only 2 days in total. (It was still working though ...)

I used the "importwallet"-function of bitcoin-qt.

Any other ideas/possibilities to do this?


Thanks in advance for any solutions.

Tii

~ Maybe the pywallet tool?
Jump to: