Anoma Developer Documentation
  • Overview
  • Build
    • Getting Started
    • Your First Anoma App
      • Define a Resource
      • Write a Transaction Function
      • Write a Projection Function
      • Run your App
    • Anoma App Examples
  • LEARN
    • Overview
    • State Model
      • Model Comparison
    • Resource Machine
      • Information Flow Control
    • Resources
      • State
      • Logic
      • Kind
      • Lifecycle
    • Transactions
      • Delta
      • Actions
      • Balanced Transactions
      • Intents
    • Applications
      • Backend
      • Interface
    • Services
      • Indexing
      • Solving
Powered by GitBook
On this page
  • Resource Property Changes
  • Examples
  • Resource Supply Changes
  • Examples
  1. LEARN
  2. Transactions

Balanced Transactions

This page explains balanced transactions and how they can be formed.

PreviousActionsNextIntents

Last updated 2 months ago

Balanced transactions are characterized by a zero . They can be executed if they are valid and comply with the . One way of obtaining balanced transactions is through composition of matching, . However, a single party can often directly produce a balanced transaction without requiring any counterparty.

In the following, we show examples of transactions that can be sent by a single party, here Alice.

Legend

  • Symbols, e.g., ๐Ÿ , indicate resource objects of specific kind that can contain arbitrary data and logic.

  • Numbers Preceeding numbers, e.g., 4๐Ÿโ€‰ indicate the quantity of resources.

  • Names following a resource, e.g., 4๐Ÿโ€‰Alice , indicate who is authorized to consume.

  • Blue coloring indicates ephemeral resources.

Resource Property Changes

Often, transactions and actions within aim to change one or multiple properties of existing resource objects. Most of the time, a single, authorized party (i.e., the owner) can unilaterally execute the transaction. Actions can include, for example,

  • Transferring a resource, which changes the owner

  • Splitting and merging resources, which changes the quantity

Examples

Alice owns an apple resource ๐Ÿ and wants to transfer it to Bob.

Alice's balanced transaction

Alice consumes her 3๐Ÿโ€‰Alice resource and creates a 3๐Ÿโ€‰Bob resource for Bob.

Consume
Create

3๐Ÿโ€‰Alice

3๐Ÿโ€‰Bob

After execution, Alice has transferred 3๐Ÿ to Bob but the total quantity hasn't changed.

Alice owns an 3๐Ÿ resource and wants to split it into a 2๐Ÿ and a 1๐Ÿ resource.

Alice's balanced transaction

Alice consumes her 3๐Ÿโ€‰Alice resource and creates a 2๐Ÿโ€‰Alice and a 1๐Ÿโ€‰Alice resource for herself.

Consume
Create

3๐Ÿโ€‰Alice

2๐Ÿโ€‰Alice

1๐Ÿโ€‰Alice

After execution, Alice has two resource objects instead of one, but the total quantity hasn't changed.

Alice owns a 2๐Ÿ and a 1๐Ÿ resource and wants to merge them into one 3๐Ÿ resource.

Alice's balanced transaction

Alice consumes her 2๐Ÿโ€‰Alice and 1๐Ÿโ€‰Alice resources and creates a 3๐Ÿโ€‰Alice resource for herself.

Consume
Create

2๐Ÿโ€‰Alice

3๐Ÿโ€‰Alice

1๐Ÿโ€‰Alice

After execution, Alice has one resource instead of two, but the total quantity hasn't changed.

Resource Supply Changes

Changing resource properties requires resource to exist in the first place. However, immediately after the genesis of a resource controller (e.g., the launch of a new blockchain or the deployment of a protocol adapter) the associated commitment tree is empty. The question is how resources can be initially created but also finally consumed.

Constraining the Supply

Resource logics can include constraints and mechanisms fixing the supply (i.e., the total quantity of all resources) of a given resource kind after initialization or allowing only a specific originator identity to inflate or deflate the supply.

Examples

Alice's balanced transaction

Alice consumes an ephemeral 3๐Ÿโ€‰Alice resource and creates a non-ephemeral 3๐Ÿโ€‰Alice resource.

Consume
Create

3๐Ÿโ€‰Alice

3๐Ÿโ€‰Alice

After execution, Alice has created a new 3๐Ÿ resource for herself and inflated the total supply by 3.

Alice's balanced transaction

Alice consumes a non-ephemeral 3๐Ÿโ€‰Alice resource and creates an ephemeral 3๐Ÿโ€‰Alice resource.

Consume
Create

3๐Ÿโ€‰Alice

3๐Ÿโ€‰Alice

After execution, Alice has finally consumed her 3๐Ÿ resource and deflated the supply by 3.

We call the process of initially creating a resource out of nothing initialization, and the process of finally consuming a resource finalization. The former and latter result in inflation and deflation of the supply (i.e., the total quantity) of the associated resource kind, respectively. Both require utilizing to balance the transaction.

Alice wants to initiallly create an apple resource (without consuming an existing one) and inflate the total ๐Ÿ supply by 3. To balance the transaction she uses an .

Alice wants to finally consume a 3๐Ÿ resource (without creating a new one) to deflate the total ๐Ÿ supply by 3. To balance the transaction she uses an .

transaction delta
resource machine rules
unbalanced transactions, a.k.a. as intents
ephemeral resources
ephemeral resource
ephemeral resource