# terminate-lease (/docs/tx/terminate-lease)

Ends the lease and transfers full subnet ownership to the beneficiary:
contributor dividends stop and the subnet becomes an ordinary owned
subnet. Only the lease's beneficiary can call it, and only after the
lease's end block has passed — earlier attempts fail, and perpetual leases
(no end block) can never be terminated this way. Check the lease's end
block with the `lease` read before calling.

| Signer    | Pallet          | Wraps                             |
| --------- | --------------- | --------------------------------- |
| `coldkey` | SubtensorModule | `SubtensorModule.terminate_lease` |

## Parameters [#parameters]

| Parameter     | Type    | Required | Description                                                                                |
| ------------- | ------- | -------- | ------------------------------------------------------------------------------------------ |
| `lease_id`    | integer | yes      | Lease to terminate (see the leases read).                                                  |
| `hotkey_ss58` | string  | no       | Beneficiary hotkey recorded as the subnet's owner hotkey; defaults to the wallet's hotkey. |

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 terminate-lease \
  --lease-id <int> --dry-run
btcli tx terminate-lease \
  --lease-id <int> -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.TerminateLease(lease_id=0)

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("terminate_lease", {...}, wallet)
```
