Transaction Commands
The tx command (or transactions) provides a complete workflow for managing Cardano transactions in Cshell. You can execute transactions using tx3 files, or work with individual steps of the transaction lifecycle.
Transaction Workflow
Understanding the transaction lifecycle:
- Write: Create a tx3 file describing your transaction
- Resolve: Convert tx3 to CBOR format (handled by TRP)
- Sign: Add cryptographic signatures using your wallet
- Submit: Send the transaction to the blockchain
The tx invoke command handles all these steps automatically, while individual commands let you control each step separately for advanced use cases.
Available Commands
tx invoke: Resolve, sign, and submit a tx3 transaction in one steptx construct: Build transactions interactively or programmaticallytx resolve: Resolve a tx3 transaction to CBORtx sign: Sign a CBOR transactiontx submit: Submit a CBOR transaction to the blockchain
tx invoke
The tx invoke command executes a complete transaction workflow: resolving a tx3 file, signing it with your wallet, and submitting it to the blockchain.
Usage
cshell tx invoke --tx3-file <path-to-tx3-file>Options
Run cshell tx invoke --help to see all available options.
Using with Different Provider
You can specify a different provider using flags:
cshell tx invoke --tx3-file ./transfer.tx3 --provider testnetHow it Works
When you run tx invoke, Cshell:
- Reads your tx3 file
- Resolves the transaction via your configured TRP server
- Signs the transaction using the appropriate wallet(s)
- Submits the signed transaction to the blockchain
- Returns the transaction hash
tx construct
The tx construct command provides tools for building transactions programmatically or interactively, offering more control than tx3 files for advanced use cases.
Available Subcommands
The construct command includes several subcommands:
cshell tx construct --helpWizard
Generate a tx3 transaction using an interactive wizard:
cshell tx construct wizardThe wizard guides you through the transaction creation process step by step, asking for inputs, outputs, and other transaction details.
Add Input
Add a UTxO input to a transaction:
cshell tx construct add-input --tx3-file <path-to-tx3-file>Options:
--tx3-file: Path to the final tx3 file used to identify current transaction (tx3 file will be created on build command)- Additional options available with
--help
Add Output
Add an output to a transaction:
cshell tx construct add-output --tx3-file <path-to-tx3-file>Options:
--tx3-file: Path to the final tx3 file used to identify current transaction (tx3 file will be created on build command)- Additional options for assets and datum with
--help
Build
Generate the tx3 file from accumulated inputs and outputs:
cshell tx construct build --tx3-file <path-to-tx3-file>This will take all the inputs/outputs you’ve added by add-input / add-output commands and create a complete tx3 file.
Workflow Example
Here’s a typical workflow for constructing a transaction manually:
# Start with the wizard to set up basic structurecshell tx construct wizard
# Or build step by step:
# 1. Add input UTxOcshell tx construct add-input --tx3-file my-transaction.tx3
# 2. Add outputcshell tx construct add-output --tx3-file my-transaction.tx3
# 3. Add change outputcshell tx construct add-output --tx3-file my-transaction.tx3
# 4. Build the transactioncshell tx construct build --tx3-file my-transaction.tx3Additional Help
Each subcommand has its own help documentation:
cshell tx construct wizard --helpcshell tx construct add-input --helpcshell tx construct add-output --helpcshell tx construct build --helptx resolve
The tx resolve command converts a tx3 file into CBOR format without signing or submitting it. This is useful for inspecting transaction details or preparing transactions for external signing.
Usage
cshell tx resolve --tx3-file <path-to-tx3-file>Options
Run cshell tx resolve --help to see all available options.
Examples
Basic Resolution
cshell tx resolve --tx3-file ./transfer.tx3This outputs the resolved CBOR transaction to stdout.
With Different Provider
cshell tx resolve --tx3-file ./transfer.tx3 --provider testnettx sign
The tx sign command signs a CBOR transaction with your wallet’s private keys, preparing it for submission to the blockchain.
Usage
cshell tx sign <unsigned-cbor>Options
Run cshell tx sign --help to see all available options.
Examples
Basic Signing
# Sign a resolved transactioncshell tx sign <unsigned-cbor>The signed transaction will be output to stdout.
Specify Output File
cshell tx sign <unsigned-cbor> > signed.cborSign with Specific Wallet
If you have multiple wallets, specify which one to use:
cshell tx sign <unsigned-cbor> --signer my-walletWorkflow
Typically used as part of a manual transaction workflow:
# 1. Resolve the transactioncshell tx resolve --tx3-file transfer.tx3
# 2. Sign the transactioncshell tx sign <unsigned-cbor>
# 3. Submit to blockchaincshell tx submit <signed-cbor>tx submit
The tx submit command broadcasts a signed CBOR transaction to the Cardano blockchain via your configured TRP provider.
Usage
cshell tx submit <signed-cbor>Options
Run cshell tx submit --help to see all available options.
Examples
Basic Submission
cshell tx submit <signed-cbor>Successful submission returns a transaction hash:
Submitted TX: <signed-cbor>TX Hash: 8f3a2b1c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2c3d4e5f6a7b8c9d0e1f2With Different Provider
Submit to a specific provider:
cshell tx submit <signed-cbor> --provider mainnetSave Transaction Hash
Capture the transaction hash for later reference:
cshell tx submit <signed-cbor> > tx-submit-result.txtComplete Workflow
Here’s the full manual transaction workflow:
# 1. Resolve transactioncshell tx resolve --tx3-file transfer.tx3
# 2. Sign transactioncshell tx sign <unsigned-cbor>
# 3. Submit to blockchaincshell tx submit <signed-cbor>
# 4. Monitor transaction (using the returned hash)cshell search transaction <tx-hash>Verifying Submission
After submitting, verify your transaction:
Using Cshell Explorer
# Open explorer and check recent transactionscshell explorerNavigate to the Transactions tab to see your submitted transaction.
Using Search Command
# Search by transaction hashcshell search transaction <tx-hash>Check Wallet Balance
# Verify balance changescshell wallet balance