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.
Bittensor EVM smart contracts are executed solely on the Bittensor blockchain, not on the Ethereum blockchain.
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 |
Set-up Guide | EVM Testnet with Metamask Wallet | 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
Ethereum vs Bittensor EVM Smart Contracts
On the Ethereum network, nodes such as full nodes, validator nodes and archive nodes run the Ethereum Virtual Environment (EVM) run-time environment. Smart contracts operate under this EVM. See the below high-level diagram.
When we say “smart contracts on Bittensor” we refer to the new EVM compability feature in the Bittensor subtensor blockchain. When this EVM feature is turned ON, it allows the subtensor blockchain to execute Ethereum-compatible smart contracts. Note that all operations performed by this new subtensor EVM feature are executed solely on the subtensor blockchain, not on the Ethereum blockchain.