I made a “Buy Bitcoin Button” using the old and now defunct Amazon Dash Buttons. It’s literally a button, that when pressed, buys Bitcoin.

Cryptocurrency News and Public Mining Pools

I made a “Buy Bitcoin Button” using the old and now defunct Amazon Dash Buttons. It’s literally a button, that when pressed, buys Bitcoin.

Hello and happy Monday.

A few weeks ago, with the help of a couple online resources, I made a "Buy Bitcoin Button". First, a little backstory about these buttons for those that aren't familiar with them.

Years ago, Amazon released "Dash" buttons. These little IoT devices allowed users to press a large button on them and they would instantly place an order for the product that the button represented. For example if using the Bounty paper towels Dash button, if you were out of paper towels, you could press the button on the little gadget to get more. Pressing this button would trigger an Amazon order of a pre-selected quantity of Bounty paper towels. They also made buttons for many things including Cliff bars, Tampax, etc. The buttons were essentially free when first launched. I believe they cost $5, but also came with a $5 credit towards your first purchase of the product the button represented. Anyways, I ended up getting 6 of them, because they were basically free, and why the hell not?

Fast forward a few years and I think I only used them a few times. While a neat idea, they had some flaws, such as if the item you had configured to buy or quantity, was no longer in stock or the price was now more expansive than your local store, etc. The product failed. Amazon no longer supports these devices. I've had mine sitting in a tech junk drawer for years.

But that doesn't mean they're dead! You can use them for fun things, such as buying crypto! To get started, you'll need an old Amazon Dash button. If you don't have one, maybe you can find one on eBay.

Next, you'll need a Linux box. You'll use this Linux machine to run a "fake" Amazon Dash service and a script to make the actual Bitcoin purchase. I used a Raspberry Pi 4 to accomplish this task.

Now this is where the fun begins. Visit this Python Amazon Dash GitHub repo.

This is where you'll run the "fake" Amazon Dash service on your own network. Normally, when pressing the Amazon Dash button, the button makes a call out to Amazon's web servers. Well, they're dead now and we don't want that to happen anyways. So, you need to run a service on your own network that looks for an Amazon Dash button and intercepts outgoing calls to Amazon.

Clone the GitHub repo, follow all of the instructions to setup and configure your Amazon Dash button. Make sure the program can see and find your Dash button.

You'll notice that you can configure your Dash buttons to do various things here from IFTTT recipes to various smart home commands, to web calls, to local scripts. For the purpose of this tutorial, we're going to want to use the system command option. We'll edit this later.

Now that we have a control over an Amazon Dash button, it's time to implement actually buying Bitcoin. Next, you'll need to have an exchange account with an exchange that allows purchases to be made via API. You'll then use the API to create a command line script that executes a market buy order on the exchange that you chose. For this example, I chose Coinbase Pro and their API.

You'll want to clone this GDAX Bot GitHub repo if you have a Coinbase account. If not, you'll need to find a similar script for your exchange and configure it.

Once you have the script cloned, you'll need to configure it with your Coinbase Pro API information. You'll need to visit your Coinbase Pro account and select API settings, create a new API, configure the permissions, and enter all of the API keys into the GDAX Bot variables.

This script allows you to buy any Crypto from Coinbase Pro for any fiat amount that you specify. In my example, I am using BTC-USD for a specified market order amount of $100 USD.

I would highly recommend testing this with the Coinbase Pro SANDBOX. You'll need to create a separate Sandbox API key. You'll need to add money to your Sandbox account if you haven't already. The linked bank accounts aren't really yours, so enter a large amount and become a millionaire. It's just test data.

Once you have GDAX Bot configured, you can attempt to try a command line test. Here is my example command:

python3 gdax_bot.py BTC-USD BUY 100 USD -sandbox -c gdax_bot_settings-local.conf

You'll want to then visit the Coinbase Pro orders section and wait for your order to show up and be executed. It can take a few minutes on the Sandbox.

Next, you'll need to create a script for buying Bitcoin. I created the following script named buyBTC.sh.

vim buyBTC.sh


echo "Time: $(date)" >> /home/pi/gdax_bot/debug.logpython3 /home/pi/gdax_bot/gdax_bot.py BTC-USD BUY 100 USD -sandbox -c /home/pi/gdax_bot_settings-local.conf >> /home/pi/gdax_bot/debug.log

Save the script. And then make it executable.

chmod +x buyBTC.sh

You can then test the script by running it.


The script should create a debug.log output file that you can use to troubleshoot if needed. If everything goes according to plan, you should get another buy order on the Coinbase Pro Sandbox. Again, at least on Sandbox, this can take a few minutes.

Lastly, we need to tie it all together. Edit your /etc/amazon-dash.yaml file again to point to the script that you made to buy Bitcoin. In my example, this is the buyBTC.sh script that we just made.

cmd: /home/pi/gdax_bot/./buyBTC.sh # Command to execute

Now, when pressing the Amazon Dash button, the Amazon Dash daemon that you created and tested in the beginning will execute the buyBTC script. This script will then fire off the GDAX Bot command to buy your specified amount of BTC from Coinbase Pro. If the order does not show up, view your debug.log file.

You can customize as many Amazon Dash buttons as you'd like for as many Buy Crypto buttons as you'd like. You can create as many buy scripts as you'd like for as many buttons as you have. Please test each one accordingly with the sandbox API for your exchange of choice.

Now that the fun is out of the way, I'd like to say that this guy is strictly only for fun. I never implemented these personally outside of Sandbox. I only used this as a proof of concept so I could say hey honey, look at me, I can press this button and buy magical internet money, pretty cool huh? (The wife wasn't as impressed as I was, your mileage may vary.)

If you decide to implement this in production, please note that I will not be held responsible for any accidental button pushes. This will 100% buy whatever you have configured to buy. Please use this at your own risk.

Edit: I used my Photoshop skills on my old buttons. Enjoy.

submitted by /u/rayfin
[link] [comments]

Facebook Comments