Generate and download thousands of Bitcoin wallets in a minute or two

A delicate script-twist that CREATE the “Download” function on bitaddress.org

Jeff Hu
Coinmonks
Published in
4 min readJun 2, 2018

--

Image credit to cryptorecorder.com

This workshop article will take you through the process of twisting the code of bitaddress.org to hack in a Download button that eases your life of bulk Bitcoin wallet address generation. This article serves only for educational purposes and recognizes bitaddress.org as a great resource for the Bitcoin developer community.

Disclaimer: The author has come across bitaddress.org on same the day that this article is written. Not an advertisement lol. :)

Go straight to repository (here), if you wanna skip class ;p

Step 1: Visit bitaddress.org

Go visit bitaddress.org, and you will see similar screen as below.

This website allows you to create single (or bulk) wallet addresses and also provides a variety of functionalities around Bitcoin wallet creation. You may now swing around your cursor to fill up the random seeding degree (e.g. the 6% thing on the screenshot).

Click on Bulk Wallet, as soon as it shows up on the green bar. You can now fill in any number in the Rows to generate section as the amount of wallets to be generated. By clicking the Generate button, the plaintext csv outputs in the format of:

(index, public address, private key)

will turn up in the blank area. However, there is no way around for you the download the csv outputs directly. The Print button might be okay, but it sadly fails to print addresses with index larger than 20. :(

Also Read: Best Hardware Wallets

Step 2: Download bitaddress.org code

Right click on the website, and choose Save as. Now you have the code script saved on your desktop. There should be two files included:

  • bitaddress.org.html
  • bitaddress.org_files/ (folder)

Step 3: Start hacking!

Open the bitaddress.org.html file with whatever editor you love the most. A lovely notepad can work too!

Hint: We are modifying stuffs at the “Bulk Wallet” area, so we should start looking for items around Bulk. If you search for “bulktextarea” in bitaddress.org.html, you could easily find the functions that are handling bulk wallet (e.g. wallets.bulkwallet) at around line 10030.

Let’s add a new function below the “close” function, named “download”. This download function should contain codes about downloading the csv outputs. The function is implemented as the following:

This function has three major parts:

  • csvContent captures the csv outputs in the “bulktextarea” and appends them to a csv file header.
  • link creates an <a> with a downloadable file name as “BitcoinKeys.csv” and the content as encodedURI(csvContent), and appends itself to html.
  • link clicks itself to trigger the download.

Make sure that the “download” function is placed correctly between the “close” function and the “buildCSV” function.

Step 4: Hook up the download button

Search for “buildCSV” to see in which part of the html calls this function. You will hit line 6708 at the following <span>:

<span><input type="button" id="bulkgenerate" value="Generate" onclick="ninja.wallets.bulkwallet.buildCSV(document.getElementById(&#39;bulklimit&#39;).value * 1, document.getElementById(&#39;bulkstartindex&#39;).value * 1, document.getElementById(&#39;bulkcompressed&#39;).checked, document.getElementById(&#39;bulkpassphrase&#39;).value);"> </span>

If you scroll down to line 6709, there is the Print button, which looks like this:

<span class="print"><input type="button" name="print" id="bulkprint" value="Print" onclick="window.print();"></span>

NOW it is your turn to add in a new “download” button with the following codes:

<span><input type="button" name="download" id="bulkdownload" value="Download" onclick="ninja.wallets.bulkwallet.download();"></span>

This function is nearly the same as the Print button. The slight differences are the name, id, value, and onclick function, which points to our newly created “download” function!

Hint: You may COMMENT OUT the Print button code, if you dislike it. :)

Step 5: Test it

Now save everything, and refresh the bitaddress.org.html file. You will see the Download button shining at the top right corner!! ❤

Go generate 3 wallets and click on the “Download” button to see how the magic happens!

Wrap Up

In this super-swift article, you have learned about the basic of Bitcoin address generation in bulk, and also the followings:

  • Hack in and create a customized Download function
  • Hook up the function with an additional Download button

The main idea of this tutorial is to show you that “You can always upgrade any tool that you feel not so handy!” Try to make a difference and contribute to the community anytime.

Checkout Best BTC Wallets For Android

I hope you like the short tutorial. Feel free to let me know how you would like to work around bitaddress.org to create many other new features! :)

Code repository for lazy ppl (here)

Join Coinmonks Telegram Channel and Youtube Channel get daily Crypto News

Also, Read

--

--

Jeff Hu
Coinmonks

Co-founder & CEO @ TuringChain.tech / Scholar @ UC Berkeley Blockchain Lab / Entrepreneur, blockchain researcher, magician, and poet