Skip to main content

Utility

The Utility pallet serves as a repository of utility functions for the peaq network, offering capabilities such as account management, contract creation and administration, and interaction with other pallets within the network.

Pallet functionalities:

  1. Batch Dispatch: It allows sending a batch of calls to be dispatched. The purpose is to execute a group of extrinsics atomically. The number of calls must not exceed the batched_calls_limit constant (available in constant metadata).

  2. Pseudonymous Dispatch: In pseudonymous dispatch, an account executes a call through a pseudonymous account. A pseudonymous account is an alternative account ID. Each account has 2*2**16 possible pseudonyms. One possible use case is when you need multiple distinct accounts that need to be controlled by the same keypair.

Functions:

  1. batch(call): This function sends a batch of calls to be dispatched. If a call fails, successful calls in the batch up to that point will be executed, and a BatchInterrupted event will be emitted. If all calls are successful, a BatchCompleted event is emitted.

  2. batch_all(call): Similar to batch, but all the extrinsics are reverted if any of the extrinsics in the batch is unsuccessful.

  3. force_batch(call): This function sends a batch of dispatch calls. Unlike batch, it allows errors and doesn't interrupt the execution.

  4. with_weight(call): Dispatches a call with a specified weight. This function does not check for the weight of the call; instead, it allows the root to specify the weight. This extrinsic must be executed from the root.

  5. as_derivative(index, call): Sends a call through an indexed pseudonym of the sender given the index number and the call.

  6. dispatch_as(asOrigin, call): Dispatches a function call provided an origin and the call to be dispatched. The dispatch origin for this call must be the root.