Bittensor EVM: Examples and Precompiles
Available Precompiles
The following precompiled smart contracts are available on the Bittensor EVM. The source code can be found on GitHub.
Code examples used throughout this section are provided by the Opentensor Foundation (OTF), and come from this repository.
Examples
- Convert Ethereum (H160) Address to Substrate (SS58): Learn how to convert between H160 and SS58 address formats
Standard Ethereum Precompiles
ECRecover
(0x1): Recover the address associated with the public key from elliptic curve signatureSha256
(0x2): SHA-256 hash functionRipemd160
(0x3): RIPEMD-160 hash functionIdentity
(0x4): Identity function (returns input data)Modexp
(0x5): Modular exponentiationSha3FIPS256
(0x400): SHA3-256 hash function (FIPS variant)ECRecoverPublicKey
(0x401): Recover the public key from an elliptic curve signature
Bittensor-Specific Precompiles
The following list consists of Bittensor-specific precompiles with links to their respective documentation:
Ed25519Verify
: Verify Ed25519 signaturesBalanceTransfer
: Transfer TAO between accountsStakingPrecompile
: Manage staking operationsStakingPrecompileV2
(0x805): Main staking operations including:addStake
: Add stake to a hotkeyremoveStake
: Remove stake from a hotkeymoveStake
: Move stake between hotkeystransferStake
: Transfer stake between coldkeysgetTotalColdkeyStake
: Get total stake for a coldkeygetTotalHotkeyStake
: Get total stake for a hotkeygetStake
: Get stake between specific hotkey and coldkeyaddProxy
: Add a proxy delegateremoveProxy
: Remove a proxy delegate
SubnetPrecompile
: Manage subnet operationsMetagraphPrecompile
: Interact with the metagraphNeuronPrecompile
: Manage neuron operations