# evm-withdraw (/docs/tx/evm-withdraw)

Every native account controls one EVM address: the first 20 bytes of its
public key (the *truncated* mapping). TAO sent from MetaMask to that
address's mirror can be pulled into the native account with this call —
the EVM-to-substrate path that needs no EVM gas. The flow: send TAO from
the EVM wallet to the address shown by `btcli evm deposit-address`, then
claim it with `btcli evm claim-deposit` (or `btcli tx evm-withdraw`).
This is not `btcli evm send-to-ss58`, which spends from a stored EVM key
via the balance-transfer precompile. Fails if the mirror holds less than
the amount.

| Signer    | Origin                                 | Pallet | Wraps          |
| --------- | -------------------------------------- | ------ | -------------- |
| `coldkey` | signed account (pallet role may apply) | EVM    | `EVM.withdraw` |

## Parameters [#parameters]

| Parameter    | Type              | Required | Description                           |
| ------------ | ----------------- | -------- | ------------------------------------- |
| `amount_tao` | number \| `"all"` | yes      | How much TAO to pull from the mirror. |

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 evm-withdraw \
  --amount-tao <amount|all> --dry-run
btcli tx evm-withdraw \
  --amount-tao <amount|all> -w my_coldkey
```

## Python [#python]

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

wallet = Wallet(name="my_coldkey", hotkey="my_hotkey")
intent = bt.EvmWithdraw(amount_tao=1.0)

sub = bt.Subtensor()
plan = sub.plan(intent, wallet)   # fee, effects, policy — no submission
result = sub.execute(intent, wallet)
if not result.success:
    print(result.error.code, result.error.remediation)
```

(`bt.Subtensor` is also the async client — `async with bt.Subtensor() as client:`
— see [The client](/docs/concepts/client).) Or build the intent by op name, as
an agent would:

```python
result = sub.execute_tool("evm_withdraw", {...}, wallet)
```

## On-chain implementation [#on-chain-implementation]

`EVM.withdraw` is implemented by Frontier's `pallet_evm` (vendored under `vendor/frontier`), outside this repository's pallets.

Every file is browsable under [/code](/code) exactly as built into the runtime, or as plain text under `/code/raw/<path>` (index: [`/code/index.json`](/code/index.json)).
