Transaction Manifest Specifications

Grammar

Radix transaction manifest adopts a bash-like grammar. Each manifest consists of a sequence of instructions, each of which contains

  • A command for the type of operation;

  • A variable number of arguments;

  • A semicolon.

Instruction List

  • TAKE_FROM_WORKTOP

    Takes the entirety of resource from the worktop and creates a bucket

    TAKE_FROM_WORKTOP
        ResourceAddress("foo")
        Bucket("xrd_bucket");
  • TAKE_FROM_WORKTOP_BY_AMOUNT

    Takes some amount of resource from the worktop and creates a bucket

    TAKE_FROM_WORKTOP_BY_AMOUNT
        Decimal("1.0")
        ResourceAddress("foo")
        Bucket("xrd_bucket");
  • TAKE_FROM_WORKTOP_BY_IDS

    Takes some non-fungibles from the worktop and creates a bucket

    TAKE_FROM_WORKTOP_BY_IDS
        TreeSet<NonFungibleId>(NonFungibleId("11"), NonFungibleId("22"))
        ResourceAddress("foo")
        Bucket("xrd_bucket");
  • RETURN_TO_WORKTOP

    Returns a bucket to the worktop

    RETURN_TO_WORKTOP
        Bucket("xrd_bucket");
  • ASSERT_WORKTOP_CONTAINS

    Verifies that the worktop contains non-zero amount of the resource, else aborts the transaction

    ASSERT_WORKTOP_CONTAINS
        ResourceAddress("foo");
  • ASSERT_WORKTOP_CONTAINS_BY_AMOUNT

    Verifies that the worktop contains at least the given amount of a resource, else aborts the transaction

    ASSERT_WORKTOP_CONTAINS_BY_AMOUNT
        Decimal("1.0")
        ResourceAddress("foo");
  • ASSERT_WORKTOP_CONTAINS_BY_IDS

    Verifies that the worktop contains the specified non-fungibles, else aborts the transaction

    ASSERT_WORKTOP_CONTAINS_BY_IDS
        TreeSet<NonFungibleId>(NonFungibleId("11"), NonFungibleId("22"))
        ResourceAddress("foo");
  • POP_FROM_AUTH_ZONE

    Pops the most recent proof from the auth zone

    POP_FROM_AUTH_ZONE
        Proof("proof");
  • PUSH_TO_AUTH_ZONE

    Pushes a proof to the auth zone

    PUSH_TO_AUTH_ZONE
        Proof("proof");
  • CREATE_PROOF_FROM_AUTH_ZONE

    Creates a proof of the entirety of resource from the auth zone

    CREATE_PROOF_FROM_AUTH_ZONE
        ResourceAddress("foo")
        Proof("proof");
  • CREATE_PROOF_FROM_AUTH_ZONE_BY_AMOUNT

    Creates a proof of some amount of resource from the auth zone

    CREATE_PROOF_FROM_AUTH_ZONE_BY_AMOUNT
        Decimal("1.0")
        ResourceAddress("foo")
        Proof("proof");
  • CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS

    Creates a proof of some non-fungibles from the auth zone

    CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS
        TreeSet<NonFungibleId>(NonFungibleId("11"), NonFungibleId("22"))
        ResourceAddress("foo")
        Proof("proof");
  • CREATE_PROOF_FROM_BUCKET

    Creates a proof from a bucket

    CREATE_PROOF_FROM_BUCKET
        Bucket("special_token")
        Proof("proof");
  • CLONE_PROOF

    Clones a proof

    CLONE_PROOF
        Proof("proof")
        Proof("proof2");
  • DROP_PROOF

    Drops (destroys) a proof

    DROP_PROOF
        Proof("proof");
  • CALL_FUNCTION

    Invokes a function on a blueprint

    CALL_FUNCTION
        PackageAddress("my_package")
        "Airdrop"
        "new"
        500u32
        HashMap<String, U8>("key", 1u8);
  • CALL_METHOD

    Invokes a method on a component

    CALL_METHOD
        ComponentAddress("gumball_machine")
        "refill"
        Bucket("withdraw_xrd")
        Proof("admin_auth")
        "hello"
        Decimal("1.2");
  • CALL_METHOD_WITH_ALL_RESOURCES

    Invokes a method with all resources owned by the transaction, whether in buckets or on the worktop

    CALL_METHOD_WITH_ALL_RESOURCES
        Address("gumball_machine")
        "deposit_batch";
  • PUBLISH_PACKAGE

    Packages a package (in hexadecimal).

    PUBLISH_PACKAGE
        Bytes("deadbeef");

