Skip to content

Latest commit

 

History

History
62 lines (49 loc) · 6.1 KB

File metadata and controls

62 lines (49 loc) · 6.1 KB
title Bittensor EVM: Examples and Precompiles
description The precompiled contracts available on the Bittensor EVM and worked examples covering address conversion, token transfers, staking and signature verification.

import { InstallPartial } from "./_install.mdx";

Available Precompiles

The following precompiled smart contracts are available on the Bittensor EVM. The source code can be found on GitHub.

Examples

The tutorials in this section cover common EVM workflows on Bittensor, including account management, token bridging, and interaction with precompiles:

Standard Ethereum Precompiles

The following table consists of standard Ethereum precompiles with their addresses and description:

Precompile Address Description
ECRecover 0x1 Recover the address associated with the public key from elliptic curve signature (ECDSA)
Sha256 0x2 SHA-256 hash function
Ripemd160 0x3 RIPEMD-160 hash function
Identity 0x4 Identity function (returns input data)
Modexp 0x5 Modular exponentiation
Dispatch 0x6 Dispatch a runtime call from EVM
Bn128Mul 0x7 BN128 scalar multiplication
Bn128Pairing 0x8 BN128 pairing check
Bn128Add 0x9 BN128 point addition
Sha3FIPS256 0x400 SHA3-256 hash function (FIPS variant)
ECRecoverPublicKey 0x401 Recover public key from an elliptic curve signature (ECDSA)

Bittensor-Specific Precompiles

The following table lists of Bittensor-specific precompiles with their addresses, descriptions and links to their respective documentation:

Precompile Address Description
Ed25519Verify 0x402 Verify Ed25519 signatures. See Ed25519 Verify.
SR25519Verify 0x403 Verify Substrate SR25519 signatures.
BalanceTransferPrecompile 0x800 Transfer TAO between H160 addresses. see Transfer TAO.
StakingPrecompile 0x801 Staking via msg.valuedeprecated, use V2. See Staking Precompile.
MetagraphPrecompile 0x802 Interact with the metagraph (rank, trust, stake, axon). See Metagraph Precompile.
SubnetPrecompile 0x803 Register subnets, get/set hyperparameters . See Subnet Precompile.
NeuronPrecompile 0x804 Register neurons, set weights, serve axon. See Neuron Precompile.
StakingPrecompileV2 0x805 Full staking with limits, allowances, moves . See StakingPrecompileV2.
UidLookupPrecompile 0x806 Map EVM address → registered neuron UID. See UidLookupPrecompile.
StorageQueryPrecompile 0x807 Manages EVM contracts read access to Substrate chain storage. See StorageQueryPrecompile.
AlphaPrecompile 0x808 AMM pool state, prices, swap simulation. See AlphaPrecompile.
CrowdloanPrecompile 0x809 Create and manage crowdloan campaigns. See CrowdloanPrecompile.
LeasingPrecompile 0x80A Create subnet lease crowdloans, terminate leases. See LeasingPrecompile.
ProxyPrecompile 0x80B Add/remove/execute Substrate proxy relationships. See ProxyPrecompile.
AddressMappingPrecompile 0x80C Convert H160 → Substrate AccountId32. See AddressMappingPrecompile.
VotingPowerPrecompile 0x80D Query per-validator EMA voting power. See VotingPowerPrecompile.