BlockchainTransaction (for Cardano)
BlockchainTransaction[assoc]
represents a Cardano blockchain transaction built from the components in the association assoc.
Details
- Gives a symbolic representation of a Cardano blockchain transaction; it does not submit the transaction, and the transaction is not signed.
- BlockchainTransaction[…][prop] gives the value of the property prop for the transaction.
- The following elements must be given:
-
"Inputs" list of inputs, given as associations "Outputs" list of outputs, given as associations - The following additional elements can also be given:
-
"Fee" transaction fee "TimeToLive" upper-bound slot number for the transaction to be valid "Mint" list of tokens to be minted "Scripts" policy scripts "Metadata" metadata of tokens to be minted - Each association in the "Inputs" list must have the following entries:
-
"TransactionID" hash of a previous transaction "Index" index within the previous transaction output - The following additional entries must be given when spending a script:
-
"Datum" the script data corresponding to the (unhashed) datum of the previous transaction output "Redeemer" an association that specifies the input's redeemer (tag, redeemer script data, memory and steps) "Script" the script of the previous transaction output - The value for "Redeemer" within an association in the "Inputs" list must have the following entries:
-
"Tag" the redeemer's tag ("Spend") "Data" the redemeer's script data - The following additional entries can also be given:
-
"Memory" the script execution's CPU memory budget, expressed as an integer, or Automatic "Steps" the script execution's steps budget, expressed as an integer, or Automatic - When the entries "Memory" or "Steps" are not specified, their default value is Automatic.
- The value for "Datum" and the value for "Data" within "Redeemer" must use Cardano's detailed JSON schema. Script data can be a rule-based representation of Cardano's detailed JSON schema, or a script data file.
- The value for "Script" within an association in the "Inputs" list can be: a script JSON File, or an association with entries "Type" and "ByteCode".
- The value for "Script" within an association in the "Inputs" list can be: a script JSON File, or an association with entries "Type" and "ByteCode". The only supported value for "Type" is "PlutusScriptV1". The value for "ByteCode" must be a hex string corresponding to the CBOR representation of the script.
- Each association in the "Outputs" list must have the following entries:
-
"Address" the output's address "Amount" amount in lovelace - The value for "Address" can be either: a string, a script JSON file, or an association with entries "Type" and "ByteCode".
- When the value for "Address" is a Plutus script, the script address will be calculated automatically.
- The value for "Amount" can be either: a Quantity, or Automatic.
- When the value for "Amount" is Automatic, the value for "Fee" must be Automatic. There can only be one association in the "Outputs" list with "Amount" -> Automatic.
- The following additional entries can also be given:
-
"Tokens" list of input tokens - The value for "Tokens" can be either: a list of input tokens, or Automatic.
- The "Datum" association within an association in the "Outputs" list must have the following entries:
-
"Data" the datum's script data "Mode" the datum's inserting mode ("Hash") - The value for "Data" within an association in the "Outputs" list must be: a File containing script data, or an association that corresponds to importing script data as "RawJSON".
- Each association in the "Tokens" list must have the following entries:
-
"AssetName" asset name as a hex string "PolicyID" policy ID "Quantity" amount of tokens - The value for "Fee" can be either: Automatic or Quantity.
- When the value for "Fee" is Automatic, only one of the associations in the "Outputs" list can have "Amount" -> Automatic. In this case, the minimum required fee will be calculated and, if needed, any leftover cryptocurrency will be sent to the aforementioned output.
- Each association in the "Mint" list must have the following entries:
-
"AssetName" asset name given as a hex string "PolicyID" policy ID "Quantity" amount of tokens to be minted (burned if quantity is a negative number) - Each association in "CollateralInputs" list must have the following entries:
-
"TransactionID" hash of a previous transaction "Index" index within the previous transaction output - Associations in the "CollateralInputs" list must not point to an output with a script address. As well, the list can be at most of length 3.
- The values in the "RequiredSigners" list can be: a PublicKey, a PrivateKey, an address or a public key hash.
- BlockchainTransaction can represent transactions for Cardano mainnet and testnet "preprod", which is a new network for testing purposes. To specify these networks, use the "BlockchainBase" value inside the required association or the BlockchainBase option.
Examples
open allclose allBasic Examples (1)
Scope (8)
Default Values (2)
Minimum Required Fee (1)
Minting and Burning Tokens (2)
Metadata (1)
Deploy Plutus Scripts (1)
Spend Plutus Scripts (1)
Spend Plutus scripts using the "Redeemer", "Datum" and "Script" elements in the "Inputs" list, and specifying collateral inputs in "CollateralInputs":
Spend Plutus scripts that have required signers by specifying them either with: a PrivateKey object, a PublicKey object, an address, or a public key hash within the "RequiredSigners" list:

