# associate-evm-key (/docs/tx/associate-evm-key)

Links an Ethereum-style (H160) address to the signing hotkey on one subnet,
letting EVM-side activity be attributed to that neuron. Signed by the
hotkey, and additionally proven by the EVM key itself: `signature` must
be an EIP-191 personal-sign signature by the EVM key over the message
`hotkey_pubkey (32 bytes) ++ keccak_256(scale(block_number))`, where the
block number is SCALE-encoded (u64 little-endian). Use
`bittensor.evm.transactions.association_proof` to produce it (it needs
the EVM private key); a wrong message, block number, or key makes the
chain reject the call. Prerequisites: the hotkey must be registered on
`netuid` (else HotKeyNotRegisteredInSubNet) and have an owning coldkey,
and re-association is rate-limited to once per 7,200 blocks (\~1 day) per
neuron.

| Signer   | Pallet          | Wraps                               |
| -------- | --------------- | ----------------------------------- |
| `hotkey` | SubtensorModule | `SubtensorModule.associate_evm_key` |

## Parameters [#parameters]

| Parameter      | Type    | Required | Description                                                                                                                                                                       |
| -------------- | ------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `netuid`       | integer | yes      | Subnet on which the EVM key association is recorded.                                                                                                                              |
| `evm_key`      | string  | yes      | EVM address to link to the hotkey, as 0x-prefixed H160 hex.                                                                                                                       |
| `block_number` | integer | yes      | Block number the signature was produced for; part of the signed message.                                                                                                          |
| `signature`    | string  | yes      | The EVM key's ownership proof, as 0x-prefixed hex: an EIP-191 personal-sign signature over the hotkey public key concatenated with keccak\_256 of the SCALE-encoded block number. |

Address parameters (`--hotkey`, `--coldkey`, `--dest`, ...) accept a raw ss58
address, an address-book or proxy-book name, or a local wallet/hotkey name.

## CLI [#cli]

Preview with `--dry-run` (shows fee, effects, and policy result without
submitting), then submit:

```bash
btcli tx associate-evm-key \
  --netuid <int> \
  --evm-key <value> \
  --block-number <int> \
  --signature <value> --dry-run
btcli tx associate-evm-key \
  --netuid <int> \
  --evm-key <value> \
  --block-number <int> \
  --signature <value> -w my_coldkey
```

## Python [#python]

```python
import bittensor as sub
from bittensor.wallet import Wallet

wallet = Wallet(name="my_coldkey", hotkey="my_hotkey")
intent = sub.AssociateEvmKey(netuid=1, evm_key="...", block_number=0, signature="...")

async with sub.Client("finney") as client:
    plan = await client.plan(intent, wallet)   # fee, effects, policy — no submission
    result = await client.execute(intent, wallet)
    if not result.success:
        print(result.error.code, result.error.remediation)
```

Or build it by op name, as an agent would:

```python
await client.execute_tool("associate_evm_key", {...}, wallet)
```
