Precompiles on Tangle Network

Introduction to Precompiles

On Tangle Network, a precompiled contract refers to native Substrate code that possesses an Ethereum-like address and can be engaged through the Ethereum API, as with any other smart contract. These precompiles enable you to directly interact with the Substrate runtime, a functionality that is usually inaccessible from the Ethereum aspect of Tangle Network.

The Substrate code that oversees the implementation of precompiles is located within the EVM pallet. This EVM pallet comprises the standard precompiles existing on Ethereum along with some other precompiles that aren't unique to Ethereum. It further offers the capacity to form and execute custom precompiles through the versatile Precompiles trait. A range of custom Tangle Network-specific precompiles have been developed and can be found within the Tangle Network codebase.

The Ethereum precompiled contracts encompass complex functions that require substantial computational resources, including hashing and encryption. On Tangle Network, the custom precompiled contracts allow access to Substrate-based features such as staking, governance, XCM-related operations, and more.

These Tangle Network-specific precompiles can be accessed through familiar and user-friendly Solidity interfaces utilizing the Ethereum API, which ultimately interact with the underlying Substrate interface.

Precompile Addresses

This page lists the existing precompiles used in Tangle Network, descriptions of their functions, and the contract addresses of the functionality.

Ethereum Precompiles

ECRECOVERRecovers the public key associated with the given signature, a critical operation in verifying wallet signatures.0x0000000000000000000000000000000000000001
SHA256Computes the SHA256 cryptographic hash function, widely used for data integrity verification.0x0000000000000000000000000000000000000002
RIPEMD160Calculates the RIPEMD-160 hash, which is used in various security applications and protocols.0x0000000000000000000000000000000000000003
IdentityA simple data copy operation.0x0000000000000000000000000000000000000004
Modular ExponentiationPerforms modular exponentiation, a key operation in many cryptographic functions.0x0000000000000000000000000000000000000005
BN128AddPerforms point addition on a BN128 elliptic curve.0x0000000000000000000000000000000000000006
BN128MulPerforms point multiplication on a BN128 elliptic curve.0x0000000000000000000000000000000000000007
BN128PairingChecks the pairing on a BN128 elliptic curve.0x0000000000000000000000000000000000000008
Blake2Computes the Blake2 cryptographic hash function.0x0000000000000000000000000000000000000009
SHA3FIPS256Computes the SHA3 (FIPS 202 compliant) hash function.0x0000000000000000000000000000000000000400
DispatchHandles dispatching and managing contract calls and interactions.0x0000000000000000000000000000000000000401
ECRecoverPublicKeyRecovers the public key from an elliptic curve signature.0x0000000000000000000000000000000000000402

EVM-to-Substrate Precompiles

DemocracyInterfaceAn interface for interacting with on-chain governance.0x0000000000000000000000000000000000000803
BatchAllows for multiple calls to be made within a single transaction.0x0000000000000000000000000000000000000808
CallPermitFacilitates authorized calls to certain functions.0x000000000000000000000000000000000000080a
PreimageUsed for managing preimages, which are proposals before they become public.0x0000000000000000000000000000000000000813
Precompile-RegistryManages the registration of new precompiles.0x0000000000000000000000000000000000000815
Pallet-stakingHandles staking-related operations.0x0000000000000000000000000000000000000800

Future Precompiles

The following are under consideration for inclusion, and are drawn from the open-source development done in the Substrate ecosystem.

CollectivePerforms democracy functions through any of the collectives on Moonbeam, such as the Treasury Council.TBD
Conviction VotingAllows voting on referenda, setting up voting delegations, and more.TBD
Native Token ERC-20Provides an ERC-20 representation of the native token on Moonbeam.TBD
ProxyAllows adding and removing proxy accounts from Substrate's Proxy Pallet.TBD
RandomnessProvides VRF randomness on Moonbeam.TBD
ReferendaAllows viewing and submitting proposals on-chain to be put forth for referenda.TBD
Staking FunctionsAllows developers to access staking features using the Ethereum API in a precompiled contract.TBD
X-TokensAllows sending XC-20s to other chains using the X-Tokens Pallet.TBD
XCM TransactorAllows performing remote XCM execution from Moonbeam to other chains in the ecosystem.TBD
XCM UtilitiesProvides various XCM related utility functions to smart contact developers.TBD
DappsStakingFunctions related to managing dApp staking.TBD
Sr25519Handles operations related to the Sr25519 signature scheme.TBD
SubstrateEcdsaManages operations related to the Substrate Ecdsa.TBD
XCMHandles cross-chain message (XCM) operations.TBD
XVMHandles operations related to the XVM.TBD
assets-erc20Manages ERC20 asset operations.TBD

Further resources

EVM Precompiles Repo See the repositories for these at the Parity Github. (opens in a new tab)