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
  • Creation
  • Consumption
  • Ephemeral Resources
  1. LEARN
  2. Resources

Lifecycle

This page explains the resource lifecycle and computable components and properties associated with it

PreviousKindNextTransactions

Last updated 2 months ago

Resources have a lifecycle with three stages:

1

Non-existent

A resource is non-existent when its commitment hasn't been added to the controller that the resource lives on.

2

Created

A resource is created after its commitment was added in the Merkle tree of the controller (e.g., blockchain) the resource will live on.

3

Consumed

A resource is consumed after its nullifier was added to the nullifier set of the controller (e.g., blockchain) the resource lived on.

Creation

To create a resource, its commitment must be computed by hashing the resource object.

commitment:=hcm(resource)\texttt{commitment} := h_\texttt{cm}(\texttt{resource})commitment:=hcm​(resource)

The commitment is then put into a . After execution, the commitment is added to a Merkle tree.

Consumption

To consume a resource, its nullifier must be computed by hashing the resource object and a secret called the nullifier key.

nullifier:=hnf(resource, nullifierKey)\texttt{nullifier} := h_\texttt{nf}(\texttt{resource},\,\texttt{nullifierKey})nullifier:=hnf​(resource,nullifierKey)

The nullifier is then put into a . After execution, the nullifier is added to a nullifier set. This nullification mechanism makes the consumption of the resource unlinkable to its past creation.

Current private devnet The current devnet supports only the in which the nullifier key is always 0.

Ephemeral Resources

In some cases, it is required to create resources that just exist over the course of the transaction. These resources are called ephemeral and can be identified by a dedicated flag in the . This is often used to balance out transactions that otherwise would be unbalanced, for example, when resources are initially created or finally consumed. Another use case is to write advanced that express optionality or have more sophisticated constraints. The latter is achieved by creating an ephemeral intent resource expressing the preferred state transition and constraints that can then be matched and consumed by a solver.

resource object data structure
intents
transaction
transaction
transparent ARM