First generation Blockchain solutions handled a reliable quasi-anonymous payment service between two network IDs. The next evolutionary step was the definition of smart contracts: adding a programmable engine (a general-purpose Virtual Machine) to the Blockchain node enabled a lot of innovative services (like digital currency trading), and an easier way of coding some high-level housekeeping functions.
In the end, most state-of-the-art Blockchain solutions are now composed of a first layer, implementing basic payment functions, and by a general-purpose Virtual Machine as a second layer for running the smart-contract software, i.e. all value-added applications.
However, this two-layered approach creates problems as well as solutions.
The Virtual Machine used to run smart contracts must be painstakingly defined in all its features, implemented and security-proofed in order to guarantee that there are no weak points remaining in the code. While a similar process must be used in developing smart contract based software, the end result is that all the functions implemented by Layer-2 will be inherently slower and less secure than those implemented by Layer-1.
Algorand‘s decision to implement a rich set of services at Layer-1 avoids the complexities, expense, and security risks of a two-layer architecture, and guarantees that second-generation services will share the same security, efficiency, and atomicity of a single-payment transaction.
The strategy underpinning Algorand’s new release (Algorand 2.0) is based on three Layer-1 implementations:
- Algorand Standard Assets (ASAs)
- Atomic Transactions (ATs)
- Algorand’s Smart Contracts (ASC1s)
Feature # 1: Algorand Standard Assets (ASAs)
Algorand Standard Assets (ASAs) enable the tokenisation and issuance of any type of asset on the Algorand Blockchain, in a standardized manner. The following behaviours are supported:
- fungible assets: currencies, stablecoins, and utility tokens
- non-fungible assets: a digital collectible, a concert ticket, a single piece of jewelry (also known as ERC-721 tokens on the Ethereum Blockchain)
- restricted fungible assets: securities and security tokens
- restricted non-fungible assets: licenses and certifications
Fungibility is the ability of a good or asset to be exchanged with other individual goods or assets of the same type. The trade process for fungible assets is as simple as updating balances, but the complexity increases when non-fungible assets come into play. Assets can also be restricted to a single person or can be made available “to bearer”: Algorand supports all four combinations alongside the Algo, the standard unit of accounting on the Algorand Blockchain.
Feature #2 – Atomic Transfers (ATs)
Atomic Transfers (ATs) offer a fast, low cost, and secure way to simultaneously transfer a number of assets (fungible tokens) among multiple parties. This happens in day-to-day scenarios like:
- operating trades without trusted intermediaries (decentralized exchanges)
- group payments: either everyone pays or no one does
- payments to multiple recipients
In the traditional economy, settling happens by having all parties sign a contract and deposit their assets into an escrow account. Once all assets have been deposited, they are distributed to their new owners and the transaction is settled. if some parties default on their obligations, the transaction is declared null and void and all deposited assets are returned to their original owners.
Atomic transfers are to some degree an extension of the so-called ACID properties of transactions: Atomicity, Consistency, Isolation, Durability.
Previous implementations on the Blockchain required big coding efforts: programmers needed to add a deadline for each transfer to end (hashed time-lock) and to handle each and every case of default. Apart from problems in testing the contract structure (e.g., trying to validate a circular transaction), this technique impacted badly on the overall performance of the Blockchain and transactions couldn’t happen at the same instant.
The new implementation allows individual transactions to be prepared and saved into individual files. These are combined into a single file, and the signing phase begins: each transaction will be individually signed by the keys of the relevant parties. After all the transactions have been signed, the file is then submitted to the network and will end up on a node for processing. After verifying all the transactions (the group transaction will fail if any of the component transactions fail) the node submits all transactions at the same instant.
Feature #3 – Algorand Smart Contracts
Algorand Smart Contracts (ASC1) are stateless smart contracts that manage transactions (involving Algos or Algorand Standard Assets) at Layer-1 via simplified scripting templates.
From a software viewpoint, smart contracts are user-defined programs that can be run on the Blockchain nodes and which enforce transaction rules (the logic governing the transfer of assets) for custom use-cases. As discussed above, coding a smart contract is fairly easy but testing and security proofing it are not.
Template-driven development activity facilitates code reusability and lowers costs and risk in the process of testing and proofing smart contracts. Programmers can focus on application-relevant facts as the templates greatly simplify the coding effort. Among the everyday scenarios already supported by ASC1 templates, we find common business processes, such as:
- delegation of signature authority to another person (proxy authority)
- compiling and signing a contract for others to submit on your behalf (delegation)
- set up of an escrow-style account with additional logic governing when tokens or assets are removed from the escrow (settling)
- on signature, produce a new contract account with additional logic governing both funding and expenses (crowdfunding)
Besides these, the original implementation language of the Transaction Execution Approval Language (TEAL) is also available to developers.
Algorand’s TEAL is the scripting language used to program Algorand Smart Contracts. This marks a radical departure from the general-purpose Virtual Machines that power traditional Blockchain solutions: there is no guarantee that a program running on a general-purpose Virtual Machine will ever stop.
TEAL’s stack-based assembly language allows only forward branches thus preventing recursive logic: it belongs to the family of “non-Turing complete” languages.
All programs that can be written in a non-Turing complete language will stop after a finite number of steps – a useful feature for testing and proofing smart contracts.
TEAL supports access to all previously described Layer-1 functionalities, and will surely mark a huge improvement in smart contract development.
Developers will appreciate Algorand’s effort in making the latest developments in Blockchain technology available. Solutions can be developed in the environment of their choice: the MainNet (where Algo and real assets are traded), the TestNet (a sandbox where applications can be tested in realistic network conditions) and the BetaNet (where the newest features are made available before their effective release). Private networks can also easily be configured and operated to create protected developing environments.