How we built a bitcoin casino, and what we did with the crazy profits…

In early 2018, the globe was emerging from the frenzy of Bitcoin, with many having recently uncovered the concept of cryptocurrency. The terms ‘crypto’ and ‘decentralised’ were on everyone’s lips, attracting developers to create projects ranging from decentralised marketplaces, claimed to be world-changing, to, crypto casinos as you’ll see below that we developed.

Thinking about what was needed for a crypto casino there were 3 main parts we had to design. 

  1. The bitcoin wallet and ledger.

    Upon registering with the casino, the users received a unique Bitcoin address which we generated for them. This address was linked to an internal ledger that tracked all their transactions. Since no existing services met our needs at the time, we set up our own Bitcoin node on Amazon Web Services (AWS) to oversee incoming Bitcoin transactions. Additionally, we utilised a simple MySQL database hosted on AWS to maintain a record of user transactions, effectively functioning as our ledger.

    We monitored the user’s address for any incoming funds and upon confirming a transaction, we updated the user’s ledger with the corresponding amount, which was then reflected in the user interface.

    To manage payouts, we employed a script that consolidated bitcoin from all user addresses into a single central address, from which we distributed any winnings.

  2. Provably fair.

    This component is arguably the most crucial and intricate aspect of the casino. It involves generating game outcomes through a distinct cryptographic algorithm. This process allows players to analyse and verify the fairness of the games themselves. Such a system guarantees that it is impossible for the casino to manipulate or cheat in the games. Hence the name provably fair.

    The algorithm operates by combining a seed from the client, a seed from the backend, and a nonce that increases by one after each game. The backend seed is hashed and shared with the user for future verification. These three elements are used by the casino to determine the outcomes of each game. If a user wishes to verify the fairness of the games, they can request to see the casino’s seed. By comparing it with the previously received hash, and if they match, the user then possesses all three components that were used to generate the outcomes of their games, enabling them to independently verify the results.

    All of the above was written in NodeJS on AWS Lambda, a serverless compute platform which ensures that we could scale our backend to tens of thousands of users without having to worry about upgrading hardware.

  3. The casino game itself.

    We decided to begin with roulette, a timeless classic in the realm of casino games. For its development, we opted for React Native, a favoured choice for our mobile applications due to its cross-platform compatibility with both iOS and Android. The graphics were crafted using the react-native-reanimated package. Additionally, the sliding menu items on the left and right sides were developed using react-navigation, a fundamental component in many of our applications. 

    The entire game logic was programmed in the previously mentioned backend environment on AWS Lambda. To enable communication between the game and the backend, we had to construct our own API, which we did with AWS API Gateway.

 

Once we had our casino up and running, we were salivating thinking about all the profits we would soon have… so we waited and we waited… day after day, night after night… 

The reality is that developing the technology is merely one facet of operating a business. An equal amount of effort must be devoted to strategy, marketing, customer acquisition, and in the case of a digital casino, obtaining gambling licences. Back then, our financial constraints hindered us from adequately launching this venture. Coupled with other ongoing projects, the opportunity cost of continuing this pursuit was too high for us, leading to the decision to shelf it as we transitioned to our next project. Regrettably, the anticipated “crazy profits” did not materialise.