Once the transaction is signed, the transaction is fully serialized:
Options (2)
Applications (8)
Transfer Cryptocurrency (1)
Create a Cardano blockchain transaction to transfer ada cryptocurrency:
Sign the transaction with a PrivateKey object:
Mint Tokens (1)
Create a Cardano blockchain transaction to mint 1,000,000 tokens and send them to multiple addresses:
Alternatively, a single output is allowed to have "Amount" set to Automatic to have any remaining tokens sent to that address:
Sign the transaction with PrivateKey objects:
Submit the transaction to the Cardano blockchain to mint the tokens:
Mint NFT (1)
Generate an image to mint it as an NFT:
Upload the image to IPFS and save its CID:
Prepare the NFT metadata following the CIP 25 standard:
Create the Cardano blockchain transaction to mint the NFT:
Sign the transaction with PrivateKey objects:
Submit the transaction to the Cardano blockchain to mint the NFT:
Transfer Tokens (1)
Create a Cardano blockchain transaction to transfer tokens:
Sign the transaction with a PrivateKey object:
Burn Tokens (1)
Create a Cardano blockchain transaction to burn tokens:
Sign the transaction with a PrivateKey object:
Deploy Compiled Plutus Script (1)
Obtain a compiled Plutus script:
This particular script succeeds if, and only if, the redeemer's script data is a list of prime factors of the datum. For the datum, we choose 221 as an arbitrary semi-prime. Script data must conform to Cardano's detailed JSON schema:
Deploy Plutus scripts with a datum hash by specifying within the "Outputs" list: an "Address" pointing to a script file, a "Datum" with "Data" pointing to a script data file and using the "Hash" mode:
Sign the transaction with a PrivateKey object:
Spend Compiled Plutus Script (1)
Spend a Plutus script using the "Redeemer", "Datum" and "Script" elements in the "Inputs" list, and specifying collateral inputs in "CollateralInputs":
Notice that execution units were calculated automatically:
Sign the transaction with a PrivateKey object:
Spend Compiled Plutus Script with Required Signers (1)
Obtain a compiled Plutus script:
This particular script succeeds if, and only if, the spending transaction is signed by the private key associated with the public key hash included in the deployed datum:
Deploy a Plutus script with a datum hash by specifying within the "Outputs" list: an "Address" pointing to a script file, a "Datum" with "Data" pointing to a script data file and using the "Hash" mode:
Sign the transaction with a PrivateKey object:
Submit the transaction to the Cardano blockchain:
Spend Plutus scripts that have required signers by specifying them either with: a PrivateKey object, a PublicKey object, an address, or a public key hash within the "RequiredSigners" list:

When automatic execution units are requested and the script requires signers: calculation of required signers is delayed until the transaction is signed. Sign the transaction using a PrivateKey object:
The automatic execution units have now been calculated:
Properties & Relations (1)
An element of the "UTXOList" property of BlockchainAddressData can be used as an input in a Cardano blockchain transaction:
Text
Wolfram Research (2021), BlockchainTransaction, Wolfram Language function, https://reference.wolfram.com/language/ref/blockchain/BlockchainTransaction-Cardano.html.
CMS
Wolfram Language. 2021. "BlockchainTransaction." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/blockchain/BlockchainTransaction-Cardano.html.
APA
Wolfram Language. (2021). BlockchainTransaction. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/blockchain/BlockchainTransaction-Cardano.html