Transactions

execute-orders

Relay classical orders and up to eight account-approved orders.

View as Markdown

Each signed order includes complete terms, its signature, and an optional partial fill. Authorized terms also bind an owner-local nonce. With should_fail true, any failed order reverts the whole batch.

SignerOriginPalletWraps
coldkeysigned account (pallet role may apply)LimitOrdersLimitOrders.execute_orders

Parameters

ParameterTypeRequiredDescription
ordersarrayyesComplete SignedOrder objects.
should_failbooleannoRevert the batch if any order fails.

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 execute-orders \
  --orders <a,b,c> --dry-run
btcli tx execute-orders \
  --orders <a,b,c> -w my_coldkey

Python

import bittensor as bt
from bittensor.wallet import Wallet

wallet = Wallet(name="my_coldkey", hotkey="my_hotkey")
intent = bt.ExecuteOrders(orders=[...])

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

On-chain implementation

LimitOrders.execute_orders — pallets/limit-orders/src/lib.rs#L616:

#[pallet::call_index(0)]
#[pallet::weight(Pallet::<T>::execute_orders_weight(orders))]
pub fn execute_orders(
    origin: OriginFor<T>,
    orders: BoundedVec<SignedOrder<T::AccountId>, T::MaxOrdersPerBatch>,
    should_fail: bool,
) -> DispatchResult {
    let relayer = ensure_signed(origin)?;
    ensure!(
        LimitOrdersEnabled::<T>::get(),
        Error::<T>::LimitOrdersDisabled
    );

    Self::check_authorized_batch_bound(&orders)?;
    for signed_order in orders {
        let order_id = Self::derive_order_id(&signed_order.order);
        if let Err(reason) = Self::try_execute_order(signed_order, order_id, &relayer) {
            if should_fail {
                // All-or-nothing: abort the batch, reverting prior orders.
                return Err(reason);
            }
            // Best-effort: individual order failures do not revert the batch.
            Self::deposit_event(Event::OrderSkipped { order_id, reason });
        }
    }

    Ok(())
}

Delegates to check_authorized_batch_bound, derive_order_id.

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