Clearing Transactions
Last updated
Last updated
Clearing transactions are a fundamental aspect of TRAIT Blockchain used to perform most of the routine operations.
Comparing to other blockchains a Clearing transaction can be considered as a list of transactions batched together.
A clearing transaction consists of a series of "Atomics". Atomics represent a group of actions that are executed within a clearing transaction. Atomics are executed atomically, meaning if one action fails within an atomic, the entire atomic operation is rolled back (no-op). This allows to perform related on-chain operations while maintain data integrity.
Each "Atomic" is comprised of multiple "Actions". Action is an on-chain operation like mint or transfer of tokens.
A single Clearing transaction can consists of hundreds of actions. Which allows an off-chain app to employ the following pattern:
wait and collect on-chain operations to perform;
submit a single Clearing transaction;
process results of execution of Clearing transaction;
wait and collect on-chain operation to perform;
...
This allows an application to send blockchain transactions sequentially rather than in parallel and avoid situation when an off-chain app has multiple pending blockchain transactions. This actually greatly simplifies business-logic of such apps, reducing costs and development time.
Clearing transactions incur charges that are designed to cover the costs associated with their execution. These are paid through the AppAgent subscription.
Read Subscriptions to learn more.
For the development purposes you can use PolkadotJS to create a Clearing transaction.
To create a Clearing transaction in production please use the ActionGate - the backend-service that runs on your server.
Read ActionGate to learn more.