Bittensor EVM Smart Contracts
Full Ethereum virtual machine (EVM) compatibility is now available on subtensor (the blockchain in Bittensor). This allows users to deploy most EVM smart contracts on subtensor without changing the code, interact with deployed smart contracts on the subtensor blockchain, and access standard Ethereum JSON-RPC methods.
notes
note | description |
---|---|
EVM smart contracts execute on Bittensor, not Ethereum blockchain | Operations performed by subtensor EVM are executed solely on the subtensor blockchain, not on the Ethereum blockchain. |
1 TAO = 1e18 on subtensor EVM | While working with the subtensor EVM, 1 TAO should be written as 1 followed by 18 zeroes, i.e., 1e18. For example: const value = BigInt(0.5 * 1e18).toString(); . |
networks
You can deploy smart contracts on Bittensor main net (aka 'finney'), test network, or on your own locally deployed Bittensor chain.
Network details
MAINNET | TESTNET | LOCALNET | |
---|---|---|---|
RPC URL | https://lite.chain.opentensor.ai | https://test.chain.opentensor.ai | http://localhost:9944 |
Chain ID | 964 | 945 | see below |
Test TAO | None | Available on request | Use Alice account |
See section EVM Localnet with Metamask Wallet for setting up a Local net.
Available Precompiles
The following precompiles are available on the Bittensor EVM:
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
Ed25519Verify
- Verify Ed25519 signaturesBalanceTransfer
- Transfer TAO between accountsStakingPrecompile
StakingPrecompileV2
(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- UidLookupPrecompile
Run the below tutorials to learn how to use the EVM feature on the Bittensor blockchain.
Transfer TAO between two H160 addresses
Learn how to transfer TAO between two Ethereum H160 addresses.
READ MORE