Transactions

set-service

Publish this hotkey's service on a subnet, with the url where it describes

View as Markdown

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.

SignerOriginPalletWraps
coldkeysigned account (pallet role may apply)SubtensorModuleSubtensorModule.set_service

Parameters

ParameterTypeRequiredDescription
netuidintegeryesSubnet on which to publish the service.
urlstringyesAn http(s) url of the services document, up to 256 bytes; empty removes it.
hotkey_ss58stringnoHotkey whose service it is; defaults to the wallet's.
spender_ss58stringnoThe 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

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

btcli tx set-service \
  --netuid <int> \
  --url <value> --dry-run
btcli tx set-service \
  --netuid <int> \
  --url <value> -w my_coldkey

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.) Or build the intent by op name, as an agent would:

result = sub.execute_tool("set_service", {...}, wallet)

On-chain implementation

SubtensorModule.set_service — pallets/subtensor/src/macros/dispatches.rs#L3353:

#[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.

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