batch

Call v120 → current #0

Sends multiple calls in a batch, continuing on failure.

View calls on chain

Click items to navigate. Pan and zoom to explore.

From Chain Metadata

Send a batch of dispatch calls. May be called from any origin except `None`. `calls`: The calls to be dispatched from the same origin. The number of call must not exceed the constant: `batched_calls_limit` (available in constant metadata). If origin is root then the calls are dispatched without checking origin filter. (This includes bypassing `frame_system::Config::BaseCallFilter`). ## Complexity O(C) where C is the number of calls to be batched. This will return `Ok` in all circumstances. To determine the success of the batch, an event is deposited. If a call failed and the batch was interrupted, then the `BatchInterrupted` event is deposited, along with the number of successful calls made and the error of the failed call. If all were successful, then the `BatchCompleted` event is deposited.

Input Parameters

#NameTypeDescription
0
calls
Vec<RuntimeCall> Veccalls (Vec<RuntimeCall>)

Permissions

Origin
Unknown
Required Role

Permission data inferred from metadata. May be incomplete.

Requirements

  • Calls array is not empty
  • Calls count <= batched_calls_limit

Effects

Postconditions

  • Each call executed in order
  • BatchCompleted or BatchInterrupted event emitted

Side Effects

  • Failed calls do not revert successful ones
  • Gas-efficient for multiple operations

Code Examples

import { ApiPromise, WsProvider } from "@polkadot/api";
import { stringCamelCase } from "@polkadot/util";

const provider = new WsProvider("wss://entrypoint-finney.opentensor.ai:443");
const api = await ApiPromise.create({ provider });

// Build batch call
const calls = 0 as any /* Vec<RuntimeCall> */;

const call = api.tx[stringCamelCase("Utility")][stringCamelCase("batch")](
  calls
);

On-Chain Activity

Usage Frequency
●●●●○○ Active 100K–1M extrinsics

Significant regular use

#29 most used call

Success Rate Near-certain

Over 95% of submissions succeed

As of block 7,429,232

Runtime Info

Pallet Index
11
Call Index
0
First Version
v120
Current Version
v393