waves_logo Docs
  • Overview
    Overview
  • How-to Guides
    • Reading Blockchain Data
      Reading Blockchain Data
    • Creating & Broadcasting Transactions
      Creating & Broadcasting Transactions
    • Tokenization
      Tokenization
    • Airdrop
      Airdrop
    • Payments
      Payments
    • Exchange Tokens
      Exchange Tokens
    • Simple Voting
      Simple Voting
    • List as argument
      List as argument
    How-to Guides
  • Waves Smart Contracts
    Waves Smart Contracts
  • dApp
    • Creating & Launching dApp
      Creating & Launching dApp
    dApp
  • Smart Account
    • Creating smart account
      Creating smart account
    • Creating and deploying a script manually
      Creating and deploying a script manually
    • Video tutorials
      • Introduction to the Waves blockchain, Waves Smart Accounts and Waves Smart Assets
        Introduction to the Waves blockchain, Waves Smart Accounts and Waves Smart Assets
      • Waves Smart Account with multisignature
        Waves Smart Account with multisignature
      • Waves Smart Account with escrow service
        Waves Smart Account with escrow service
      • Creating multisignature account via Waves IDE tools
        Creating multisignature account via Waves IDE tools
      • Creating multisignature account via Waves Client
        Creating multisignature account via Waves Client
      • Waves console explained
        Waves console explained
      Video tutorials
    Smart Account
  • Smart Asset
    Smart Asset
  • Developer Tools
    • Waves IDE
      Waves IDE
    • Visual Studio Code Extension
      Visual Studio Code Extension
    • Surfboard
      Surfboard
    • Ride REPL
      Ride REPL
    Developer Tools
  • Signer ◆
    Signer ◆
  • Waves API
    • Data Service API
      Data Service API
    • Node REST API
      Node REST API
    • Node gRPC Server
      Node gRPC Server
    • Blockchain Updates
      Blockchain Updates
    Waves API
  • Client Libraries
    • Waves C#
      • Install SDK
        Install SDK
      • Run Code Sample
        • Send Transactions
          Send Transactions
        • Use Crypto Utilities
          Use Crypto Utilities
        • Interact With Node
          Interact With Node
        • Set Up Smart Contracts
          Set Up Smart Contracts
        Run Code Sample
      Waves C#
    • Gowaves
      • Install SDK
        Install SDK
      • Run Code Sample
        • Send Transactions
          Send Transactions
        • Use Crypto Utilities
          Use Crypto Utilities
        • Interact With Node
          Interact With Node
        • Set Up Smart Contracts
          Set Up Smart Contracts
        Run Code Sample
      Gowaves
    • WavesJ
      • Install SDK
        Install SDK
      • Run Code Sample
        • Send Transactions
          Send Transactions
        • Use Crypto Utilities
          Use Crypto Utilities
        • Interact With Node
          Interact With Node
        • Set Up Smart Contracts
          Set Up Smart Contracts
        Run Code Sample
      WavesJ
    • Ts-lib-crypto
      • Install SDK
        Install SDK
      Ts-lib-crypto
    • Waves-PHP
      • Install SDK
        Install SDK
      Waves-PHP
    • PyWaves-CE
      • Install SDK
        Install SDK
      PyWaves-CE
    • Waves-rust
      • Install SDK
        Install SDK
      Waves-rust
    Client Libraries
      • English
      • Русский
      On this page
        • Prerequisites
        • Tutorial
      waves_logo Docs

          # Send Transactions

          Send transactions after meeting the prerequisites.

          # Prerequisites

          • Wallet: Set up a wallet via Keeper Wallet or WX Network .

            NOTE: Ensure saving your wallet's seed phrase to send transactions.

          • Tokens: Obtain WAVES tokens to cover each transaction's fee:
            • For the Mainnet network: Get at least 0.001 WAVES via Available Market Options .
            • For the Testnet network: Get at least 0.001 WAVES via Faucet .
            • For the Stagenet network: Get at least 0.001 WAVES via Faucet .

          # Tutorial

          Follow the instructions for the transaction type you want to send:

          • Issue.
          • Reissue.
          • Burn.
          • Transfer.
          • Mass Transfer.
          • Exchange.
          • Lease.
          • Lease Cancel.
          • Create Alias.
          • Data.
          • Set Script.
          • Set Asset Script.
          • Update Asset Info.
          • Invoke Script.
          • Sponsor Fee.

          # Issue

          About Issue Transaction.

          In your project directory:

          1. Replace the Main.java file code with the following snippet:
            package com.example;
            
            // Necessary imports.
            import com.wavesplatform.transactions.IssueTransaction;
            import com.wavesplatform.transactions.account.PrivateKey;
            import com.wavesplatform.transactions.account.Address;
            import com.wavesplatform.transactions.common.ChainId;
            import com.wavesplatform.transactions.common.Base64String;
            import com.wavesplatform.wavesj.Node;
            import com.wavesplatform.wavesj.ScriptInfo;
            
            public class IssueTx {
                public static void main(String[] args) throws Exception {
                    // Specify an accout seed phrase.
                    String seedPhrase = "PASTE YOUR SEED PHRASE";
            
                    // Generate private key.
                    PrivateKey privateKey = PrivateKey.fromSeed(seedPhrase);
            
                    /* 
                     * Specify the network chain ID:
                     * - Mainnet: `MAINNET`
                     * - Testnet: `TESTNET`
                     * - Stagenet: `STAGENET`
                     */
                    byte networkChainId = ChainId.TESTNET;
            
                    /*
                     * Specify the link for the same network as mentioned above:
                     * - Mainnet: "https://nodes.wavesnodes.com/"
                     * - Testnet: "https://nodes-testnet.wavesnodes.com/"
                     * - Stagenet: "https://nodes-stagenet.wavesnodes.com/"
                     */
                    Node node = new Node("https://nodes-testnet.wavesnodes.com");
            
                    // Specify a Ride script of the asset.
                    String scriptSource = 
                        "{-# STDLIB_VERSION 6 #-}\n" +
                        "{-# CONTENT_TYPE EXPRESSION #-}\n" +
                        "{-# SCRIPT_TYPE ASSET #-}\n\n" +
                        "func trueReturner() = {\n" +
                        "    true\n" +
                        "}\n\n" +
                        "trueReturner()"; // Ride script example.
            
                    // Compile the Ride script.
                    ScriptInfo compiled = node.compileScript(scriptSource);
            
                    // Get compiled script as a base64 string.
                    Base64String scriptBase64 = compiled.script();
            
                    // Build the Issue Transaction.
                    IssueTransaction tx = IssueTransaction
                        .builder(
                            "TOKEN_NAME",                 // Token name.
                            1_00000000L,                  // Total supply in the smallest units. E.g. `1_00000000L` for 1 token unit.
                            (byte)8                       // Number of decimals.
                        )
                        .description("TOKEN_DESCRIPTION") // Token description.
                        .isReissuable(true)               // Flag indicating whether the asset is reissuable.
                        .fee(1_00000000L)                 // Transaction fee in the smallest units. E.g. `1_00000000L` for 1 WAVES.
                        .chainId(networkChainId)          // Network chain ID.
                        .script(scriptBase64)             // Compiled script.
                        .getSignedWith(privateKey);       // Sender's private key.
            
                    // Broadcast the transaction to the node.
                    node.broadcast(tx);
            
                    // Set the timeout to ensure the transaction has appeared on the blockchain.
                    Thread.sleep(5000);
            
                    // Get the information about the transaction from the node.
                    Address address = Address.from(networkChainId, privateKey.publicKey());
                    System.out.println("Address: " + address);
                    System.out.println("Transaction ID: " + tx.id());
                    System.out.println("Transaction JSON: " + tx.toJson());
                }
            }
            
          2. In the Main.java file, run the IssueTx class.

          # Reissue

          About Reissue Transaction.

          NOTE: You can reissue only those asset that were issued by you with the reissuable flag set to true.

          In your project directory:

          1. Replace the Main.java file code with the following snippet:
            package com.example;
            
            // Necessary imports.
            import java.time.Instant;
            import com.wavesplatform.transactions.ReissueTransaction;
            import com.wavesplatform.transactions.account.PrivateKey;
            import com.wavesplatform.transactions.account.Address;
            import com.wavesplatform.transactions.common.ChainId;
            import com.wavesplatform.transactions.common.AssetId;
            import com.wavesplatform.transactions.common.Amount;
            import com.wavesplatform.wavesj.Node;
            
            public class ReissueTx {
                public static void main(String[] args) throws Exception {
                    // Specify an account seed phrase.
                    String seedPhrase = "PASTE YOUR SEED PHRASE";
            
                    // Generate the private key from the seed phrase.
                    PrivateKey privateKey = PrivateKey.fromSeed(seedPhrase);
            
                    /* 
                     * Specify the network chain ID:
                     * - Mainnet: `MAINNET`
                     * - Testnet: `TESTNET`
                     * - Stagenet: `STAGENET`
                     */
                    byte networkChainId = ChainId.TESTNET;
            
                    /*
                     * Specify the link for the same network as mentioned above:
                     * - Mainnet: "https://nodes.wavesnodes.com/"
                     * - Testnet: "https://nodes-testnet.wavesnodes.com/"
                     * - Stagenet: "https://nodes-stagenet.wavesnodes.com/"
                     */
                    Node node = new Node("https://nodes-testnet.wavesnodes.com");
            
                    // Define the ID of an asset issued by you.
                    AssetId assetId = AssetId.as("PASTE AN ASSET ID");
            
                    // Define token amount to reissue in the smallest unit.
                    Amount amount = new Amount(100000000L, assetId); // E.g. `100000000L` for 1 token.
            
                    // Build the Reissue Transaction.
                    ReissueTransaction tx = ReissueTransaction
                        .builder(amount)                         // Amount to reissue.
                        .fee(100000L)                            // Transaction fee in WAVES.
                        .timestamp(Instant.now().toEpochMilli()) // Timestamp.
                        .chainId(networkChainId)                 // Chain ID.
                        .getSignedWith(privateKey);              // Sender's private key.
            
                    // Broadcast the transaction to the node.
                    node.broadcast(tx);
            
                    // Set the timeout to ensure the transaction has appeared on the blockchain.
                    Thread.sleep(5000);
            
                    // Get the information about the transaction from the node.
                    Address address = Address.from(networkChainId, privateKey.publicKey());
                    System.out.println("Address: " + address);
                    System.out.println("Transaction ID: " + tx.id());
                    System.out.println("Transaction JSON: " + tx.toJson());
                }
            }
            
          2. In the Main.java file, run the ReissueTx class.

          # Burn

          About Burn Transaction.

          In your project directory:

          1. Replace the Main.java file code with the following snippet:
            package com.example;
            
            // Necessary imports.
            import java.time.Instant;
            import com.wavesplatform.transactions.BurnTransaction;
            import com.wavesplatform.transactions.account.PrivateKey;
            import com.wavesplatform.transactions.account.Address;
            import com.wavesplatform.transactions.common.ChainId;
            import com.wavesplatform.transactions.common.AssetId;
            import com.wavesplatform.transactions.common.Amount;
            import com.wavesplatform.wavesj.Node;
            
            public class BurnTx {
                public static void main(String[] args) throws Exception {
                    // Specify an account seed phrase.
                    String seedPhrase = "PASTE YOUR SEED PHRASE";
            
                    // Generate the private key from the seed phrase.
                    PrivateKey privateKey = PrivateKey.fromSeed(seedPhrase);
            
                    /* 
                     * Specify the network chain ID:
                     * - Mainnet: `MAINNET`
                     * - Testnet: `TESTNET`
                     * - Stagenet: `STAGENET`
                     */
                    byte networkChainId = ChainId.TESTNET;
            
                    /*
                     * Specify the link for the same network as mentioned above:
                     * - Mainnet: "https://nodes.wavesnodes.com/"
                     * - Testnet: "https://nodes-testnet.wavesnodes.com/"
                     * - Stagenet: "https://nodes-stagenet.wavesnodes.com/"
                     */
                    Node node = new Node("https://nodes-testnet.wavesnodes.com");
            
                    // Define the ID of the asset to burn.
                    AssetId assetId = AssetId.as("PASTE AN ASSET ID");
            
                    // Define the amount to burn in the smallest unit.
                    Amount amount = new Amount(100000000L, assetId); // E.g. `100000000L` for 1 token.
            
                    // Build the Burn Transaction.
                    BurnTransaction tx = BurnTransaction
                        .builder(amount)                         // Burn amount.
                        .fee(100000L)                            // Transaction fee in WAVES.
                        .timestamp(Instant.now().toEpochMilli()) // Timestamp.
                        .chainId(networkChainId)                 // Chain ID.
                        .getSignedWith(privateKey);              // Sender's private key.
            
                    // Broadcast the transaction to the node.
                    node.broadcast(tx);
            
                    // Set the timeout to ensure the transaction has appeared on the blockchain.
                    Thread.sleep(5000);
            
                    // Get the information about the transaction from the node.
                    Address address = Address.from(networkChainId, privateKey.publicKey());
                    System.out.println("Address: " + address);
                    System.out.println("Transaction ID: " + tx.id());
                    System.out.println("Transaction JSON: " + tx.toJson());
                }
            }
            
          2. In the Main.java file, run the BurnTx class.

          # Transfer

          About Transfer Transaction.

          In your project directory:

          1. Replace the Main.java file code with the following snippet:
            package com.example;
            
            // Necessary imports.
            import java.time.Instant;
            import com.wavesplatform.transactions.TransferTransaction;
            import com.wavesplatform.transactions.account.PrivateKey;
            import com.wavesplatform.transactions.account.Address;
            import com.wavesplatform.transactions.common.ChainId;
            import com.wavesplatform.transactions.common.AssetId;
            import com.wavesplatform.transactions.common.Amount;
            import com.wavesplatform.wavesj.Node;
            
            public class TransferTx {
                public static void main(String[] args) throws Exception {
                    // Specify an account seed phrase.
                    String seedPhrase = "PASTE YOUR SEED PHRASE";
            
                    // Generate the private key from the seed phrase.
                    PrivateKey privateKey = PrivateKey.fromSeed(seedPhrase);
            
                    /* 
                     * Specify the network chain ID:
                     * - Mainnet: `MAINNET`
                     * - Testnet: `TESTNET`
                     * - Stagenet: `STAGENET`
                     */
                    byte networkChainId = ChainId.TESTNET;
            
                    /*
                     * Specify the link for the same network as mentioned above:
                     * - Mainnet: "https://nodes.wavesnodes.com/"
                     * - Testnet: "https://nodes-testnet.wavesnodes.com/"
                     * - Stagenet: "https://nodes-stagenet.wavesnodes.com/"
                     */
                    Node node = new Node("https://nodes-testnet.wavesnodes.com");
            
                    // Define a recipient address.
                    Address recipient = Address.as("PASTE A RECIPIENT ADDRESS");
            
                    /* 
                     * Define the transfer asset:
                     * - Use `AssetId.WAVES` for WAVES.
                     * - Or specify a custom asset ID.
                     */
                    AssetId assetId = AssetId.as("PASTE AN ASSET ID");
            
                    // Define the amount to transfer in the smallest unit.
                    Amount amount = new Amount(100000000L, assetId); // E.g. `100000000L` for 1 token.
            
                    // Build the Transfer Transaction.
                    TransferTransaction tx = TransferTransaction
                        .builder(recipient, amount)              // Recipient address and transfer amount.
                        .fee(100000L)                            // Transaction fee in WAVES.
                        .timestamp(Instant.now().toEpochMilli()) // Timestamp.
                        .chainId(networkChainId)                 // Chain ID.
                        .getSignedWith(privateKey);              // Sender's private key.
            
                    // Broadcast the transaction to the node.
                    node.broadcast(tx);
            
                    // Set the timeout to ensure the transaction has appeared on the blockchain.
                    Thread.sleep(5000);
            
                    // Get the information about the transaction from the node.
                    Address address = Address.from(networkChainId, privateKey.publicKey());
                    System.out.println("Sender Address: " + address);
                    System.out.println("Transaction ID: " + tx.id());
                    System.out.println("Transaction JSON: " + tx.toJson());
                }
            }
            
          2. In the Main.java file, run the TransferTx class.

          # Mass Transfer

          About Mass Transfer Transaction.

          In your project directory:

          1. Replace the Main.java file code with the following snippet:
            package com.example;
            
            // Necessary imports.
            import java.time.Instant;
            import java.util.Arrays;
            import com.wavesplatform.transactions.MassTransferTransaction;
            import com.wavesplatform.transactions.mass.Transfer;
            import com.wavesplatform.transactions.account.PrivateKey;
            import com.wavesplatform.transactions.account.Address;
            import com.wavesplatform.transactions.common.ChainId;
            import com.wavesplatform.transactions.common.AssetId;
            import com.wavesplatform.wavesj.Node;
            
            public class MassTransferTx {
                public static void main(String[] args) throws Exception {
                    // Specify an account seed phrase.
                    String seedPhrase = "PASTE YOUR SEED PHRASE";
            
                    // Generate the private key from the seed phrase.
                    PrivateKey privateKey = PrivateKey.fromSeed(seedPhrase);
            
                    /* 
                     * Specify the network chain ID:
                     * - Mainnet: `MAINNET`
                     * - Testnet: `TESTNET`
                     * - Stagenet: `STAGENET`
                     */
                    byte networkChainId = ChainId.TESTNET;
            
                    /*
                     * Specify the link for the same network as mentioned above:
                     * - Mainnet: "https://nodes.wavesnodes.com/"
                     * - Testnet: "https://nodes-testnet.wavesnodes.com/"
                     * - Stagenet: "https://nodes-stagenet.wavesnodes.com/"
                     */
                    Node node = new Node("https://nodes-testnet.wavesnodes.com");
            
                    // Define recipient addresses.
                    Address recipient1 = Address.as("PASTE 1ST RECIPIENT ADDRESS");
                    Address recipient2 = Address.as("PASTE 2ND RECIPIENT ADDRESS");
            
                    /* 
                     * Define the transfer asset:
                     * - Use `AssetId.WAVES` for WAVES.
                     * - Or specify a custom asset ID.
                     */
                    AssetId assetId = AssetId.as("PASTE AN ASSET ID");
            
                    // Define the transfer amount for each recipient.
                    Transfer t1 = Transfer.to(recipient1, 100000000L); // E.g. `100000000L` for 1 token.
                    Transfer t2 = Transfer.to(recipient2, 200000000L); // E.g. `200000000L` for 2 tokens.
            
                    // Build the Mass Transfer Transaction.
                    MassTransferTransaction tx = MassTransferTransaction
                        .builder(Arrays.asList(t1, t2))          // Array of recipients and their transfer amounts.
                        .assetId(assetId)                        // Transfer asset ID.
                        .fee(300000L)                            // Transaction fee in WAVES.
                        .timestamp(Instant.now().toEpochMilli()) // Timestamp.
                        .chainId(networkChainId)                 // Chain ID.
                        .getSignedWith(privateKey);              // Sender's private key.
            
                    // Broadcast the transaction to the node.
                    node.broadcast(tx);
            
                    // Set the timeout to ensure the transaction has appeared on the blockchain.
                    Thread.sleep(5000);
            
                    // Get the information about the transaction from the node.
                    Address address = Address.from(networkChainId, privateKey.publicKey());
                    System.out.println("Sender Address: " + address);
                    System.out.println("Transaction ID: " + tx.id());
                    System.out.println("Transaction JSON: " + tx.toJson());
                }
            }
            
          2. In the Main.java file, run the MassTransferTx class.

          # Exchange

          About Exchange Transaction.

          In your project directory:

          1. Replace the Main.java file code with the following snippet:
            
            package com.example;
            
            // Necessary imports.
            import java.time.Instant;
            import com.wavesplatform.transactions.ExchangeTransaction;
            import com.wavesplatform.transactions.exchange.Order;
            import com.wavesplatform.transactions.exchange.OrderType;
            import com.wavesplatform.transactions.account.PrivateKey;
            import com.wavesplatform.transactions.account.Address;
            import com.wavesplatform.transactions.common.ChainId;
            import com.wavesplatform.transactions.common.AssetId;
            import com.wavesplatform.transactions.common.Amount;
            import com.wavesplatform.wavesj.Node;
            
            public class ExchangeTx {
                public static void main(String[] args) throws Exception {
                    // Specify an account seed phrase.
                    String seedPhrase = "PASTE YOUR SEED PHRASE";
            
                    // Generate the private key from the seed phrase.
                    PrivateKey privateKey = PrivateKey.fromSeed(seedPhrase);
            
                    /* 
                     * Specify the network chain ID:
                     * - Mainnet: `MAINNET`
                     * - Testnet: `TESTNET`
                     * - Stagenet: `STAGENET`
                     */
                    byte networkChainId = ChainId.TESTNET;
            
                    /*
                     * Specify the link for the same network as mentioned above:
                     * - Mainnet: "https://nodes.wavesnodes.com/"
                     * - Testnet: "https://nodes-testnet.wavesnodes.com/"
                     * - Stagenet: "https://nodes-stagenet.wavesnodes.com/"
                     */
                    Node node = new Node("https://nodes-testnet.wavesnodes.com");
            
                    // Define the ID of an asset to be exchanged.
                    AssetId assetId = AssetId.as("PASTE AN ASSET ID");
            
                    // Define the exchange amount and price.
                    Amount amount = new Amount(100000000L);       // Amount to exchange in the smallest unit. E.g. `100000000L` for 1 token.
                    Amount price = new Amount(1000000L, assetId); // Price per token in the smallest unit. E.g. `1000000L` for 0.01 WAVES.
            
                    // Matcher fee for buyer and seller.
                    long matcherFee = 300000; //  Matcher fee. E.g. `300000L` for 0.003 WAVES.
            
                    // Build buy and sell orders (same key used for both sides in this example).
                    Order buy = Order.builder(OrderType.BUY, amount, price, privateKey.publicKey())  // Buy order: willing to pay `price` for `amount`.
                        .getSignedWith(privateKey);
            
                    Order sell = Order.builder(OrderType.SELL, amount, price, privateKey.publicKey()) // Sell order: offers `amount` for `price`.
                        .getSignedWith(privateKey);
            
                    // Build the Exchange Transaction.
                    ExchangeTransaction tx = ExchangeTransaction
                        .builder(
                            buy,                                 // Buy order.
                            sell,                                // Sell order.
                            amount.value(),                      // Actual amount to exchange (must not exceed order amounts).
                            price.value(),                       // Agreed price (must match both orders).
                            matcherFee,                          // Buy-side matcher fee (partial or full).
                            matcherFee                           // Sell-side matcher fee (partial or full).
                        )
                        .fee(300000L)                            // Exchange transaction fee.
                        .timestamp(Instant.now().toEpochMilli()) // Timestamp.
                        .chainId(networkChainId)                 // Chain ID.
                        .getSignedWith(privateKey);              // Sender's private key.
            
                    // Broadcast the transaction to the node.
                    node.broadcast(tx);
            
                    // Set the timeout to ensure the transaction has appeared on the blockchain.
                    Thread.sleep(5000);
            
                    // Get the information about the transaction from the node.
                    Address address = Address.from(networkChainId, privateKey.publicKey());
                    System.out.println("Sender Address: " + address);
                    System.out.println("Transaction ID: " + tx.id());
                    System.out.println("Transaction JSON: " + tx.toJson());
                }
            }
            
          2. In the Main.java file, run the ExchangeTx class.

          # Lease

          About Lease Transaction.

          In your project directory:

          1. Replace the Main.java file code with the following snippet:
            package com.example;
            
            import java.time.Instant;
            
            // Necessary imports.
            import com.wavesplatform.transactions.LeaseTransaction;
            import com.wavesplatform.transactions.account.PrivateKey;
            import com.wavesplatform.transactions.account.Address;
            import com.wavesplatform.transactions.common.ChainId;
            import com.wavesplatform.wavesj.Node;
            
            public class LeaseTx {
                public static void main(String[] args) throws Exception {
                    // Specify an account seed phrase.
                    String seedPhrase = "PASTE YOUR SEED PHRASE";
            
                    // Generate the private key from the seed phrase.
                    PrivateKey privateKey = PrivateKey.fromSeed(seedPhrase);
                    
                    /* 
                     * Specify the network chain ID:
                     * - Mainnet: `MAINNET`
                     * - Testnet: `TESTNET`
                     * - Stagenet: `STAGENET`
                     */
                    byte networkChainId = ChainId.TESTNET;
            
                    /*
                     * Specify the link for the same network as mentioned above:
                     * - Mainnet: "https://nodes.wavesnodes.com/"
                     * - Testnet: "https://nodes-testnet.wavesnodes.com/"
                     * - Stagenet: "https://nodes-stagenet.wavesnodes.com/"
                     */
                    Node node = new Node("https://nodes-testnet.wavesnodes.com");
                    
                    // Define the recipient address.
                    Address recipient = Address.as("PASTE RECIPIENT ADDRESS");
            
                    // Build the Lease Transaction.
                    LeaseTransaction tx = LeaseTransaction
                        .builder(recipient, 100000000L)          // Leasing amount. E.g. `100000000L` for 1 WAVES.
                        .fee(100000L)                            // Transaction fee. E.g. `100000L` for 0.001 WAVES.
                        .timestamp(Instant.now().toEpochMilli()) // Timestamp.
                        .chainId(networkChainId)                 // Chain ID.
                        .getSignedWith(privateKey);              // Sender's private key.
            
                    // Broadcast the transaction to the node.
                    node.broadcast(tx);
            
                    // Set the timeout to ensure the transaction has appeared on the blockchain.
                    Thread.sleep(5000);
            
                    // Get the information about the transaction from the node.
                    Address address = Address.from(networkChainId, privateKey.publicKey());
                    System.out.println("Sender Address: " + address);
                    System.out.println("Transaction ID: " + tx.id());
                    System.out.println("Transaction JSON: " + tx.toJson());
                }
            }
            
          2. In the Main.java file, run the LeaseTx class.

          # Lease Cancel

          About Lease Cancel Transaction.

          In your project directory:

          1. Replace the Main.java file code with the following snippet:
            package com.example;
            
            // Necessary imports.
            import java.time.Instant;
            import com.wavesplatform.transactions.LeaseCancelTransaction;
            import com.wavesplatform.transactions.account.PrivateKey;
            import com.wavesplatform.transactions.account.Address;
            import com.wavesplatform.transactions.common.ChainId;
            import com.wavesplatform.crypto.base.Base58;
            import com.wavesplatform.transactions.common.Id;  
            import com.wavesplatform.wavesj.Node;
            
            public class LeaseCancelTx {
                public static void main(String[] args) throws Exception {
                    // Specify an accout seed phrase.
                    String seedPhrase = "PASTE YOUR SEED PHRASE";
            
                    // Generate the private key from the seed phrase.
                    PrivateKey privateKey = PrivateKey.fromSeed(seedPhrase);
            
                    /* 
                     * Specify the network chain ID:
                     * - Mainnet: `MAINNET`
                     * - Testnet: `TESTNET`
                     * - Stagenet: `STAGENET`
                     */
                    byte networkChainId = ChainId.TESTNET;
            
                    /*
                     * Specify the link for the same network as mentioned above:
                     * - Mainnet: "https://nodes.wavesnodes.com/"
                     * - Testnet: "https://nodes-testnet.wavesnodes.com/"
                     * - Stagenet: "https://nodes-stagenet.wavesnodes.com/"
                     */
                    Node node = new Node("https://nodes-testnet.wavesnodes.com");
            
                    // Specify a Lease Transaction ID.
                    String leaseIdString = "PASTE A LEASE TRANSACTION ID";
                    byte[] leaseIdBytes = Base58.decode(leaseIdString);
                    Id leaseId = new Id(leaseIdBytes);
            
                    // Build the Lease Cancel Transaction.
                    LeaseCancelTransaction tx = LeaseCancelTransaction
                        .builder(leaseId)                         // Lease Transaction ID to cancel.
                        .fee(100000L)                             // Transaction fee. E.g. `100000L` for 0.001 WAVES.
                        .timestamp(Instant.now().toEpochMilli())  // Timestamp.
                        .chainId(networkChainId)                  // Chain ID.
                        .getSignedWith(privateKey);               // Sender's private key.
            
                    // Broadcast the transaction to the node.
                    node.broadcast(tx);
            
                    // Set the timeout to ensure the transaction has appeared on the blockchain.
                    Thread.sleep(5000);
            
                    // Get the information about the transaction from the node.
                    Address address = Address.from(networkChainId, privateKey.publicKey());
                    System.out.println("Sender Address: " + address);
                    System.out.println("Transaction ID (Base58): " + tx.id());
                    System.out.println("Transaction JSON: " + tx.toJson());
                }
            }
            
          2. In the Main.java file, run the LeaseCancelTx class.

          # Create Alias

          About Create Alias Transaction.

          In your project directory:

          1. Replace the Main.java file code with the following snippet:
            package com.example;
            
            // Necessary imports.
            import java.time.Instant;
            import com.wavesplatform.transactions.CreateAliasTransaction;
            import com.wavesplatform.transactions.account.PrivateKey;
            import com.wavesplatform.transactions.account.Address;
            import com.wavesplatform.transactions.common.ChainId;
            import com.wavesplatform.wavesj.Node;
            
            public class CreateAliasTx {
                public static void main(String[] args) throws Exception {
                    // Specify an account seed phrase.
                    String seedPhrase = "PASTE YOUR SEED PHRASE";
            
                    // Generate the private key from the seed phrase.
                    PrivateKey privateKey = PrivateKey.fromSeed(seedPhrase);
            
                    /* 
                     * Specify the network chain ID:
                     * - Mainnet: `MAINNET`
                     * - Testnet: `TESTNET`
                     * - Stagenet: `STAGENET`
                     */
                    byte networkChainId = ChainId.TESTNET;
            
                    /*
                     * Specify the link for the same network as mentioned above:
                     * - Mainnet: "https://nodes.wavesnodes.com/"
                     * - Testnet: "https://nodes-testnet.wavesnodes.com/"
                     * - Stagenet: "https://nodes-stagenet.wavesnodes.com/"
                     */
                    Node node = new Node("https://nodes-testnet.wavesnodes.com");
            
                    // Define the alias to register. Must be lowercase and alphanumeric.
                    String alias = "youralias"; // Alias example.
            
                    // Build the Create Alias Transaction.
                    CreateAliasTransaction tx = CreateAliasTransaction
                        .builder(alias)                          // Alias.
                        .fee(100000L)                            // Transaction fee. E.g. `100000L` for 0.001 WAVES.
                        .timestamp(Instant.now().toEpochMilli()) // Timestamp.
                        .chainId(networkChainId)                 // Chain ID.
                        .getSignedWith(privateKey);              // Sender's private key.
            
                    // Broadcast the transaction to the node.
                    node.broadcast(tx);
            
                    // Set the timeout to ensure the transaction has appeared on the blockchain.
                    Thread.sleep(5000);
            
                    // Get the information about the transaction from the node.
                    Address address = Address.from(networkChainId, privateKey.publicKey());
                    System.out.println("Sender Address: " + address);
                    System.out.println("Alias: " + alias);
                    System.out.println("Transaction ID: " + tx.id());
                    System.out.println("Transaction JSON: " + tx.toJson());
                }
            }
            
          2. In the Main.java file, run the CreateAliasTx class.

          # Data

          About Data Transaction.

          In your project directory:

          1. Replace the Main.java file code with the following snippet:
            package com.example;
            
            // Necessary imports.
            import java.time.Instant;
            import java.util.Arrays;
            import com.wavesplatform.transactions.DataTransaction;
            import com.wavesplatform.transactions.data.BooleanEntry;
            import com.wavesplatform.transactions.data.IntegerEntry;
            import com.wavesplatform.transactions.data.StringEntry;
            import com.wavesplatform.transactions.data.DataEntry;
            import com.wavesplatform.transactions.account.PrivateKey;
            import com.wavesplatform.transactions.account.Address;
            import com.wavesplatform.transactions.common.ChainId;
            import com.wavesplatform.wavesj.Node;
            
            public class DataTx {
                public static void main(String[] args) throws Exception {
                    // Specify an account seed phrase.
                    String seedPhrase = "PASTE YOUR SEED PHRASE";
            
                    // Generate the private key from the seed phrase.
                    PrivateKey privateKey = PrivateKey.fromSeed(seedPhrase);
            
                    /* 
                     * Specify the network chain ID:
                     * - Mainnet: `MAINNET`
                     * - Testnet: `TESTNET`
                     * - Stagenet: `STAGENET`
                     */
                    byte networkChainId = ChainId.TESTNET;
            
                    /*
                     * Specify the link for the same network as mentioned above:
                     * - Mainnet: "https://nodes.wavesnodes.com/"
                     * - Testnet: "https://nodes-testnet.wavesnodes.com/"
                     * - Stagenet: "https://nodes-stagenet.wavesnodes.com/"
                     */
                    Node node = new Node("https://nodes-testnet.wavesnodes.com");
            
                    // Define data entries.
                    DataEntry intEntry = new IntegerEntry("counter", 123);          // Integer key-value pair.
                    DataEntry boolEntry = new BooleanEntry("flag", true);           // Boolean key-value pair.
                    DataEntry strEntry = new StringEntry("message", "Hello Waves"); // String key-value pair.
            
                    // Build the Data Transaction.
                    DataTransaction tx = DataTransaction
                        .builder(Arrays.asList(intEntry, boolEntry, strEntry)) // List of data entries.
                        .fee(100000L)                                      // Transaction fee. E.g. `100000L` for 0.001 WAVES.
                        .timestamp(Instant.now().toEpochMilli())               // Timestamp.
                        .chainId(networkChainId)                               // Chain ID.
                        .getSignedWith(privateKey);                            // Sender's private key.
            
                    // Broadcast the transaction to the node.
                    node.broadcast(tx);
            
                    // Set the timeout to ensure the transaction has appeared on the blockchain.
                    Thread.sleep(5000);
            
                    // Get the information about the transaction from the node.
                    Address address = Address.from(networkChainId, privateKey.publicKey());
                    System.out.println("Sender Address: " + address);
                    System.out.println("Transaction ID: " + tx.id());
                    System.out.println("Transaction JSON: " + tx.toJson());
                }
            }
            
          2. In the Main.java file, run the DataTx class.

          # Set Script

          About Set Script Transaction.

          In your project directory:

          1. Replace the Main.java file code with the following snippet:
            package com.example;
            
            // Necessary imports.
            import java.time.Instant;
            import com.wavesplatform.transactions.SetScriptTransaction;
            import com.wavesplatform.transactions.common.Base64String;
            import com.wavesplatform.transactions.account.PrivateKey;
            import com.wavesplatform.transactions.account.Address;
            import com.wavesplatform.transactions.common.ChainId;
            import com.wavesplatform.wavesj.Node;
            
            public class SetScriptTx {
                public static void main(String[] args) throws Exception {
                    // Specify an account seed phrase.
                    String seedPhrase = "PASTE YOUR SEED PHRASE";
            
                    // Generate the private key from the seed phrase.
                    PrivateKey privateKey = PrivateKey.fromSeed(seedPhrase);
            
                    /* 
                     * Specify the network chain ID:
                     * - Mainnet: `MAINNET`
                     * - Testnet: `TESTNET`
                     * - Stagenet: `STAGENET`
                     */
                    byte networkChainId = ChainId.TESTNET;
            
                    /*
                     * Specify the link for the same network as mentioned above:
                     * - Mainnet: "https://nodes.wavesnodes.com/"
                     * - Testnet: "https://nodes-testnet.wavesnodes.com/"
                     * - Stagenet: "https://nodes-stagenet.wavesnodes.com/"
                     */
                    Node node = new Node("https://nodes-testnet.wavesnodes.com");
            
                    // Specify an account Ride script.
                    String scriptSource = "{-# SCRIPT_TYPE ACCOUNT #-} true"; // Account Ride script example.
            
                    // Compile the script.
                    Base64String script = node.compileScript(scriptSource).script(); // Script example.
            
                    // Build the Set Script transaction.
                    SetScriptTransaction tx = SetScriptTransaction
                        .builder(script)                         // Script.
                        .fee(1000000)                            // Minimum transaction fee.
                        .timestamp(Instant.now().toEpochMilli()) // Timestamp.
                        .chainId(networkChainId)                 // Chain ID.
                        .getSignedWith(privateKey);              // Sender's private key.
            
                    // Broadcast the transaction to the node.
                    node.broadcast(tx);
            
                    // Set the timeout to ensure the transaction has appeared on the blockchain.
                    Thread.sleep(5000);
            
                    // Get the information about the transaction from the node.
                    Address address = Address.from(networkChainId, privateKey.publicKey());
                    System.out.println("Sender Address: " + address);
                    System.out.println("Transaction ID: " + tx.id());
                    System.out.println("Transaction JSON: " + tx.toJson());
                }
            }
            
          2. In the Main.java file, run the SetScriptTx class.

          # Set Asset Script

          About Set Asset Script Transaction.

          NOTE: You can set an asset script only on those asset that were issued with a ride script attached.

          In your project directory:

          1. Replace the Main.java file code with the following snippet:
            package com.example;
            
            // Necessary imports.
            import java.time.Instant;
            import com.wavesplatform.transactions.SetAssetScriptTransaction;
            import com.wavesplatform.transactions.common.Base64String;
            import com.wavesplatform.transactions.common.AssetId;
            import com.wavesplatform.transactions.account.PrivateKey;
            import com.wavesplatform.transactions.account.Address;
            import com.wavesplatform.transactions.common.ChainId;
            import com.wavesplatform.wavesj.Node;
            
            public class SetAssetScriptTx {
                public static void main(String[] args) throws Exception {
                    // Specify an account seed phrase.
                    String seedPhrase = "PASTE YOUR SEED PHRASE";
            
                    // Generate the private key from the seed phrase.
                    PrivateKey privateKey = PrivateKey.fromSeed(seedPhrase);
            
                    /* 
                     * Specify the network chain ID:
                     * - Mainnet: `MAINNET`
                     * - Testnet: `TESTNET`
                     * - Stagenet: `STAGENET`
                     */
                    byte networkChainId = ChainId.TESTNET;
            
                    /*
                     * Specify the link for the same network as mentioned above:
                     * - Mainnet: "https://nodes.wavesnodes.com/"
                     * - Testnet: "https://nodes-testnet.wavesnodes.com/"
                     * - Stagenet: "https://nodes-stagenet.wavesnodes.com/"
                     */
                    Node node = new Node("https://nodes-testnet.wavesnodes.com");
            
                    // Define the asset ID of the smart asset.
                    AssetId assetId = AssetId.as("PASTE AN ASSET ID");
            
                    // Define the compiled base64 Ride script.
                    Base64String script = node.compileScript("{-# SCRIPT_TYPE ACCOUNT #-} true").script(); // Script example.
            
                    // Build the Set Asset Script Transaction.
                    SetAssetScriptTransaction tx = SetAssetScriptTransaction
                        .builder(assetId, script)                // Asset ID and script.
                        .fee(1000000L)                           // Transaction fee. E.g. `1000000L` for 0.01 WAVES.
                        .timestamp(Instant.now().toEpochMilli()) // Timestamp.
                        .chainId(networkChainId)                 // Chain ID.
                        .getSignedWith(privateKey);              // Sender's private key.
            
                    // Broadcast the transaction to the node.
                    node.broadcast(tx);
            
                    // Set the timeout to ensure the transaction has appeared on the blockchain.
                    Thread.sleep(5000);
            
                    // Get the information about the transaction from the node.
                    Address address = Address.from(networkChainId, privateKey.publicKey());
                    System.out.println("Sender Address: " + address);
                    System.out.println("Transaction ID: " + tx.id());
                    System.out.println("Transaction JSON: " + tx.toJson());
                }
            }
            
          2. In the Main.java file, run the SetAssetScriptTx class.

          # Update Asset Info

          About Update Asset Info Transaction.

          In your project directory:

          1. Replace the Main.java file code with the following snippet:
            package com.example;
            
            // Necessary imports.
            import java.time.Instant;
            import com.wavesplatform.transactions.UpdateAssetInfoTransaction;
            import com.wavesplatform.transactions.common.AssetId;
            import com.wavesplatform.transactions.account.PrivateKey;
            import com.wavesplatform.transactions.account.Address;
            import com.wavesplatform.transactions.common.ChainId;
            import com.wavesplatform.wavesj.Node;
            
            public class UpdateAssetInfoTx {
                public static void main(String[] args) throws Exception {
                    // Specify an account seed phrase.
                    String seedPhrase = "PASTE YOUR SEED PHRASE";
            
                    // Generate the private key from the seed phrase.
                    PrivateKey privateKey = PrivateKey.fromSeed(seedPhrase);
            
                    /* 
                     * Specify the network chain ID:
                     * - Mainnet: `MAINNET`
                     * - Testnet: `TESTNET`
                     * - Stagenet: `STAGENET`
                     */
                    byte networkChainId = ChainId.TESTNET;
            
                    /*
                     * Specify the link for the same network as mentioned above:
                     * - Mainnet: "https://nodes.wavesnodes.com/"
                     * - Testnet: "https://nodes-testnet.wavesnodes.com/"
                     * - Stagenet: "https://nodes-stagenet.wavesnodes.com/"
                     */
                    Node node = new Node("https://nodes-testnet.wavesnodes.com");
            
                    // Define the asset ID.
                    AssetId assetId = AssetId.as("PASTE AN ASSET ID");
            
                    // Define the new name and description.
                    String newName = "UpdatedToken";               // New asset name.
                    String newDescription = "Updated description"; // New asset description.
            
                    // Build the Update Asset Info Transaction.
                    UpdateAssetInfoTransaction tx = UpdateAssetInfoTransaction
                        .builder(assetId, newName, newDescription) // Asset ID, new name, and new description.
                        .fee(100000L)                              // Transaction fee. E.g. `100000L` for 0.001 WAVES.
                        .timestamp(Instant.now().toEpochMilli())   // Timestamp.
                        .chainId(networkChainId)                   // Chain ID.
                        .getSignedWith(privateKey);                // Sender's private key.
            
                    // Broadcast the transaction to the node.
                    node.broadcast(tx);
            
                    // Set the timeout to ensure the transaction has appeared on the blockchain.
                    Thread.sleep(5000);
            
                    // Get the information about the transaction from the node.
                    Address address = Address.from(networkChainId, privateKey.publicKey());
                    System.out.println("Sender Address: " + address);
                    System.out.println("Transaction ID: " + tx.id());
                    System.out.println("Transaction JSON: " + tx.toJson());
                }
            }
            
          2. In the Main.java file, run the UpdateAssetInfoTx class.

          # Invoke Script

          About Invoke Script Transaction.

          In your project directory:

          1. Replace the Main.java file code with the following snippet:
            package com.example;
            
            // Necessary imports.
            import java.time.Instant;
            import java.util.List;
            import com.wavesplatform.transactions.InvokeScriptTransaction;
            import com.wavesplatform.transactions.invocation.*;
            import com.wavesplatform.transactions.account.PrivateKey;
            import com.wavesplatform.transactions.account.Address;
            import com.wavesplatform.transactions.common.ChainId;
            import com.wavesplatform.transactions.common.AssetId;
            import com.wavesplatform.transactions.common.Amount;
            import com.wavesplatform.wavesj.Node;
            
            public class InvokeScriptTx {
                public static void main(String[] args) throws Exception {
                    // Specify an account seed phrase.
                    String seedPhrase = "PASTE YOUR SEED PHRASE";
            
                    // Generate the private key from the seed phrase.
                    PrivateKey privateKey = PrivateKey.fromSeed(seedPhrase);
            
                    /* 
                     * Specify the network chain ID:
                     * - Mainnet: `MAINNET`
                     * - Testnet: `TESTNET`
                     * - Stagenet: `STAGENET`
                     */
                    byte networkChainId = ChainId.TESTNET;
            
                    /*
                     * Specify the link for the same network as mentioned above:
                     * - Mainnet: "https://nodes.wavesnodes.com/"
                     * - Testnet: "https://nodes-testnet.wavesnodes.com/"
                     * - Stagenet: "https://nodes-stagenet.wavesnodes.com/"
                     */
                    Node node = new Node("https://nodes-testnet.wavesnodes.com");
            
                    // Define the dApp (scripted account) address.
                    Address dApp = Address.as("PASTE A DAPP ADDRESS HERE");
            
                    // Define the function name and arguments.
                    Function function = Function.as(
                        "myFunction",         // Callable function name of the dApp.
                        StringArg.as("arg1"), // First argument: `string`.
                        IntegerArg.as(42),    // Second argument: `integer`.
                        BooleanArg.as(true)   // Third argument: `boolean`.
                    );
            
                    // Define the payment amount.
                    long paymentAmount = 1_00000000L; // E.g. `1_00000000L` for 1 token.
            
                    /* 
                     * Define the transfer asset:
                     * - Use `AssetId.WAVES` for WAVES.
                     * - Or specify a custom asset ID.
                     */
                    AssetId paymentAsset = AssetId.WAVES;
            
                    // Wrap the payment into a list.
                    List<Amount> payments = List.of(
                        Amount.of(paymentAmount, paymentAsset) // Single payment.
                    );
            
                    // Build the Invoke Script Transaction.
                    InvokeScriptTransaction tx = InvokeScriptTransaction
                        .builder(dApp, function)                 // Target dApp and the function to call.
                        .payments(payments)                      // List of payments.
                        .fee(500000L)                            // Transaction fee. E.g. `500000L` for 0.005 WAVES.
                        .timestamp(Instant.now().toEpochMilli()) // Timestamp.
                        .chainId(networkChainId)                 // Chain ID.
                        .getSignedWith(privateKey);              // Sender's private key.
            
                    // Broadcast the transaction to the node.
                    node.broadcast(tx);
            
                    // Set the timeout to ensure the transaction has appeared on the blockchain.
                    Thread.sleep(5000);
            
                    // Get the information about the transaction from the node.
                    Address sender = Address.from(networkChainId, privateKey.publicKey());
                    System.out.println("Sender Address: " + sender);
                    System.out.println("Transaction ID: " + tx.id());
                    System.out.println("Transaction JSON: " + tx.toJson());
                }
            }
            
          2. In the Main.java file, run the InvokeScriptTx class.

          # Sponsor Fee

          About Sponsor Fee Transaction.

          In your project directory:

          1. Replace the Main.java file code with the following snippet:
            package com.example;
            
            import java.time.Instant;
            
            // Necessary imports.
            import com.wavesplatform.transactions.SponsorFeeTransaction;
            import com.wavesplatform.transactions.common.AssetId;
            import com.wavesplatform.transactions.account.PrivateKey;
            import com.wavesplatform.transactions.account.Address;
            import com.wavesplatform.transactions.common.ChainId;
            import com.wavesplatform.wavesj.Node;
            
            public class SponsorFeeTx {
                public static void main(String[] args) throws Exception {
                    // Specify an account seed phrase.
                    String seedPhrase = "PASTE YOUR SEED PHRASE";
            
                    // Generate the private key from the seed phrase.
                    PrivateKey privateKey = PrivateKey.fromSeed(seedPhrase);
            
                    /* 
                     * Specify the network chain ID:
                     * - Mainnet: `MAINNET`
                     * - Testnet: `TESTNET`
                     * - Stagenet: `STAGENET`
                     */
                    byte networkChainId = ChainId.TESTNET;
            
                    /*
                     * Specify the link for the same network as mentioned above:
                     * - Mainnet: "https://nodes.wavesnodes.com/"
                     * - Testnet: "https://nodes-testnet.wavesnodes.com/"
                     * - Stagenet: "https://nodes-stagenet.wavesnodes.com/"
                     */
                    Node node = new Node("https://nodes-testnet.wavesnodes.com");
            
                    // Define the asset ID to sponsor.
                    AssetId assetId = AssetId.as("PASTE AN ASSET ID");
            
                    // Define the minimal sponsored fee.
                    long minSponsoredFee = 50000L; // E.g. `50000L` means 0.0005 of the sponsored asset.
            
                    // Build the Sponsor Fee Transaction.
                    SponsorFeeTransaction tx = SponsorFeeTransaction
                        .builder(assetId, minSponsoredFee)       // Target asset and sponsored fee amount.
                        .fee(100000000L)                         // Transaction fee in WAVES. E.g. `100000000L` for 1 WAVES.
                        .timestamp(Instant.now().toEpochMilli()) // Timestamp.
                        .chainId(networkChainId)                 // Chain ID.
                        .getSignedWith(privateKey);              // Sender's private key.
            
                    // Broadcast the transaction to the node.
                    node.broadcast(tx);
            
                    // Set the timeout to ensure the transaction has appeared on the blockchain.
                    Thread.sleep(5000);
            
                    // Get the information about the transaction from the node.
                    Address sender = Address.from(networkChainId, privateKey.publicKey());
                    System.out.println("Sender Address: " + sender);
                    System.out.println("Transaction ID: " + tx.id());
                    System.out.println("Transaction JSON: " + tx.toJson());
                }
            }
            
          2. In the Main.java file, run the SponsorFeeTx class.
          Run Code Sample
          Use Crypto Utilities
          Run Code Sample
          Use Crypto Utilities