Scrypto Transaction Model

The transaction model used with Radix Engine v2 is dramatically different from the transaction model used currently on the Radix Olympia mainnet. This new transaction model is still under development and will not become the model used for transactions on the Radix mainnet until the Babylon release when Radix Engine v2 moves onto the network.

Until then, the transaction model described here is only used in the Scrypto simulator environment.

In Radix Engine v2, transactions encode the high-level actions that an external actor wants to take, including manipulation of resources and calls to blueprint and component functions and methods.

A transaction consists of an array of instructions, which are interpreted by Radix Engine.

Instruction Set

Instruction Arguments Description

DeclareTempBucket

None

Declares a temporary Bucket for function/method invocation.

DeclareTempBucketRef

None

Declares a temporary BucketRef for function/method invocation.

TakeFromContext

  • amount (Decimal): the amount to take

  • resource_address (Address): the resource definition address

  • to (Bid): the destination temporary bucket

Takes resource from transaction context to a temporary bucket.

BorrowFromContext

  • amount (Decimal): the amount to take

  • resource_address (Address): the resource definition address

  • to (Rid): the destination temporary bucket ref

Borrows resource from transaction context to a temporary bucket ref.

CallFunction

  • package_address (Address): the address of the package that defines the function

  • blueprint_name (String): the blueprint name

  • function (String): the function name

  • args (Vec<Vec<u8>): the argument list

Invokes a function. All resources returned by the callee will be put into transaction context.

CallMethod

  • component_address (Address): the component address

  • method (String): the method name

  • args (Vec<Vec<u8>>): the argument list

Invokes a method. All resources returned by the callee will be put into transaction context.

DropAllBucketRefs

None

Drops all bucket refs in transaction context.

DepositAllBuckets

  • account (Address): the recipient account component address

Deposits all resources into the designated account.

End

  • signers (Vec<Signature>): the signatures of all signers

Marks the end of a transaction.

Static Transaction Validation

  • Every transaction should end with a single End instruction;

  • All referenced Bid should be temporary buckets;

  • All referenced Rid should be temporary bucket refs.

Not all validation rules have been implemented at the time of writing.