Algorand’s “Layer-1 policy” can surpass state-of-the-art Blockchain solutions

First generation Blockchain solutions handled a reliable quasi-anonymous payment service between two network IDs. After that, the next evolutionary step was the definition of smart contracts: adding a programmable engine (a general-purpose Virtual Machine) to the Blockchain node enabled offering 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 by 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.

But this two-layered approach carries problems as well as solutions.

Indeed, 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 left in the code. And, 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 the ones implemented by Layer-1.

Algorand’s decision of implementing 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.

Algorand’s strategy underpinning the new release (Algorand 2.0) is based on three Layer-1 implementations:

  • Algorand Standard Assets (ASAs)
  • Atomic Transactions (ATs)
  • Algorand’s Smart Contracts (ASC1s)

Algorand Standard Assets (ASAs) enable the tokenization and issuance of any type of asset on the Algorand Blockchain, in a standardized way. Following types of behaviour are supported:

  • fungible assets: currencies, stablecoins, and utility tokens
  • non-fungible assets: a digital collectible, a concert ticket, a single piece of jewelry (also called 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. Trade process for fungible assets is as simple as updating balances, but complexity rises when non-fungible assets come into play. Also, assets can be restricted to a single person or can be made available “to bearer”: Algorand supports all the four combinations, alongside the Algo, the standard unit of accounting on the Algorand Blockchain.

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:

  • operate 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. After all assets have been deposited, they are returned to their new owners and the transaction is settled. if some parties defaulted on their obligations, the transaction is declared null and void and all the assets are returned to their original owners.

Atomic transfers are somewhat 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 the problems in testing the contract structure (try 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. They 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 is going to fail if any of the component transactions will fail) the node submits them all at the same instant.

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 enforce transaction rules (the logic governing the transfer of the assets) for custom use-cases. As discussed above, coding a smart contract is rather easy but its testing and security proofing are not.

Template-driven development activity facilitates code reusability and lowers cost and risk in the process of testing and proofing smart contracts. Programmers can focus on application-relevant facts as the templates will simplify greatly the coding effort. Among everyday scenarios already supported by ASC1 templates, we find common business schemes like:

  • delegate one’s signature authority to some other (proxy authority)
  • compiling and signing a contract for some others to submit on your behalf (delegation)
  • set up 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 (crowfunding)

The template-driven development environment supports four high-level languages: GO, Java, JavaScript and Python.

Besides these, it’s available for developers the original implementation language of the Transaction Execution Approval Language (TEAL).

Algorand’s TEAL is the scripting language used for programming Algorand Smart Contracts. It marks a radical departure from the general-purpose Virtual Machines powering traditional Blockchain solutions: there is no guarantee that a program running on a general-purpose Virtual Machine will ever stop.

TEAL 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 always 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 contracts development.

Developers are going to appreciate Algorand’s effort in making available the latest developments in Blockchain technology. And they can develop their solutions 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 be easily configured and operated for protected developing environments.

We help tech communities to grow worldwide, providing top-notch tools and unparalleled networking opportunities.