Smart Contracts: Diving Deep into Implementation
Billions of people use the Internet every day. If I had to give you a rough estimate, it’s somewhere around 77 billion. Out of this number, 0.5% use blockchain in some way or the other. Blockchain first became a topic of discussion with the success of Bitcoin, and naturally, it piqued people’s interest. Smart contracts came into the picture, revolutionizing the financial sector and ways of doing global businesses.
A few weeks ago, we did an article explaining the basics of smart contracts and how they’re playing a crucial role in unveiling the new era of financial inclusion. You can check it out if you haven’t already, by clicking here.
We’re going to learn so much more about smart contracts in this article. Where are smart contracts actually implemented? We know they can be used in multiple sectors, but how do we use them? For that, we need to talk more about DApps.
What are DApps?
As smart contracts have opened up opportunities in the trade finance sector, particularly, the emergence of applications utilizing these advantages was inevitable. That’s when DApps or the decentralized apps came into picture.
DApps are frequently referred to as “trustless” or “peer-to-peer” because they are not controlled by a single server or entity. Blockchain technology is used for DApp’s data storage and processing. This is implemented using smart contracts. The typical client-server network model isn’t used by DApp. They are open-source, meaning the code is available to everyone. A P2P network is one where the computers in the network interact directly with each other.
Let me surprise you for a bit. Have you used BitTorrent before? Chances are if you use or have used BitTorrent in the past, you’ve already worked with a P2P network. Mind-boggling right?
This MIT lecture (MIT Open Course Wave) from the incredible open-education decision taken by MIT, helps explain DApps and Smart Contracts in the most comprehensive way possible.
Let’s now talk about the development of DApps. The dev community all over the world is looking for someplace to start their research, and we’re here to do just that!
Developers can build DApps using various platforms like Ethereum, Hyperledger, EOS Blockchain, Corda, etc.
Let’s take a few examples to explain DApps and the utilisation of smart contracts better.
Case Studies are the real teachers.
Our first case is Uniswap.
Uniswap is an automated crypto exchange platform that is ethereum-based with its own governance token.
The vast majority of crypto trading has always taken place on centralised exchanges like Coinbase or Binance. These platforms are usually under the authorization of a single authority which, mostly, is the company that operates the exchange. They need customers to put funds under their control and trade using a typical order book mechanism.
For instance, suppose you want to sell bitcoin (BTC) for $55,000 on a centralised exchange, you’d need a buyer to appear on the other side of the order book, looking to buy an equal or higher amount of bitcoin at that moment. The major problem of this is liquidity. The number of orders on the order book at any particular time is referred to as liquidity in this context. If there’s low liquidity, there are chances that traders may not be able to fill their buy or sell orders. Low liquidity also means that price discovery will be far from being efficient.
That’s where Uniswap came in. It’s a whole new form of exchange that’s completely decentralised and uses an automated liquidity protocol, which is a pretty new type of trading mechanism.
As Uniswap, like all DApps, is open source, anybody can use the code to build their own decentralized exchanges. Uniswap consists of two smart contracts, namely, one for the “Exchange” part, and another for the “Factory.”The factory smart contract is used to introduce new tokens to the platform, while the exchange contract handles all token swaps, or “trades.”
To increase token liquidity, blockchain developers can join their ERC20 token to Uniswap. In this article, Fang Gong of Ocean Protocol has compiled a step by step guide in order to help the dev community contribute and learn.
Moving ahead, our next example is XinFin.
XinFin is a hybrid blockchain platform that aims to revolutionise the global trade and finance ecosystem by delivering a decentralised infrastructure solution that is accessible, efficient, and highly adaptable. What exactly does being hybrid mean?
For practically every application, XinFin’s hybrid architecture allows it to handle public, private, and consortium chains. XinFin has already been utilised for remittance and peer-to-peer trading platforms, blockchain-powered insurance, online digital asset-linked identities, end-to-end land registry record management, and other applications, showcasing the platform’s adaptability.
More than 100 institutions and individuals run validator nodes as of May 2021. Since its initiation, XinFin has launched its public net (mainnet), extended its partner and product ecosystem, and released its first stablecoins (SGDg and EURg). There are plans to build relationships with digital asset custodians, integrate R3 Cordite, and add multi-sig features to the platform over the rest of 2021.
And now, our final case is of Elrond.
Elrond is a software program that intends to incentivize a distributed network of computers to run a smart contract platform that aims to prioritize scalability and low transaction fees.
“The next Amazon and Google are perhaps one smart contract away. Platforms such as MyWish will allow everyone to have an equal opportunity in the new economy and deploy the next massive innovation on top of the Elrond Network,” said Beniamin Mincu, Elrond Network CEO.
Elrond is built to compete with major blockchains, with the goal of creating a decentralised application and cryptocurrency ecosystem.
To do so, Elrond employs two unique distinguishing features:
Adaptive State Sharding: The process of splitting the Elrond infrastructure to support additional transactions and programmes. Adaptive State Sharding is Elrond’s transaction processing mechanism, in which nodes are partitioned into subsets to validate transactions. The shards broadcast the transactions to the meta chain (Elrond’s central blockchain), where they will be finalised.
SPoS (Secure Proof-of-Stake) — The consensus mechanism that connects different network components to a single ledger. The Secure Proof of Stake (SPoS) governance system is at the heart of Elrond. It is a Proof of Stake governance method that maintains the dispersed network of computers running its blockchain in sync.
SPoS, like normal PoS, is used to protect the network, validate transactions, and distribute freshly minted EGLD coins by computers running the Elrond software.
But how does it work, though?
Elrond network is pretty similar to other cryptocurrencies in terms of it offering transaction settlements, smart contracts, and token insurance.
With the use of multiple VM engines, Elrond is extremely developer friendly. To offer a variety of products and services, developers can use programming languages (such as Rust, C, and C++) to run bespoke programming logic (smart contracts) and construct new programmes (decentralised applications), enabling testing and deployment in mere minutes.
If you can apply, you’ve learnt it
With the help of these three case studies, it’s quite evident that smart contracts are rapidly becoming extremely important in the world of blockchain and cryptocurrency. With individuals, companies and even governments embracing the technology, they’re fast optimising many financial and business processes.
Companies are also making it easier for the curious to learn and develop smart contracts, hence aiding the growth of this technology for faster innovation. So, this is the perfect time to be deep diving into this new field, and we’re here to guide you through this journey.
Further Readings:
https://leewayhertz.medium.com/how-to-create-and-deploy-xinfin-smart-contracts-90de946fb6e8
https://dzone.com/articles/xinfin-remix-develop-smart-contracts-for-the-xinfi
https://howto.xinfin.org/get-started/smartcont/