How to Generate a Vanity Bitcoin Address on AWS
To generating vanity Bitcoin address like _1MasonVyvcWgW6KtWVbhW4hdjEKgii3tZ7 you use a brute force algorythm. Using my 2.6 GHz Macbook Pro I can generate about 150 thousand keys per second. The address generator also comes with a program called OCLVanitygen that runs on the GPU. With OCLVanitygen I can generate about 1 million keys per second. This means you can geneate a vanity address with 5 charaters in about 6 hours.
I wanted to be able to generate longer addresses without waiting any longer and without buying new hardware. There are online vanity address generators but you can never be sure that those are safe to use.
Since we’ll only need this processing power for a few hours max we can rent hardware to generate our address on instead of buying it. AWS provides virtual machines that have NVIDIA GPUs with up to 1,536 CUDA cores and 4 GB of video memory. You can rent these for 65 cents per hour so it’ll cost about 8 bucks if you run it overnight. Don’t foget to destroy these instances when you’re done though. If you leave them on for a month it could cost nearly $500!
The first thing we’ll need to do is spin up a AWS GPU instance:
- Login to the AWS Management Console, create an account if you don’t already have one.
- Click “EC2”
- Click “Launch Instance”
- Select Ubuntu Server 14.04 LTS (HVM), SSD Volume Type
- Select “GPU instances” “g2.2xlarge“ then click “Review and Launch”
- Click “Launch”
- Select “Create a new Key pair”, enter a name for the key pair and click “Download Key Pair.” Move the key to your
- Check the checkbox and click “Launch Instances”
- Click on the Instance ID and note your instance’s public IP address
- Open Terminal and type
chmod 400 .ssh/aws-key.pem
ssh -i .ssh/aws-key.pem ubuntu@<your instance public ip address from step>
Next we’ll have to build the CUDA drivers which are used by the address generator:
First you’ll need to download the drivers:
Go to the Cuda Downloads page and copy the link for Ubuntu 14.04 “Network Installer” and wget that file:
sudo dpkg -i cuda-repo-ubuntu1404-7-0-local_7.0-28_amd64.deb
sudo apt-get update && sudo apt-get install cuda
Finally make symlinks to the
sudo ln -s /usr/local/cuda-7.0/include/* /usr/local/include/
sudo ln -s /usr/local/cuda-7.0/lib/* /usr/local/lib/
CUDA drivers require you to rebuild the linux kernel from source. Run:
sudo apt-get updateand
sudo apt-get install linux-image-extra-`
choose “keep the local version currently installed” when prompted about the grub menu list
The last step is we need to build OCLvanitygen:
- Install git:
sudo apt-get install git
- Clone the repo:
git clone https://github.com/samr7/vanitygen.git
- Install dependencies:
sudo apt-get install libssl-dev libpcre3-dev
- And build:
cd vanitygen && make oclvanitygen
Once you have oclgen built you can run
And see it start to crunch away! Happy generating!
Thanks to all my sources!