# Understanding and building transactions on Aleo

By [Colliseum](https://paragraph.com/@colliseum) · 2025-08-15

---

My name is Heorhii, and in this guide, I will walk you through how transactions work on Aleo, how to create them, and how to check their status programmatically. If you are building on Aleo, mastering transactions is essential because they are the foundation for executing programs, deploying code, and transferring assets.

A transaction on Aleo represents a complete operation on the network. It can deploy a program, execute a function, or simply pay a fee. Every transaction is signed locally with your Aleo private key and then broadcast to the network. You can work with transactions using tools like the Leo CLI, the Provable SDK, or wallet adapters such as Puzzle Wallet SDK and Leo Wallet SDK.

[https://docs.explorer.provable.com/docs/sdk/92sd7hgph3ggt-overview](https://docs.explorer.provable.com/docs/sdk/92sd7hgph3ggt-overview)

**Types of transactions:**

**1\. Execute transaction.** An execution transaction represents a call to an Aleo program function.

**Structure of an execution transaction response:**

    type: string       # "execute"
    id: string         # Transaction ID (Merkle Tree digest of transition IDs)
    execution: object  # Execution transaction info
    fee: object        # Transaction fee
    

**Execution object details:**

*   `global_state_root` – The Merkle tree’s global state root
    
*   `transitions` – List of transitions executed
    
*   `proof` – The zero-knowledge proof of the execution
    

**Relationship between transactions and transitions:**

*   A transaction is the high-level container
    
*   A transition is a single state change
    
*   An execution contains one or more transitions
    

**Building an execution transaction with Leo CLI:**

    leo run <function_name> <args> \
      --network testnet \
      --private-key <your_private_key> \
      --broadcast true
    

Parameters:

*   **Required**: program ID, function name, arguments, network ID, private key
    
*   **Optional**: broadcast flag, private fees, priority fees
    

**_Example: Executing via Provable SDK_**

    import { AleoNetworkClient } from '@provablehq/sdk/testnet.js';
    
    const client = new AleoNetworkClient('https://api.explorer.provable.com/v1/testnet');
    const tx = await client.execute(
      'token_program_id.aleo',
      'mint_public',
      ['aleo1recipient...', '100u64'],
      '<private_key>',
      true
    );
    
    console.log('Transaction ID:', tx.id);
    

**2\. Deploy transaction.** A deployment transaction publishes an Aleo program to the network.

**Structure of a deployment transaction:**

    type: string       # "deploy"
    id: string         # Transaction ID
    owner: object      # Owner address and signature
    deployment: object # Deployment details
    fee: object        # Transaction fee
    

**Deployment object details:**

*   `global_state_root` – State root at deployment
    
*   `transitions` – Transitions created by deployment
    

**Deploying a program with Leo CLI:**

    leo deploy \
      --network testnet \
      --private-key <your_private_key> \
      --priority-fee 1000
    

**_Example: Deploying via Provable SDK_**

    import { AleoNetworkClient } from '@provablehq/sdk/testnet.js';
    import fs from 'fs';
    
    const client = new AleoNetworkClient('https://api.explorer.provable.com/v1/testnet');
    const programCode = fs.readFileSync('./build/program.aleo', 'utf8');
    
    const tx = await client.deploy(programCode, '<private_key>', true);
    console.log('Deployment Transaction ID:', tx.id);
    

**3\. Fee transaction.** A fee transaction is the payment for processing another transaction. If the execution or deployment fails, the fee is still processed as a separate confirmed transaction.

Fees can be public or private using Aleo Credits records.

[https://developer.aleo.org/concepts/fundamentals/transaction\_fees](https://developer.aleo.org/concepts/fundamentals/transaction_fees)

**_Example: Sending a standalone fee_**

    import { AleoNetworkClient } from '@provablehq/sdk/testnet.js';
    
    const client = new AleoNetworkClient('https://api.explorer.provable.com/v1/testnet');
    
    const feeTx = await client.sendFee(
      '<private_key>',
      '1000',        // fee amount in microcredits
      true           // broadcast
    );
    
    console.log('Fee Transaction ID:', feeTx.id);
    

**Transaction Lifecycle.** The lifecycle of a transaction looks like this:

1.  **Local creation.** Sign with your private key. Compile program and prepare inputs
    
2.  **Proof generation.** Generate ZK proof locally or via an external prover
    
3.  **Fee calculation.** Based on execution complexity and transaction size
    
4.  **Assembly.** Combine execution/deployment, fee, and proof
    
5.  **Broadcast.** Send to Aleo network
    
6.  **Mempool.** Transaction waits for validator inclusion
    
7.  **Consensus.** Validators confirm or reject
    
8.  **Finalization.** State is updated and synced
    

**Determining transaction status:**

**Method 1: Parsing transactions from blocks.**

Fetch a block:

    curl https://api.explorer.provable.com/v1/mainnet/block/{height}
    

Check:

*   `"status": "accepted"` → successful execution/deployment
    
*   `"status": "rejected"` → logic failed, fee still processed
    
*   `"aborted_transaction_ids"` → both execution and fee failed
    

**Method 2: Direct query.**

    curl https://api.explorer.provable.com/v1/mainnet/transaction/confirmed/{transaction_id}
    

Or via SDK:

    import { AleoNetworkClient } from '@provablehq/sdk/mainnet.js';
    
    const net  = new AleoNetworkClient('https://api.explorer.provable.com/v1');   
    const txId = 'your_transaction_id';                                
    const status = await net.getConfirmedTransaction(txId);
    console.log(status.status);
    

**Parsing the sender Address:**

    echo $transaction | jq '.execution.transitions[0].outputs[0].value'
    

You may need regex or line parsing since current outputs are returned as raw strings.

**_Example: Executing a private transfer._**\* \*Here’s how to run a private token transfer:

    leo run transfer_private aleo1recipient... 10u64 \
      --network testnet \
      --private-key <your_private_key> \
      --broadcast true
    

Check status:

    const status = await net.getConfirmedTransaction('<tx_id>');
    if (status.status === 'accepted') {
      console.log('Transaction confirmed');
    }
    

_More info you can find here:_

[https://developer.aleo.org/concepts/fundamentals/transactions](https://developer.aleo.org/concepts/fundamentals/transactions)

**Final thoughts.** Transactions are the heartbeat of Aleo’s private smart contract platform. Understanding their structure, lifecycle, and how to interact with them via CLI or SDK will make you a much more effective Aleo developer.

Whether you are deploying a new program, running an execution, or parsing on-chain data for your dApp, the principles above will help you confidently work with Aleo transactions.

[Subscribe](null)

_To know more about Aleo, join now!_

> *   _Aleo_ [_Twitter_](https://twitter.com/aleohq)
>     
> *   _Aleo_ [_Discord_](https://discord.gg/aleo)
>     
> *   _Aleo_ [_Website_](https://www.aleo.org/)
>     
> *   _List of_ [_Aleo and Leo code and resourses_](https://github.com/howardwu/awesome-aleo#%EF%B8%8F-a-curated-list-of-aleo--leo-code-and-resources-%EF%B8%8F)
>     

Prepared by Colliseum

---

*Originally published on [Colliseum](https://paragraph.com/@colliseum/understanding-and-building-transactions-on-aleo)*
