The Power of Ethereum

Tyler Pugh, Senior Systems Engineer, BitMED

In the conclusion of my last article I mentioned that blockchain technology can be used for purposes far more advanced than just cryptocurrency. In this article we will dive into a particular blockchain that opened up a world of possibilities.

So far, we have only covered the usage of the Bitcoin blockchain but another public blockchain was developed many years after Bitcoin was released. This is known as the Ethereum blockchain. The game changing feature of Ethereum is the ability to put actual programs on a blockchain. On Bitcoin, we can just send and receive digital currency between bitcoin addresses with each transaction joining the massive transactional ledger. With the Ethereum blockchain, since programs can live at these addresses, instead of just sending funds, you can issue actual function calls on these programs. These programs have been given the name “smart contracts”.

Simply put, smart contracts are ordinary programs that live on a blockchain, however there are some key differences due the technology at play.

Remember in the last article how we discussed the immutability of the blockchain? This aspect of blockchain technology also holds true when developing smart contracts. When a contract is deployed onto the Ethereum network, it is permanent. There is no way to update the code once it has been deployed. This means that when developing a smart contract, testing is of the utmost importance. You can always redeploy your contract but then you will have two contracts on the network that can both be called by users. One of those contracts might be broken, and one will be the updated contract that you want your users to interact with. Due to this possibility, many smart contract developers will build in specific functions that will alter certain variables in the smart contract to make it unusable. This way a user doesn’t accidentally send funds or issue function calls to a broken contract on accident. At first glance, it might sound like a bit of a pain to develop applications in such a way. However, when building on a system that must maintain data permanence, this is the nature of the beast.

Another interesting feature of smart contracts is the fact that you can send digital currency to them just as though you were transferring to someones digital address. You can harness this capability by writing one or many “payable” functions. You can define a default payable function that executes when someone tries to send digital currency to the smart contract address without explicitly calling a function. If you don’t write a payable function, the smart contract will still accept transfers of digital currency into it, but there will be no way to retrieve the funds, locking them up for forever. Understanding how the payable features of a smart contract work is incredibly important.

The last aspect that I would like to cover is transparency. The transparency around smart contracts is more a product of community standards than anything else. With most backend programming languages the code that runs the application is meant to be kept private. This is why people protect their hard work in private repositories (GitHub or of the like). That said, in the blockchain space, we are all about transparency. It is common practice to submit your code to the community and have it verified against the compiled code that you deployed. This ensures to the user that you are not doing anything shady because they can see the underlying code. Since most smart contracts out there involve a means to move digital currency around (among other things), this community standard has become rather important. Personally, I would not want to send my digital currency to a smart contract if it was not verified. Keeping that in mind, always be sure to be transparent about your smart contracts if you want community involvement.

While smart contracts are very similar to ordinary programs, they have completely changed the blockchain atmosphere. The community is constantly developing new applications for this technology and companies are rapidly researching how they might be able to leverage such an innovative system.

Next, I will unfold exactly how to go about developing your very own smart contract.

Stay tuned!