# register-leased-network (/docs/tx/register-leased-network)

Creates a subnet paid for by a crowdloan rather than a single coldkey: the
crowdloan's funds cover the network registration cost (leftover cap is
refunded to contributors pro-rata, with any rounding remainder going to
the beneficiary), contributors earn `emissions_share` percent of the
subnet owner's emission cut (not of total subnet emissions) as dividends,
and the beneficiary operates the subnet through a scoped proxy. Must be
dispatched in a crowdloan context — it fails as a standalone call. The
cost is not cheaply boundable up front, so a configured spend cap blocks
this until raised. With an `end_block` the beneficiary can later take
full ownership via `terminate_lease`; without one the lease is
perpetual and ownership never transfers.

| Signer    | Origin                                 | Pallet          | Wraps                                                                                                     |
| --------- | -------------------------------------- | --------------- | --------------------------------------------------------------------------------------------------------- |
| `coldkey` | signed account (pallet role may apply) | SubtensorModule | [`SubtensorModule.register_leased_network`](/code/pallets/subtensor/src/macros/dispatches.rs#L1671-L1679) |

## Parameters [#parameters]

| Parameter         | Type    | Required | Description                                                                                       |
| ----------------- | ------- | -------- | ------------------------------------------------------------------------------------------------- |
| `emissions_share` | integer | yes      | Percent (0-100) of the subnet owner's emission cut paid to crowdloan contributors as dividends.   |
| `end_block`       | integer | no       | Block at which the lease ends and the beneficiary may take ownership; omit for a perpetual lease. |

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 register-leased-network \
  --emissions-share <int> --dry-run
btcli tx register-leased-network \
  --emissions-share <int> -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.RegisterLeasedNetwork(emissions_share=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("register_leased_network", {...}, wallet)
```

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

`SubtensorModule.register_leased_network` — [`pallets/subtensor/src/macros/dispatches.rs#L1673`](/code/pallets/subtensor/src/macros/dispatches.rs#L1671-L1679):

```rust
#[pallet::call_index(110)]
#[pallet::weight(<T as crate::pallet::Config>::WeightInfo::register_leased_network(T::MaxContributors::get()))]
pub fn register_leased_network(
    origin: OriginFor<T>,
    emissions_share: Percent,
    end_block: Option<BlockNumberFor<T>>,
) -> DispatchResultWithPostInfo {
    Self::do_register_leased_network(origin, emissions_share, end_block)
}
```

Delegates to [`do_register_leased_network`](/code/pallets/subtensor/src/subnets/leasing.rs#L70).

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)).