Value Representation

All values are strongly typed.

Type Syntax Example

Unit

()

()

Bool

true,
false

false

I8, I16, I32, I64, I128

-?(0|[1-9][0-9]*)i(8|16|32|64|128)

-412i32

U8, U16, U32, U64, U128

(0|[1-9][0-9]*)u(8|16|32|64|128)

123123123u64

String

"\w+" with escapes

"I like \"quoted message\"!\n"

Struct

Struct(Value,*)

Struct("Hello", 123u8)

Enum

Enum(String, Value,*)

Enum("Animal", 180u32)

Option

Some(Value),
None

Some("test"),
None

Box

Box(Value)

Box(100u32)

Array

Array<Type>(Value, Value, …​)

Array<U8>(1u8, 8u8, 100u8)

Tuple

Tuple(Value, Value, …​)

Tuple("first", 2u32)

Result

Ok(Value),
Err(Value)

Ok("Success"),
Err(123u8)

Vec

Vec<Type>(Value, Value, …​)

Vec<String>("foo", "bar")

TreeSet

TreeSet<String>(Value, Value, …​)

TreeSet<String>("1st", "2nd", "3rd")

TreeMap

TreeMap<Type, Type>(Value, Value, …​)

TreeMap<String, U32>("key1", 8u32, "key2", 100u32)

HashSet

HashSet<String>(Value, Value, …​)

HashSet<String>("1st", "2nd", "3rd")

HashMap

HashMap<Type, Type>(Value, Value, …​)

HashMap<String, U32>("key1", 8u32, "key2", 100u32)

Decimal

Decimal("-?(0\a|[1-9][0-9]*)(\.[0-9]+)?")

Decimal("-123.456")

PackageAddress

PackageAddress("[0-9a-f]{54}")

PackageAddress("026f…​e1e9")

ComponentAddress

ComponentAddress("[0-9a-f]{54}")

ComponentAddress("026f…​e1e9")

ResourceAddress

ResourceAddress("[0-9a-f]{54}")

ResourceAddress("026f…​e1e9")

NonFungibleAddress

NonFungibleAddress("[0-9a-f]*")

NonFungibleAddress("026f…​e1e9")

Hash

Hash("[0-9a-f]{64}")

Hash("7d2c…​b290")

Bucket

Bucket(String | U32)

Bucket("my_awesome_xrd_bucket"),
Bucket(5u32)

Proof

Proof(String | U32)

Proof("auth"),
Proof(100u32)

LazyMap

LazyMap("[0-9a-f]{72}")

LazyMap("7d2c…​0003")

Vault

Vault("[0-9a-f]{72}")

Vault("7d2c…​0004")

NonFungibleId

NonFungibleId("[0-9a-f]+")

NonFungibleId("7d2c")

Named buckets and proofs

Buckets and proofs created in manifest can be referred by name.

To create a named bucket and use it for method call,

TAKE_FROM_WORKTOP_BY_AMOUNT
    Decimal("1.0")
    Address("030000000000000000000000000000000000000000000000000004")
    Bucket("my_bucket");
CALL_METHOD
    Address("025f87bc67e398f84077cee24378167018bc28c234953bf3c659be")
    take_my_bucket
    Bucket("my_bucket");

To create a named proof and pass it to a component,

CREATE_PROOF_FROM_BUCKET
    Bucket("some_bucket")
    Proof("my_proof");
CALL_METHOD
    Address("025f87bc67e398f84077cee24378167018bc28c234953bf3c659be")
    "protected_method"
    Proof("my_proof");