# set-service (/docs/tx/set-service)

its services and the spender customers name on their gamma deposits.

The chain stores the url and the spender only; the document the url points
to (the services and their interfaces) is the publisher's. Without
`spender_ss58` the spender is the coldkey. Signed by the coldkey; the
hotkey must hold a validator permit on the subnet, or be the subnet owner's
hotkey with the subnet owner signing. An empty url removes the service.

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

## Parameters [#parameters]

| Parameter      | Type    | Required | Description                                                                 |
| -------------- | ------- | -------- | --------------------------------------------------------------------------- |
| `netuid`       | integer | yes      | Subnet on which to publish the service.                                     |
| `url`          | string  | yes      | An http(s) url of the services document, up to 256 bytes; empty removes it. |
| `hotkey_ss58`  | string  | no       | Hotkey whose service it is; defaults to the wallet's.                       |
| `spender_ss58` | string  | no       | The spender customers name for the service; defaults to the coldkey.        |

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 set-service \
  --netuid <int> \
  --url <value> --dry-run
btcli tx set-service \
  --netuid <int> \
  --url <value> -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.SetService(netuid=1, url="...")

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

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

`SubtensorModule.set_service` — [`pallets/subtensor/src/macros/dispatches.rs#L3353`](/code/pallets/subtensor/src/macros/dispatches.rs#L3351-L3361):

```rust
#[pallet::call_index(165)]
#[pallet::weight((<T as Config>::WeightInfo::set_service(), DispatchClass::Normal, Pays::Yes))]
pub fn set_service(
    origin: OriginFor<T>,
    netuid: NetUid,
    hotkey: T::AccountId,
    url: BoundedVec<u8, ConstU32<MAX_SERVICE_URL_LEN>>,
    spender: T::AccountId,
) -> DispatchResult {
    Self::do_set_service(origin, netuid, hotkey, url, spender)
}
```

Delegates to [`do_set_service`](/code/pallets/subtensor/src/subnets/serving.rs#L162).

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