Algorand (ALGO) Smart Contracts Protocol

139

Blockchains are able to be programmed with the help of smart contracts. The transaction of assets procedures is clearly defined by smart contracts. Take, for instance, user 1 wants to purchase tokens that are issued by user 2, user 1 then transfers coins to the smart contract of user 2. The coins are been counted by the contract’s code to confirm that user 1 is among the qualified investors on the database of the contract. The correct number of the tokens are then transferred into the account of user 1.

The transactions are transparent, the contract code can be supervised by user 1, and the codes operate without the participation of user 2. There are actually different types of tools that are involved with the protocol of Algorand Smart contracts and several problems would be solved by the users of Algorand.

Algorand Two-Tier Architecture

To meet the everyday need of its users, Algorand has layer 1 smart contracts which are a very secure way for engaging in everyday transactions. Algorand also has layer 2 off-chain contracts which are for the long tail of smart contracts that needs customization than layer 1. These are the smart contracts that have been introduced in the Algorand’s blog.

Difference Between Algorand Smart Contracts and Ethereum Smart Contracts

The power of smart contracts was first introduced by the Ethereum blockchain, therefore the base point for the analysis of success in smart contracts technologies is the Ethereum smart contracts. The advantages and the disadvantages have widely been discussed by the blockchain community, different new designs for smart contracts languages have been triggered by these discussions. But two major issues of importance to the Algorand blockchain are:

1. Complex and fragile solutions are often needed for Simple problems

Like the instance made in the first paragraph, assuming both users agree that user 1 transfers 100 dollar coins to user 2, user 2 will then send 100 tokens to user 1. In order for user 1 to be certain that the coins were transferred, user 1 receives the token and in the same vein, user 2 requires the same assurance.

Transactions like these that are carried out between two parties without trust are usually called atomic swap, it is either both transactions happen or both do not happen. A hashed timelock contract is usually required for the programming of an atomic swap with Ethereum smart contracts. It is like a fragile timed, multi-phase protocol that makes any programming error become disastrous. A simple and safer solution for atomic swaps and related issues is now been provided by Algorand smart contracts.

2. Everyone must wait for everyone else

Just like an archaic burger shop where all the burgers available are been displayed by the counter and a storekeeper attends to customers on a queue, the customer at the head of the queue gets the opportunity of having the best burger available in the counter and every other person has to settle for what is left. In the same way, every execution of Ethereum smart contracts interrupts the process of the entire blockchain.

Worse is, every miner is mandated to re-execute each contract call and every contract call that happened in the past must be re-executed by any new miners. This makes Ethereum architecture to be a scalability hazard which limits the speed at which new blocks can be created.

Algorand off-chain contract operates more like a modern burger shop where customers can make their selections without consulting a storekeeper. Another customer’s choice would not delay the purchase of other customers or alter the choices of the rest customers. Also, payment can be made simultaneously. This increases the scalability of Algorand smart contracts and makes it easier for new blocks to be produced.

Algorand’s Instant Transaction Finality

Just like Bitcoin proof of work protocols where users are to solve crypto puzzles, the probability of two or more customers solving a valid block at the same time is high. When this happens and two nodes received a valid block at the same time, the blockchain is forked into two due to the fact that different groups of users may receive different candidates for the upcoming block.

A fork may go on for some time and the branches may also spread by the addition of new blocks. In the end, all branches apart from the longest branch will die and the blocks present in the dead branches would disappear.

All transactions that were present on the dead branches are seen to be invalid and they never happened. Also, there could be an occurrence of an adversary that would partition the network and convince different groups of users to take various blocks that are of the same height in the blockchain. With this, contradictory transactions are then accepted by various users which then results in a fork in the chain. This enables double spending of money.

Forks bring delays and uncertainty. In the process of forking, when a payment is been made to a user and appears in the recent block that was added to the chain, the user cannot confirm payment immediately. This is a result of a branch probably overcoming the current chain and the user’s block may end up in a dead branch and become invalid.

There is never forking in the Algorand’s blockchain. There is no way two blocks can be added to the chain at the same time due to the fact that there is only one block that can have the needed threshold of votes of the committee. When there is a decision made on a block by a consensus protocol, the decision can never be changed.

Therefore, all transactions are final in Algorand. Immediately a block appears, users can be confident that the block can never disappear and it would forever be part of the chain. In the case of a network partition, the adversary can never convince two honest users to take two different blocks for a single round. This promotes the instant finality of transactions on Algorand.

Also Read: All About Central Bank Digital Currency (CBDC)