A Proposal for the Algorand Virtual Machine: Smart Contracts in Layer-0

Thank you so much for your interest and for your question.

Currently, Algorand is not a smart contract platform. It’s actually a payment platform with some scripting capabilities added to it. TEAL is limited. It doesn’t even support loops. To add more smart contract capabilities Algorand is going to use a Two-Tier Architecture (as much as I know):

https://www.algorand.com/resources/blog/algorand-smart-contract-architecture

In this approach, smart contracts that can not be implemented with TEAL must go into layer-2, which essentially means they have to be “off-chain”. In other words, they will be run on another chain which is secured by a different validator set, called smart contract execution committee. Each validator on that committee executes the contract call and generates a sequence of effects which is the sequence of transactions generated by the contract call. these “effects” then will be applied to the main chain.

To be honest, I really do not like this design. Layer-2 contracts have an ambiguous level of security and writing them will not be easy. When you are writing an off-chain smart contract, You have to be speculative about what’s going on in the main chain. You can not be sure about account balances, the time your transactions will be applied and etc. In my opinion, this design has almost no benefits.

Recently, I’ve been thinking about this subject. Maybe I’m wrong, but I think we could have efficient general purpose smart contracts right in layer-0! I call it layer-0 because in this approach everything will be run on a VM. Even transferring ALGOs can be implemented by a smart contract running on this VM. Actually that way, things also could be implemented much more efficiently. This is possible with the help of ZK-EDBs which is actually an invention of Silvio Micali himself. Having a VM also has several other benefits: writing compilers is easier, the design of our platform will be similar to a normal computer and we can borrow technologies from other areas, transfer logic of assets including ALGO will be more transparent, and so on.