Scuti Chapter 1 - Smart Contracts Algorand. Ethereum. cardano.

unsplash-image-mf-o1E7omzk.jpg

Overview 

Blockchains are a list of records that use cryptography to link back to each previous record and contain transactional data. It is an innovative solution that is resistant to change and acts as a secure record of transactions. Currently, blockchains are mostly used in the fintech industry where its largest use case is for cross-border payments and settlements. Blockchains were initially viewed as tools to store an immutable list of monetary transactions between different people. However, as with more research put into blockchains, its use cases can not only handle the transfer of currency but also handle other types of exchanges.  




A brilliant discovery that came from blockchains is smart contracts. Smart contracts allow us to use blockchains for doing more than simply storing transactions, they allow the creation of advanced applications. One popular use case for smart contracts is for contract life cycle management using predefined logic. When drafting up a contract there may be a need to involve third parties such as lawyers and if there’s money involved, escrow accounts may be introduced. However, with smart contracts compliance is enforced using blockchain technology making it a much simpler process and also reduces the cost.  




Smart contracts in-depth: 

Smart Contracts are pieces of code that live on the blockchain, it really is that simple. They consist of data (state) and code (logic) conditions that get executed to streamline complex processes that involve multiple intermediaries. The contract code is stored on, and distributed across, a decentralized blockchain network, making it transparent and irreversible. Smart contracts also serve as a way to enforce agreements between untrusted parties without the involvement of any third parties. They are not controlled by anyone but rather interacted with using blockchain transactions to execute predefined smart contract functions.

Screen Shot 2021-10-05 at 8.19.12 PM.png

Blockchain smart contracts differ in ways such as the programming languages that are used to create the smart contracts as well as the networks the smart contracts run on (this plays a role in the price paid when interacting with the smart contracts). The most popular blockchain for smart contract development is the Ethereum blockchain. Algorand and Cardano are examples of two other blockchains with smart contract capabilities. [possibly add a better transition/setup for talking about the differences] 


Consensus Mechanisms 

Consensus mechanisms allow the networks to verify everything that happens on the blockchain such as transactions or balances. Ethereum currently uses a Proof-of-Work (PoW) mechanism which is explained here on Ethereum’s website. PoW is one of Ethereum’s weaknesses because it causes longer transaction times and higher gas prices (Ethereum’s transaction fees). To solve this problem, Ethereum plans to switch to Proof-of-Stake by the end of 2021. Algorand and Cardano on the other hand use Proof-of-Stake (PoS) consensus which means that “Each user’s influence on the choice of a new block is proportional to its stake (number of tokens) in the system”. PoS allows the Algorand and Cardano blockchains to approve transactions at a significantly faster rate with much lower fees than Ethereum. 




Language Differences 

Algorand, Cardano and Ethereum smart contracts are written in different languages. Cardano smart contracts are written in Plutus, a language based on Haskell. Cardano also provides us with Plutus playground, a lightweight web-based environment for Plutus development. Algorand smart contracts are written in a bytecode-based stack language called TEAL but they also provide Software Development Kits (SDKs) for Python, JavaScript, Java and Go. These SDKs allow for development in a different language that is then compiled into TEAL before it is run. Algorand smart contracts are split into 2 categories as well, stateless and stateful smart contracts. Stateless smart contracts are used to approve or deny transactions and are evaluated at the time a transaction is submitted. Stateful contracts means that some amount of storage on the chain is used to store values. Ethereum has a few smart contract development languages with Solidity being the most popular. Solidity is an object-oriented programming language that is statically typed. Solidity supports inheritance, libraries and complex user-defined types. Solidity also has an online IDE called remix to help with smart contract development. 




Networks 

Both Algorand and Ethereum offer Test Networks separate from the Main Networks where developers can test smart contracts before deploying to the Main Network. The most convenient way to develop on Algorand is to use a Docker Sandbox which can only be run on Mac or Linux. The Docker Sandbox allows you to run a node locally so that you can test efficiently. Ethereum being one of the largest blockchains in the world, offers many more Test Networks than Algorand. The easiest way to develop in Solidity is by using Remix. Remix is a browser-based IDE that allows development, deployment and testing for Ethereum smart contracts and is the most beginner friendly. To develop locally, running your own local node is simple. Tools such as the Ganache application allow you to run a local node to run tests and execute commands.

Screen Shot 2021-10-05 at 8.16.48 PM.png

Blockchains have come a long way since first introduced, the addition of smart contract capabilities to blockchains allows us to tackle problems that require trust, transparency and security. With multiple blockchains that support smart contracts, factors such as the consensus mechanism, block time, transaction fees, language capabilities are factors we need to take into account when choosing the right blockchain to develop smart contracts.

Previous
Previous

Syndrome Anomaly Detection Chapter 2 - NLP Protects Patient Privacy

Next
Next

Quantum Payment Optimization Chapter 1 - Let The Cat Out of the Bag (Leaving It in at the Same Time)