Developers
EVM Precompiles
Solidity Precompiles

Overview of the Precompiled Contracts on Tangle

Overview

On Tangle Network, a precompiled contract is native Substrate code that has an Ethereum-style address and can be called using the Ethereum API, like any other smart contract. The precompiles allow you to call the Substrate runtime directly which is not normally accessible from the Ethereum side of Tangle.

The Substrate code responsible for implementing precompiles can be found in the EVM pallet. The EVM pallet includes the standard precompiles found on Ethereum and some additional precompiles that are not specific to Ethereum (opens in a new tab). It also provides the ability to create and execute custom precompiles through the generic Precompiles trait (opens in a new tab). There are several custom Tangle-specific precompiles that have been created.

The Ethereum precompiled contracts contain complex functionality that is computationally intensive, such as hashing and encryption. The custom precompiled contracts on Tangle provide access to Substrate-based functionality such as staking, governance, and more.

The Tangle-specific precompiles can be interacted with through familiar and easy-to-use Solidity interfaces using the Ethereum API, which are ultimately used to interact with the underlying Substrate interface. This flow is depicted in the following diagram:

Precompiled Contract Addresses

The precompiled contracts are categorized by address and based on the origin network. If you were to convert the precompiled addresses to decimal format, and break them into categories by numeric value, the categories are as follows:

Ethereum Precompiles

PrecompileDescriptionAddress
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

Non Tangle Specific Nor Ethereum Precompiles

PrecompileDescriptionAddress
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
Curve25519AddAdds two Curve25519 points.0x0000000000000000000000000000000000000403
Curve25519ScalarMulMultiplies a Curve25519 point by a scalar.0x0000000000000000000000000000000000000404
Ed25519VerifyVerifies an Ed25519 signature.0x0000000000000000000000000000000000000405

Tangle Specific Precompiles

PrecompileDescriptionAddress
StakingHandles staking-related operations.0x0000000000000000000000000000000000000800
VestingManages vesting schedules.0x0000000000000000000000000000000000000801
Erc-20 BalancesTreats TNT as a native ERC20 token on the EVM side of Tangle.0x0000000000000000000000000000000000000802
DemocracyInterfaceAn interface for interacting with on-chain governance.0x0000000000000000000000000000000000000803
BatchAllows for multiple calls to be made within a single transaction.0x0000000000000000000000000000000000000804
Call PermitFacilitates authorized calls (for gasless transactions).0x0000000000000000000000000000000000000805
PreimageUsed for managing preimages, which are proposals before they become public.0x0000000000000000000000000000000000000806
Precompile-RegistryManages the registration of new precompiles.0x0000000000000000000000000000000000000807
Ecdsa-Secp256k1Verifies ECDSA signatures using the secp256k1 curve.0x0000000000000000000000000000000000000816
Ecdsa-Secp256r1Verifies ECDSA signatures using the secp256r1 curve.0x0000000000000000000000000000000000000817
Ecdsa-StarkVerifies ECDSA signatures using the Stark curve.0x0000000000000000000000000000000000000818
Schnorr-Sr25519Verifies Schnorr signatures using the Sr25519 curve.0x0000000000000000000000000000000000000819
Schnorr-Secp256k1Verifies Schnorr signatures using the secp256k1 curve.0x000000000000000000000000000000000000081a
Schnorr-Ed25519Verifies Schnorr signatures using the Ed25519 curve.0x000000000000000000000000000000000000081b
Schnorr-Ed448Verifies Schnorr signatures using the Ed448 curve.0x000000000000000000000000000000000000081c
Schnorr-P256Verifies Schnorr signatures using the P256 curve.0x000000000000000000000000000000000000081d
Schnorr-P384Verifies Schnorr signatures using the P384 curve.0x000000000000000000000000000000000000081e
Schnorr-Ristretto255Verifies Schnorr signatures using the Ristretto255 curve.0x000000000000000000000000000000000000081f
Schnorr-TaprootVerifies Schnorr signatures using the Taproot Scheme.0x0000000000000000000000000000000000000820
Bls12-381Performs operations on the BLS12-381 curve.0x0000000000000000000000000000000000000821
MultiAsset DelegationProvides functions for managing multi-asset delegation pallet.0x0000000000000000000000000000000000000822
Services PalletProvides functions for managing services pallet.0x0000000000000000000000000000000000000823
Liqued StakingProvides functions for managing liquid staking pallet.0x0000000000000000000000000000000000000824