associate_evm_key

Call Re-added v261 → v277, v290 → v315, v320 → v320, v323 → current #93

Associates an EVM key with a Substrate account.

View calls on chain

Click items to navigate. Pan and zoom to explore.

Used by: developerswalletsexchangesvalidators

The Big Picture

Bittensor is a Substrate chain (like Polkadot), but EVM compatibility opens doors to Ethereum's massive tooling ecosystem. associate_evm_key links your Substrate account to an Ethereum-style address, letting you use MetaMask, access EVM contracts, and participate in cross-chain operations. It's your passport between the Substrate and Ethereum worlds.

Why This Matters

Most crypto users know Ethereum wallets. EVM association lets them use familiar tools (MetaMask, Ledger's ETH app) with Bittensor. For developers, it enables smart contracts and DeFi integrations that would otherwise require custom development.

Example Scenario

You want to use MetaMask with Bittensor. Your ETH address is 0xabc...123. Your Bittensor coldkey is 5Grw...QY. Call associate_evm_key(evm_key=0xabc...123). Now your MetaMask can sign transactions that affect your Bittensor account. DApps see your 0x address, the chain routes to your substrate account.

Common Questions

Can I associate any Ethereum address?
Yes, but you should only associate addresses you control. The association doesn't verify ownership - you're trusting the link. Use addresses from your own wallets.
Can one EVM key link to multiple Substrate accounts?
No - each EVM key can only associate with one Substrate account. The mapping is one-to-one. Choose your primary account carefully.
What operations can I do via EVM after associating?
Depends on the network's EVM implementation. Typically: transfers, basic contract interactions, and bridges. Some Substrate-specific calls may not have EVM equivalents.
How do I disassociate an EVM key?
Check if there's a disassociate call. Some implementations are permanent. Plan your key management before associating.

Use Cases

  • Connect MetaMask or other EVM wallets to Bittensor
  • Enable DeFi integrations requiring EVM compatibility
  • Bridge assets between EVM chains and Bittensor
  • Use familiar Ethereum tooling with Bittensor accounts

From Chain Metadata

Attempts to associate a hotkey with an EVM key. The signature will be checked to see if the recovered public key matches the `evm_key` provided. The EVM key is expected to sign the message according to this formula to produce the signature: ```text keccak_256(hotkey ++ keccak_256(block_number)) ```

Input Parameters

#NameTypeDescription
0
netuid
u16 Subnet/network identifier (0-65535)
1
evm_key
H160 evm_key (H160)
2
block_number
u64 block_number (u64) (RAO -> TAO (/ 10^9))
3
signature
[u8; 65] [65]signature ([u8; 65])

Permissions

Origin
Signed
Required Role

Permission data inferred from metadata. May be incomplete.

Requirements

  • Valid EVM key (20-byte Ethereum address)
  • EVM key not already associated with another account
  • Substrate account authorized (signing the transaction)

Effects

Events Emitted

Postconditions

  • EVM key linked to Substrate account
  • Account can interact via EVM interfaces

Side Effects

  • Enables cross-chain and EVM-compatible operations
  • Allows MetaMask and other EVM wallets to interact

Code Examples

import { ApiPromise, WsProvider } from "@polkadot/api";
import { stringCamelCase } from "@polkadot/util";

const provider = new WsProvider("wss://entrypoint-finney.opentensor.ai:443");
const api = await ApiPromise.create({ provider });

// Build associate_evm_key call
const netuid = 1;
const evm_key = 0 as any /* H160 */;
const block_number = 0;
const signature = 0;

const call = api.tx[stringCamelCase("SubtensorModule")][stringCamelCase("associate_evm_key")](
  netuid,
  evm_key,
  block_number,
  signature
);

Version History

v261 block 5,328,895 5 args
v290 block 5,947,548 4 args
v320 block 6,523,566 5 args
v323 block 6,560,485 4 args Current

Runtime Info

View Source
Pallet Index
7
Call Index
93
First Version
v261
Current Version
v393