AppLayer
  • Welcome to AppLayer Docs
  • Introducing AppLayer
    • A Primer on Smart Contracts
    • The Problem With EVMs
    • What is AppLayer?
  • How AppLayer works
    • Validators
    • Sentinels
    • Application Chains
    • Bridging
      • AppLayer-to-AppLayer Data Bridging
      • AppLayer-to-AppLayer Token Bridging
      • AppLayer-to-External Bridging (Ethereum, Solana, etc.)
  • Understanding rdPoS
    • Blockchains overview
    • How rdPoS works
    • Validator implementations
    • Slashing
  • BDK implementation
    • The utils folder
    • The contract folder
    • The core folder
    • Transactions and Blocks
    • Database
    • Contract call handling
    • RLP (Recursive-Length Prefix)
    • P2P Overview
    • P2P Encoding
  • Understanding contracts
    • Solidity ABI
    • Internal and external contract calls
    • Setting up the development environment
    • Contract Tester
  • Precompiled contracts
    • Types of pre-compiled contracts
    • Dynamic and Protocol Contracts
    • SafeVariables and commit/revert logic
    • How to code a precompiled contract
    • Creating a Dynamic Contract (Simple)
      • Simple Contract Header
      • Simple Contract Source
      • Deploying and testing
    • Creating a Dynamic Contract (Advanced)
    • Creating a Protocol Contract (Advanced)
  • EVM contracts
    • State management and VM instance creation
    • Seamless C++/EVM integration
    • C++ to other contract calls
    • EVM to other contract calls
    • Executing contract calls via EVMC
    • Calling EVM contracts from C++
    • Calling C++ contracts from EVM
  • Getting started with AppLayer Testnet
  • Join our Community
  • Get in Touch
  • Glossary
Powered by GitBook
On this page
  • Limitations of the EVM
  • The solution
  • The caveats (and how we're solving them)
  1. Introducing AppLayer

The Problem With EVMs

The hydra we're trying to slay

PreviousA Primer on Smart ContractsNextWhat is AppLayer?

Last updated 1 year ago

Chains with virtual machines share the same problem: contracts built on top of them often have limited speed and flexibility due to the nature of the virtual machines themselves, as they're built to be "generic computers with limited throughput".

This is common on Ethereum and other EVM-based chains - having to share a "generic computer" with the whole world is inefficient by design. Forcing a chain to be both generic and decentralized at the same time puts heavy limits on which types of applications you can decentralize and how much you can decentralize them.

Limitations of the EVM

For example, in the case of the Ethereum Virtual Machine, you can not do any of the following:

  • Loop a function more than 50 times due to block gas limit constraints;

  • Have a stack size larger than 16 variables due to constraints on the EVM itself;

  • Parallelize multiple contract calls (as in, every time a new block has multiple transactions that interact with multiple different contracts, you have to load the contract, parse and save changes to the database for each single one of these contracts, in order).

As quoted by : "The biggest problem is that everyone is sharing the same computer, and that computer is a Commodore 64".

The solution

If the problem is inherently tied to the EVM, then... why don't we just get rid of it? This seems like a reasonable solution, but it can't be the only one either.

The current blockchain landscape is primarily dominated by the Solidity EVM, and for many Web3 companies it is unrealistic to completely remove it from existing applications. However, to properly scale a Web3 based application, we must venture outside the virtual machine.

Our solution is a hybrid of old and new: a modular blockchain that not only allows for natively-coded contracts, but also a natively-coded, performance-centric EVM with stateful pre-compiles. In other words, a blockchain that doesn't need a virtual machine to run smart contracts, but still has support for existing contracts to be deployed as-is.

Having an EVM running in parallel of stateful pre-compiles unlocks performance optimizations to existing Solidity contracts and accelerates them with pre-compiled functions within the state, programmed in common performance-driven development languages, such as C++, C#, Rust, and more.

The caveats (and how we're solving them)

There’s a tremendous advantage to using native stateful pre-compiles, however, this approach also comes with its own set of problems:

  • It can be tricky to push new smart contract code into the network as a pre-compile. If you want to add or remove logic from your contract in the network, you have to force a mandatory update to all node operators - this could take days, which is a pretty big deal depending on how mission-critical the update is

  • An application-specific pre-compiled contract might be too expensive to be natively executed on 1st party validation

  • If the pre-compile is not hard-coded into the network and validated from a 3rd party, it must be ensured that this communication remains secure

What if there was a blockchain system that incorporated stateful pre-compiles, allowing third parties to deploy and natively support these contracts within a single network that shares its state?

This is exactly what AppLayer does. AppLayer is a modular blockchain of multiple layers, including an EVM, stateful pre-compiles, and chain abstraction.

Itamar