Bitcoin Game Box

BitcoinBox Demonstration


I have also shared this project on GitHub. You can find it here.

Please note, that by sharing I am not intending to create a complete 1-2-3 guide. Also there might be some improvements possible, maybe the code can be optimized further. I created the project to create a game that works, and makes it fun to compete with your bitcoin trading skills using virtual (or real!) bitcoins. If you are interested, feel free to check out the project.


My motivation began in spring 2019, where Bitcoin prices increased quite rapidly, from a long time 3.500 USD/BTC to a point of more than 13.000 USD/BTC - in a very short time and with a lot of fluctuations. Investing in Bitcoin, is similar to being on a rollercoaster, as the price chart for 2019 shows above ..

With so many fluctuaions, opinions and theories worldwide - it seems quite difficult trying to foresee where the bitcoin is heading

Bitcoin Price Update

Because of having invested a little bit in bitcoins, created a need for checking the prices a few times on a daily basis. This was easy having 3 monitors on my desk, one screen could basically be dedicated to show price charts. But of course, having an open browser at your work, blitzing price motions is not really a sustainable solution.

I just needed something more subtle, with a small display showing the latest bitcoin price. Something that could easily be placed into a corner of my desktop, yet keep me updated.

Bitcoin Box

A small LCD display, displaying data using an ESP8266 seemed like the perfect solution. It could be simple and cheap. Everything could be placed within a 3D printed box. I told my colleagues about the idea, and working in an engineering department as I do, it resulted in some talk and pitching of all the additional features it should have.

Trading on the bitcoinbox

We realised, the Bitcoinbox now had a higher purpose. It should not only give the user price information - it should allow trading. Two buttons: Green for Buying and Red for Selling - or: Green for “Going Long” and Red for “Going Short” as the final version have.

What is on the display

  • Center Value: Current BTCUSD Value
  • Top Description: Your current position: LONG / SHORT / OUT
  • Value below Top Description: Price when entered a position
  • Left Lower Value: Your current Score
  • Right Lower Value: Your opponent Score

Competing on the bitcoinbox

Because the bitcoinbox is online, it is possible to share information. If we made multiple boxes, we could share the value on trades. Creating a game - where two people trades bitcoins on their private bitcoinbox, and for every 30 seconds, the individual and opponent score is updated on both bitcoinboxes. Allowing the trading competetion to begin.

Recipe for bitcoinbox

Components Used for the bitcoin box

  • 3D Print of casing (available at GitHUB)
  • WeMos D1 Mini: ESP8266
  • LCD Display
  • 1 Red Button
  • 1 Green Button
  • 1 White Button
  • Wires
  • Buzzer

3D Printing Box

For the design, I was inspired by the classical pocket games in the 90’ies. A display in the middle and buttons on either side. Go long or go short. Very easy to use. On the back, I added a reset button. Because data is being stored online, the best way to make a manual hard reset is to hold the button while booting the bitcoinbox. Inside the box there should be just enough room for the wiring and components, but it might not be easy to fit.


There are a few versions of the OLED display. And they can be connected differently. Below example of connection can be done using OLED 128x64.

Putting everything inside the box, was indeed quite difficult! I recommend making the box a bit larger than I did.


I programmed the ESP8266 using the Arduino IDE and most challenges were about the button states. It is possible to make the code more elegant, but for now it works quite fine. The code is also shared on github - feel free to make your own version.


There are a few solutions to retrieve bitcoin prices on the box. Initially I used a library for coinmarketcap, but found it to be a little bit unstable in my case.

Instead I decided to communicate only to thingspeak on the boxes. It makes storing and retrieving values more simple. Each user has a dedicated thingspeak channel for storing values, and there is a third channel for storing bitcoin prices.

The drawback of using only thingspeak on the devices, is the requirement of having a third dedicated instance to upload bitcoin prices into thingspeak for the devices to download. My solution is to have a labtop retrieving bitcoin prices from coinmarketcap (could be a raspberry pi or similar) and uploading to thingspeak every 20th second.

The code is generated in a python script. This solution allowed me to make have the ESP8266’s to connect only to ThingSpeak, and the beautiful part is the ease in which real trading can be applied to this script. If the user has a coinmarketcap API, then real bitcoin trading can be turned on, whenever the user does a trade.

Bitcoin Box Game


You can use the two buttons to trade bitcoins in real time

Startup Mode 1: Continue Game

This is the default startup mode. When the bitcoinbox gets powered up, it will show a logo and play a nice little tune. To get you in the pocket game - bitcoin trading mood. This is also an indication to the user that the game will continue. The box will go online and retrieve all states and values that are being stored online.

Startup Mode 2: New Game

If a new game is about to begin, then the white button on the backside should be used. If this button is simultaneously pressed when starting up the box, the bitcoin game box will not go online to retrieve all stored values. Instead it will reset scores and overwrite all trades and states with default values. This allows all users to start a new game using only the bitcoinbox.

Network Error

I added some additional functionality whenever connections to the server is lost. If the bitcoinbox looses connection, it will display a “server error” and a count starting with 1. The box will try to reconnect after 30 seconds. If succesfull game continues. If not succesful it will repeat 3 times, updating the counter on the display.

If connection is not possible, the ESP8266 closes the connection and starts it again. It will do another 2 attempt reaching a total of 5 trials.

If still no connection is possible, the board will do a hard reset, using a connected wire from a pin to reset. Ultimately rebooting the bitcoinbox. This usually works.

There is a small catch to the hard reset. Because of the display used, there were no more open connections. In my code I use the wiring from the ‘new game’ function instead. The best solution is probably to use another display with only 4 pins, freeing up some connections. Just remember to allow for easy dismounting of the hard wire reset pin - if you want to upload new code to the board.

Playing the game

The bitcoin box can ultimately be used for:

  1. Latest BTCUSD price Information
  2. Trading Virtual or Real Bitcoins
  3. Competing in Bitcoin Trading Skills


We did play the game a few times, and it really gave the trading strategies some new perspectives.

We decided to play the game for a fixed amount of time, in our case it was for one month. Both users began with a score of 1.0000. Every trade is an ‘all-in’ decision. Whenever a trade is being closed, the current trading score gets calculated and applied to the overall accumulated score. The user with the highest score on the chosen ‘final day of trading’, would ultimately be the winner. During a game, live scores could be seen on thingspeak, and we used HTML written scripts, that did show development of the game. This was quite simple, because all data were available on thingspeak.

Allowing both players to keep track of both scores simultaneously, gave it a really nice strategic perspective. Very often we tried to simply outplay the other, by just trading to a gain of 0.0001 more in profit than the other player. That would actually force the other player into making new trades and taking on more risks. - How you decide to play the bitcoin game, is up to you of course :)