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

The following is a railroad diagram describing the grammar of the transaction manifest instructions and what each instruction expects.

manifest railroad
  • 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
        Set<NonFungibleId>(NonFungibleId("0a0100000000000000"), NonFungibleId("0a0200000000000000"))
        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
        Set<NonFungibleId>(NonFungibleId("0a0100000000000000"), NonFungibleId("0a0200000000000000"))
        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
        Set<NonFungibleId>(NonFungibleId("0a0100000000000000"), NonFungibleId("0a0200000000000000"))
        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");
  • PUBLISH_PACKAGE

    Packages a package (in hexadecimal).

    PUBLISH_PACKAGE
        Blob("[wasm_blob]")
        Blob("[abi_blob]");

Expressions

At the moment, two expressions are available. Expression("ENTIRE_WORKTOP") takes all resources present on the worktop and puts them in a vector of buckets that can then be used as an argument. Expression("ENTIRE_AUTH_ZONE") works similarly but with proofs present on the AuthZone.

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(var1, var2, …​)

If you want to send this Struct as argument:

#[derive(Debug, Describe, Decode, Encode)]
pub struct ScryptoDeveloper {
    number_of_projects: u32,
    favorite_language: String
}

You would write this in your transaction manifest: Struct(30u32, "Scrypto!")

Enum

Enum(Field, Value,*)

If you want to reference the MouseMove field in this enum:

#[derive(Debug, Describe, Decode, Encode)]
pub enum Event {
    PageLoad,
    MouseMove(u32, u32),
    KeyPress(String)
}

You would write this in your transaction manifest: Enum("MouseMove", 320u32, 480u32)

Option

Some(Value),
None

Some("test"),
None

Box

Box(Value)

Box(100u32)

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")

List

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

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

Set

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

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

Map

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

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

Decimal

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

Decimal("-123.456")

PreciseDecimal

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

PreciseDecimal("-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)

NonFungibleId

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

NonFungibleId("7d2c")

Named buckets

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");

Named proofs

There are multiple ways to create a named proof to pass it by intent to a method.

Most of the times, this is the syntax you would use:

# Lock fees
CALL_METHOD ComponentAddress("component_sim1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqgyhcl2") "lock_fee" Decimal("100");

# Create a proof of a badge on your account. The "create_proof" method returns a Proof to the authzone.
CALL_METHOD ComponentAddress("[your_account_address]") "create_proof" ResourceAddress("[badge_address]");

# Get a named proof from the last proof to have been inserted in the authzone.
POP_FROM_AUTH_ZONE Proof("my_proof");

# You can now pass this proof to a method/function

You can also create a proof from a bucket:

# Lock fees
CALL_METHOD ComponentAddress("component_sim1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqgyhcl2") "lock_fee" Decimal("100");

CALL_METHOD ComponentAddress("[your_account_address]") "withdraw_by_amount" Decimal("100") ResourceAddress("[xrd_address]");

TAKE_FROM_WORKTOP ResourceAddress("[xrd_address]") Bucket("my_bucket");

# Create a proof from the bucket
CREATE_PROOF_FROM_BUCKET
    Bucket("my_bucket")
    Proof("my_proof");

# You can now pass this proof to a method/function

# Because we withdrew tokens from our account and they are still on the
# worktop, we have to deposit them back into your account
CALL_METHOD_WITH_ALL_RESOURCES ComponentAddress("[your_account_address]") "deposit_batch";