in

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](https://en.wikipedia.org/wiki/Amazon_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](https://github.com/Nekmo/amazon-dash).

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](https://github.com/kdmukai/gdax_bot) 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](https://public.sandbox.pro.coinbase.com/). 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](https://buyBTC.sh).

`vim buyBTC.sh`

Enter:

`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.

`./buyBTC.sh`

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](https://i.imgur.com/3SOa9Th.jpg).



View Reddit by rayfinView Source

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

GIPHY App Key not set. Please check settings

28 Comments

  1. I would make a sell button as well and just sit there with Coinbase pro up on my TV screen and just have the buy in my left hand sell in my right and sit there feeling like god.

  2. I used to eat Tide Pods. Now they will buy me a Bitcoin. This is what I call a future.

    Edit: You screwed me with the thumbnail OP, there was a Tide Pod πŸ™

  3. That’s actually so cool. I never knew that such a button existed. It saves a lot of time, because you can just press a button instead of logging in to your exchange

  4. Yoooo i completely forgot about amazon dash!

    I remember back in the day i watched a youtube video of someone putting a few of them in a blender and it ordered a couple hundred bucks worth of shit.

Loading…

0

What do you think?

The Ethereum Fractal You Have Got To See

The Ethereum Fractal You Have Got To See

I don’t know why more people aren’t flipping out that 1 BTC = 1 Lambo