LogoLogo
WebsiteSubstrate Block ExplorerEVM Block ExplorerFaucet
  • Learn
    • Architecture
    • Staking
      • Proof of stake
    • Smart Contracts
    • Accounts
    • Infrastructure
      • Nodes
      • Agents
      • Models
      • IPFS
    • Security
      • OPOC
      • TSS
      • IPFS Integrity
      • Model Updates Integrity
    • Fees
    • Finney Testnet RPC Endpoints
  • Build
    • Address format
    • ink! Environment
    • Wasm Smart Contracts
      • Smart Contract Stack
      • Domain-Specific Languages (DSLs)
      • ink! Development
      • ask! Development
      • Basic ink! Contract
    • EVM Smart Contracts
      • Introduction to EVM Smart Contracts
      • HardHat
      • Your first EVM Smart Contract
      • Debug EVM Transactions
      • Precompiles
        • SR25519
        • Substrate ECDSA
        • XC20
    • Run a node
      • Run an archive node
        • Binary
      • Run a full node
      • Become a validator
        • Learn about Validators
        • Validator requirements
        • Spin up a validator
        • Set your identity
    • Build an Agent
      • Introduction
      • Development
      • Installing WASP
      • Agents API Reference
      • Available AI Models
Powered by GitBook
On this page
  • Ethereum Native Precompiles
  • Uomi Specific Precompiles
  • Usage example
Export as PDF
  1. Build
  2. EVM Smart Contracts

Precompiles

PreviousDebug EVM TransactionsNextSR25519

Last updated 9 months ago

A precompile is a common functionality used in smart contracts that has been compiled in advance, so Ethereum nodes can run it more efficiently. From a contract's perspective, this is a single command like an opcode. The Frontier EVM used on Uomi network provides several useful precompiled contracts. These contracts are implemented in our ecosystem as a native implementation. The precompiled contracts 0x01 through 0x08 are the same as those in Ethereum (see list below). Additionally, Uomi implements precompiled contracts that support new Uomi features.

Ethereum Native Precompiles

Precompile
Address

ECRecover

0x0000000000000000000000000000000000000001

Sha256

0x0000000000000000000000000000000000000002

Ripemd160

0x0000000000000000000000000000000000000003

Identity

0x0000000000000000000000000000000000000004

Modexp

0x0000000000000000000000000000000000000005

Bn128Add

0x0000000000000000000000000000000000000006

Bn128Mul

0x0000000000000000000000000000000000000007

Bn128Pairing

0x0000000000000000000000000000000000000008

Uomi Specific Precompiles

Precompile
Address

Sr25519

0x0000000000000000000000000000000000005002

SubstrateECDSA

0x0000000000000000000000000000000000005003

Assets-erc20

ASSET_PRECOMPILE_ADDRESS_PREFIX

UomiEngine

0x00000000000000000000000000000000756f6D69

The interface descriptions for these precompiles can be found in the precompiles folder: . The Addresses can be checked in the for each runtime in precompile.rs files.


Usage example

Here we'll demonstrate a simple smart contract that can interact with Sr25519 precompile

// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;

contract Sr25519Caller {
    address constant precompileAddress = 0x0000000000000000000000000000000000005002;

    function verify(bytes32 publicKey, bytes memory signature, bytes memory message) public view returns (bool) {
        (bool success, bytes memory result) = precompileAddress.staticcall(
            abi.encodeWithSignature("verify(bytes32,bytes,bytes)", publicKey, signature, message)
        );
        require(success, "Failed to call precompile");
        return abi.decode(result, (bool));
    }
}
Uomi repo
Uomi repo