Though the blockchain is very popular these days, there is a significant gap in the way it works and how most of us understand it. Most of its resources such as smart contracts are still a work in progress. Let’s talk a bit more about them.
Bitcoin and Ethereum are the two most popular cryptocurrencies today, with the latter being more developer-friendly. A program that runs on the Ethereum blockchain as a collection of code (its functions or rules) and data (its state) that resides at a specific address on this blockchain is a smart contract. A developer would need to learn how to code in smart contract language and have enough ETH (Ethereum currency) to pay as Gas fees (call it cost of doing business or initiating a transaction) for deployment of the contract.
In simpler terms, a smart contract can be considered as an open API that can call other APIs. A chain of smart contracts can make a serious business transaction. In the long run, the number of libraries is going to increase and development of smart contracts is going to be much easier and more efficient, targeted at replacing highly skilled professions such as lawyers or government contract agencies that focus on governance through compliance.
Blockchain is an ever-evolving field, and there is no definitive approach or set pattern for the development of smart contracts. However, there are a few open source tools that have proved to be effective as development environments like Truffle, Embark and Builder. These tools efficiently handle compilation, deployment, debugging and upgradation of contracts with the sophistication of running unit tests.
Development of smart contracts requires a set of tools, most of which are available in open source. With trial-and-error, the appropriate environment for the development of smart contracts can be established. The good news is that there is quite a bit of information available on the Web for how to go about doing this. Also, the technology has been in the works for more than five years, bringing in some stability in the tools with enthusiastic developer forums putting in troubleshooting efforts.
The Ethereum community has defined multiple standards in the form of ERCs (Ethereum requests for comments). This is a document used by smart contract programmers to refer to the rules Ethereum based tokens must comply with. There is a thriving community of developers, enthusiasts and organisations across the globe working to standardise the use of Ethereum. Requests for Ethereum improvement proposal (EIP) are maintained on GitHub. At the time of writing this article, there are nearly 5000 requests suggesting the increased adoption and agility in this space. Of these, 267 have been finalised and the rest are in various stages of approval.
EIPs are of various types such as standard track, core, networking, interface, ERC, meta and informational.
The significant number of proposals and rapid finalisation workflow indicate a thriving community working towards standardising the interactions in blockchain (at least in the Ethereum world), thus building the momentum for developing standard libraries across routine functions.
Table 1: Top 10 Ethereum standards
|20||Fungible token standard||
|165||Standard for method, instead of tokens||
|721||Non-fungible token (NFT) standard||
|777||Increase efficiency in crypto transactions||
|778||Ethereum node records||
|2767||Contract ownership governance||
|3448*||Meta proxy standard||
|4626||Tokenized vault standard||
*EIPs are in various review stages
Smart contract libraries
Smart contract libraries are nothing but contracts. However, their purpose is to be deployed once at a specific address and then be reused for delegating routine tasks, so that the calling functions can execute as if this is their own code as part of the contract.
There are two kinds of smart contract libraries — reusable behaviours that one can add to contracts, and implementations of various standards.
Common routine coding patterns include exception handling or managing unexpected issues. Smart contract libraries usually provide reusable implementation of the behaviours as libraries or via inheritance in Solidity (a language in which smart contracts can be developed).
Open Zeppelin contract library is a GitHub project dedicated to secure smart contract development with a role based permissioning scheme for the development and use of reusable Solidity components. This is a very popular forum used in building complex decentralised systems. An innovative and interactive ‘Contracts Wizard’ approach is available to get started with generating smart contracts. The contracts support stable APIs, ensuring unexpected upgrade related issues are addressed efficiently.
Dappsys is another popular collection of smart contracts building blocks. It’s written in Solidity but can be linked to any language (think of it as smart embedded APIs). DS-Math is the most used library for arithmetic functions that does basic addition, subtraction, multiplication and division by handling integer overflows and simplifying routine functions like finding the minimum or maximum of two numbers.
The rapid adoption of blockchain and smart contracts is pushing the development community to get a common standard. This is still a work in progress, though.