Skip to main content

Transaction

Class Transaction

Webassembly Representation of an Aleo transaction

This object is created when generating an on-chain function deployment or execution and is the object that should be submitted to the Aleo Network in order to deploy or execute a function.

Methods

fromString

Create a transaction from a string

fromString(transaction)Transaction
ParametersTypeDescription
transactionstringString representation of a transaction
returnTransaction**

fromBytesLe

Create a transaction from a Uint8Array of left endian bytes.

fromBytesLe(Uint8Array)Transaction
ParametersTypeDescription
Uint8ArrayUint8Arrayof left endian bytes encoding a Transaction.
returnTransaction**

toString

Get the transaction as a string. If you want to submit this transaction to the Aleo Network this function will create the string that should be submitted in the `POST` data.

toString() ► string
ParametersTypeDescription
returnstringString representation of the transaction

toBytesLe

Get the transaction as a Uint8Array of left endian bytes.

toBytesLe()Uint8Array
ParametersTypeDescription
returnUint8ArrayUint8Array representation of the transaction

constainsSerialNumber

Returns true if the transaction contains the given serial number.

constainsSerialNumber(True) ► boolean
ParametersTypeDescription
Truebooleanif the transaction contains the given serial number.
returnboolean**

constainsCommitment

Returns true if the transaction contains the given commitment.

constainsCommitment(True) ► boolean
ParametersTypeDescription
Truebooleanif the transaction contains the given commitment.
returnboolean**

findRecord

Find a record in the transaction by the records commitment.

findRecord(commitment)RecordCiphertext
ParametersTypeDescription
commitmentField**
returnRecordCiphertext**

baseFeeAmount

Returns the transaction's base fee.

baseFeeAmount()BigInt
ParametersTypeDescription
returnBigInt**

feeAmount

Returns the transaction's total fee.

feeAmount()BigInt
ParametersTypeDescription
returnBigInt**

priorityFeeAmount

Returns the transaction's priority fee.

returns The transaction's priority fee.

priorityFeeAmount()BigInt
ParametersTypeDescription
returnBigInt**

isDeploy

Returns true if the transaction is a deployment transaction.

isDeploy() ► boolean
ParametersTypeDescription
returnbooleanTrue if the transaction is a deployment transaction

isExecute

Returns true if the transaction is an execution transaction.

isExecute() ► boolean
ParametersTypeDescription
returnbooleanTrue if the transaction is an execution transaction

isFee

Returns true if the transaction is a fee transaction.

isFee() ► boolean
ParametersTypeDescription
returnbooleanTrue if the transaction is a fee transaction

deployedProgram

Returns the program deployed within the transaction if the transaction is a deployment transaction.

deployedProgram()Program
ParametersTypeDescription
returnProgramThe program deployed within the transaction.

execution

Returns the execution within the transaction (if present).

execution()Execution
ParametersTypeDescription
returnExecutionThe execution within the transaction.

ownedRecords

Get the record plaintext present in a transaction owned by a specific view key.

ownedRecords(view_key)Array.<RecordPlaintext>
ParametersTypeDescription
view_keyViewKeyView key used to decrypt the ciphertext
returnArray.<RecordPlaintext>Array of record plaintext objects

records

Get the records present in a transaction and their commitments.

records()Array.<{commitment: Field, record: RecordCiphertext}>
ParametersTypeDescription
returnArray.<{commitment: Field, record: RecordCiphertext}>Array of record ciphertext objects

summary

Get a summary of the transaction within a javascript object.

If the transaction is an execution transaction, this function will return a list of the transitions and their inputs and outputs.

If the transaction is a deployment transaction, this function will return the program id and a list of the functions and their verifying keys, constraint, and variable counts.

summary(convert_to_js)Object
ParametersTypeDescription
convert_to_jsboolean*If true the inputs and outputs will be converted to JS objects,
if false the inputs and outputs will be in wasm format.*
returnObjectTransaction summary

id

Get the id of the transaction. This is the merkle root of the transactions inclusion proof.

This value can be used to query the status of the transaction on the Aleo Network to see if it was successful. If successful, the transaction will be included in a block and this value can be used to lookup the transaction data on-chain.

id() ► string
ParametersTypeDescription
returnstringTransactionId

transactionType

Get the type of the transaction (will return "deploy" or "execute")

transactionType() ► string
ParametersTypeDescription
returnstringTransaction type

transitions

Get the transitions in a transaction.

transitions()Array.<Transition>
ParametersTypeDescription
returnArray.<Transition>Array of transition objects

verifyingKeys

Get the verifying keys in a transaction.

verifyingKeys()Array.<Object>
ParametersTypeDescription
returnArray.<Object>Array of verifying keys.