Cube| A Simulated CrypotCurrency Simulation Program Right at Your Terminal!

We all know that cryptocurrency is growing and will probably take over the current currency we use today in the future. Instead of using bills and coins, we will be using digital data and transactions to purchase the items or services we desire. On Youtube, I watched a video about Dogecoin and how it started to rise. Surprisingly, it started off as a meme, which then made me wonder about the other cryptocurrencies and how they were made.

There are over 4,000 different cryptocurrencies, and many of them were started either as a joke, as a business, or as an independent project. When I was researching these cryptocurrencies, I came across this article where we could create our own cryptocurrencies right from our own laptops! When I first read the title, I was already excited! I was always interested in how cryptocurrency worked and the direction it was going in. Hence, I started off by taking an “introduction to blockchain” course online. After spending a week learning about how blockchain programming works, and how we can create a blockchain in Python, I came up with my own simulated cryptocurrency program called Cube!

Cube was made using Python, and it took around 2 weeks to fully develop the program because there is more than just a simulated cryptocurrency. Not only did I create my own cryptocurrency, like mentioned before, but I also added a simulated server using an infinite loop sort of making the program ‘global’ within the terminal. But what’s interesting or unique about this program is the simulated users. By using the random module in Python, the program will create a random amount of users (ranging from 1–1000) with random amounts of money. These simulated users can then interact with the real-time user right from the terminal using the simulated server I first mentioned above. In other words, the real-time user and simulated users can initiate trades with each other. If the user makes 15 transactions, the user will be rewarded with a ‘bitcube’ where they can mine to win big amounts of simulated money.

Furthermore, to make this program much quicker to play, I decided to add a simple feature where users can type ‘a’ to make money using a nested infinite loop until the user prompts the program to quit. The value per ‘a’ changes every two hours, so the user can initially make $5 in the first 2 hours, then later, a chance to make money ten, eight, five, four, three, or two times the amount of money. The money gained from this feature will go right to their simulated account, which then can be used to make transactions with other users who are also “online”. At the start, this feature is essential as all real-time users will start off with $0.

Now, let’s talk about the backend of the program. To create the blockchain itself, I used a Linked List but the links are actually hash codes instead of nodes. These hash codes are bitcubes that users mine, and were generated using the hashlib library. By using hashes, it is very difficult to hack or break the blockchain, as users have to solve the extremely difficult computational problem that the program generates. Moreover, their solution not only has to be more than 10 digits long (lengths of solutions vary depending on currency), but it also has to compile with the other blocks in the chain, otherwise, the blockchain will be broken. In this case for the program, if the blockchain breaks, the user either has the chance to fix the whole chain again by trying to solve the difficult problem that the computer-generated, or can quit and get a new chain. However, the user will lose all their money and cubes they had received. In terms of the mining feature, it is very easy for the user to generate possible solutions by pressing the enter key as the program will automatically generate a solution with the desired length, but not with the right digits, prompting the user to keep trying until they have either quit or have found the right solution.

In terms of the trading part of the program, the program will list all the users (random amount generated using the random module) “online” using a basic list, in which, the user can easily input an amount they want to trade (amounts must be above $5) with the user they have chosen. Furthermore, to make the simulation a bit more interesting, with the use of the random module, there is a one-in-two chance that a random user will send the real-time user a random amount of money, which can range from approximately $1-$10000, which also increases both users number of transactions done.

Program listing users and the current amount of money the real-time user has while deciding to trade.

Check out my code on Github: https://github.com/GEEGABYTE1/Cube

Overall, this simulation is a great way for beginners and people who are interested in learning the blockchain industry. Although the simulation does not reflect the actual blockchain industry as it is way more complex than just typing certain commands, this simulation gives the basic gist of how it looks like to trade and sell cryptocurrency.