Solidity and Ethereum

October 25, 2021

Ethereum is a decentralized blockchain driven cryptocurrency, very similar to Bitcoin but with a few very key differences. Ethereum stands out from similar currencies due to its open source nature that enables anyone to create contracts and different ways to transfer their ether with anyone in the world. This is where solidity comes into fruition, as it is a culmination of languages like Python, Javascript, and C++ that enables this high level implementation of contracts similar to C++ classes. I had first heard of solidity through a family member that has recently picked up the language and it now seems like most of our conversations surround the topic. I figured that I may as well learn to what level these contracts can be customized and think of some potential use cases for the relatively new technology. At the time of starting this project, I had no direct problem in mind to solve but rather learning how the technology works and thinking of use cases based on that understanding.

The first step in learning is usually getting some context around the problem or technology, so doing some research into what exactly Solidity is and how it interacts with the Ethereum blockchain was necessary. Thankfully it is very well documented and the community is very helpful to those asking questions. I found the EthernautDAO discord to be a great resource for anything from questions, code reviews, finding mentors, and even some job listings for those with more experience. With some research done, I decided to try to send some Ether from one account to another, using remix web based IDE. There are numerous ways to do this action, but I went with creating a contract for a singular token and another contract as a token manager. The token manager keeps an array of Ethereum wallet addresses (test wallets created through the IDE, no actual Ethereum transferred during development) as well as the total number of tokens purchased. The array of addresses keeps track of what address has purchased a token by pushing the wallet address onto the list, meaning that a record of who holds which specific token is preserved. Solidity includes information about who sends calls to any contract through msg.sender and tx.origin that allows for the contract to directly respond to any system making the calls. Thanks to a few beginner tutorials this was a relatively smooth process that allows for plenty of further customization once a few basics are in place. Shown in Figure 1 is the output of running a few iterations of a specific wallet buying a few tokens. Figure 2 shows the process of buying a token for a specific user, while Figure 3 displays what happens to the list of all tokens purchased.

Figure 1.

Figure 2.

Figure 3.

This project’s current state is mainly an educational tool that was used to learn a new language and technology, however it can be directed many ways. A good direction to take this sort of project is to implement some sort of mobile or web application alongside of the features found in solidity. Almost anything cryptocurrency or money related is possible since it is a purely open source way to transfer these Ethereum tokens. A few directions that come to mind would be Ethereum based payment applications (similar to PayPal), a betting application where users can put their personal tokens into a pot and automatically distribute winnings upon a decision, or a virtual trading platform that allows users to wager their own ethereum or purchase cards using similar transactions. While a simple example of just swapping tokens between wallets is quite easy to implement, a more secure and fleshed out version would likely be rather difficult to produce. Some questions that arose during my time working on this and thinking about it afterwards mainly revolved around the security side of open source transactions and how someone could exploit that aspect of both solidity and ethereum. Finding different ways that security can impact a technology like this is a major deciding factor on whether or not it will be successful.