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
  1. Precompiled contracts

Types of pre-compiled contracts

How AppLayer differentiates precompiled contracts.

AppLayer frequently references precompiled contracts in three ways: 1st-party, 3rd-party, and AppChains/AppLayers.

1st-party contracts are contracts provided by AppLayer itself as ready-to-use templates in the src/contract/templates subfolder (e.g. ERC20, ERC721, etc.), officially supported and leveraging all the features of the blockchain. Those contracts are also available in the AppLayer EVM chain.

3rd-party contracts act like a "slim Layer 2", in the sense that they are only processed, but have no concepts of consensus, blocks, transactions, etc. like a normal contract would. They essentially act like a "daemon" of sorts, running atop the main chain (just like a Layer 2), reading transactions made on it and reacting accordingly if said transaction happens to call it. The transaction is executed and the contract publishes the results back on the main chain (e.g. a user sent tokens to a 3rd-party exchange contract, once the transaction is confirmed on the main chain the contract will read the data field and execute its own logic, then send the exchanged tokens back on the main chain as its own transaction).

AppChains/AppLayers act as a "full Layer 2" instead, having their own blocks, transactions, consensus, etc., but still depending on the main chain to execute their separate logic.

PreviousPrecompiled contractsNextDynamic and Protocol Contracts

Last updated 12 months ago