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 & waves-transactions
      • 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
      Ts-lib-crypto & waves-transactions
    • Waves-PHP
      • 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-PHP
    • WavesKit
      • 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
      WavesKit
    • PyWaves-CE
      • 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
      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.
          • Lease.
          • Lease Cancel.
          • Create Alias.
          • Data.
          • Set Script.
          • Set Asset Script.
          • Update Asset Info.
          • Invoke Script.
          • Sponsor Fee.

          NOTE: The WavesKit SDK doesn't support the Exchange Transaction.

          # Issue

          About Issue Transaction.

          In your project directory:

          1. Replace the waves.php file code with the following snippet:
            <?php
            
            require_once __DIR__ . '/vendor/autoload.php';
            
            // Necessary import.
            use deemru\WavesKit;
            
            // Hide deprecated warnings temporarily.
            error_reporting(E_ALL & ~E_DEPRECATED);
            
            // Specify your account's seed phrase.
            $seedPhrase = 'PASTE YOUR SEED PHRASE';
            
            /* Specify the network chain ID:
             * - Mainnet: 'W'
             * - Testnet: 'T'
             */
            $network = 'T';
            
            /*
             * Specify the node network's link:
             * - Mainnet: 'https://nodes.wavesnodes.com/'
             * - Testnet: 'https://nodes-testnet.wavesnodes.com/'
             */
            $nodeHttp = 'https://nodes-testnet.wavesnodes.com/';
            
            // Initialize the SDK and set the seed.
            $wk = new WavesKit($network);
            $wk->setSeed($seedPhrase);
            
            // Specify a Ride script of the asset.
            $scriptSource =
                "{-# STDLIB_VERSION 6 #-}\n" .
                "{-# CONTENT_TYPE EXPRESSION #-}\n" .
                "{-# SCRIPT_TYPE ASSET #-}\n\n" .
                "func trueReturner() = {\n" .
                "    true\n" .
                "}\n\n" .
                "trueReturner()";
            
            // Compile the script.
            $scriptCompilation = $wk->compile( $scriptSource );
            $scriptBase64 = $scriptCompilation['script'] ?? null;
            
            // Build an Issue Transaction.
            $issueTx = $wk->txIssue(
                'TokenName',                // Name.
                'Description of the token', // Description.
                333,                        // Amount in the smallest units. Example: `333` for `0.00000333` tokens.
                8,                          // Decimals.
                true,                       // Flag indicating of the asset is reissuable.
                $scriptBase64,              // Script or `null`.
                null                        // Options. `Null` by default.
            );
            
            // Sign the transaction with the private key.
            $issueTxSigned = $wk->txSign($issueTx);
            
            // Broadcast the transaction to the node.
            $issueTxBroadcasted = $wk->txBroadcast($issueTxSigned);
            
            // Wait for the transaction confirmation.
            sleep(5);
            
            // Fetch a JSON data of the transaction from the node using public API.
            function fetchTransactionJson(string $txId, string $nodeHttp): ?array {
                $url = rtrim($nodeHttp, '/') . '/transactions/info/' . rawurlencode($txId);
                $opts = [
                    "http" => [
                        "method"  => "GET",
                        "header"  => "Accept: application/json\r\n",
                        "timeout" => 10
                    ]
                ];
                $context = stream_context_create($opts);
                $response = @file_get_contents($url, false, $context);
                if ($response === false) return null;
                return json_decode($response, true);
            }
            
            $txId = $issueTxBroadcasted['id'] ?? null;
            if ($txId === null) {
                echo "Broadcast failed; response:\n";
                var_export($issueTxBroadcasted);
                exit(1);
            }
            
            // Fetch a JSON data of the transaction from the node.
            $transactionJson = fetchTransactionJson($txId, $nodeHttp);
            
            // Print the results.
            echo "Transaction ID: " . $txId . PHP_EOL;
            echo "Transaction JSON: " . json_encode($transactionJson, JSON_PRETTY_PRINT) . PHP_EOL;
            
          2. Run the waves.php file:
            php waves.php
            

          # Reissue

          About Reissue Transaction.

          In your project directory:

          1. Replace the waves.php file code with the following snippet:
            <?php
            
            require_once __DIR__ . '/vendor/autoload.php';
            
            // Necessary import.
            use deemru\WavesKit;
            
            // Hide deprecated warnings temporarily.
            error_reporting(E_ALL & ~E_DEPRECATED);
            
            // Specify your account's seed phrase.
            $seedPhrase = 'PASTE YOUR SEED PHRASE';
            
            /* Specify the network chain ID:
             * - Mainnet: 'W'
             * - Testnet: 'T'
             */
            $network = 'T';
            
            /*
             * Specify the node network's link:
             * - Mainnet: 'https://nodes.wavesnodes.com/'
             * - Testnet: 'https://nodes-testnet.wavesnodes.com/'
             */
            $nodeHttp = 'https://nodes-testnet.wavesnodes.com/';
            
            // Initialize the SDK and set the seed.
            $wk = new WavesKit($network);
            $wk->setSeed($seedPhrase);
            
            // Specify the asset ID of the token you want to reissue.
            $assetId = 'PASTE AN ASSET ID';
            
            // Build a Reissue Transaction.
            $reissueTx = $wk->txReissue(
                $assetId, // ID of the asset to reissue.
                3000,     // Amount to reissue in the smallest units. Example: `3000` for `30` tokens.
                true,     // Flag indicating of the asset is reissuable..
                null      // Options. `Null` by default.
            );
            
            // Sign the transaction with the private key.
            $reissueTxSigned = $wk->txSign($reissueTx);
            
            // Broadcast the transaction to the node.
            $reissueTxBroadcasted = $wk->txBroadcast($reissueTxSigned);
            
            // Wait for the transaction confirmation.
            sleep(5);
            
            // Fetch a JSON data of the transaction from the node using public API.
            function fetchTransactionJson(string $txId, string $nodeHttp): ?array {
                $url = rtrim($nodeHttp, '/') . '/transactions/info/' . rawurlencode($txId);
                $opts = [
                    "http" => [
                        "method"  => "GET",
                        "header"  => "Accept: application/json\r\n",
                        "timeout" => 10
                    ]
                ];
                $context = stream_context_create($opts);
                $response = @file_get_contents($url, false, $context);
                if ($response === false) return null;
                return json_decode($response, true);
            }
            
            $txId = $reissueTxBroadcasted['id'] ?? null;
            if ($txId === null) {
                echo "Broadcast failed; response:\n";
                var_export($reissueTxBroadcasted);
                exit(1);
            }
            
            $transactionJson = fetchTransactionJson($txId, $nodeHttp);
            
            // Print the results.
            echo "Transaction ID: " . $txId . PHP_EOL;
            echo "Transaction JSON: " . json_encode($transactionJson, JSON_PRETTY_PRINT) . PHP_EOL;
            
          2. Run the waves.php file:
            php waves.php
            

          # Burn

          About Burn Transaction.

          In your project directory:

          1. Replace the waves.php file code with the following snippet:
            <?php
            
            require_once __DIR__ . '/vendor/autoload.php';
            
            // Necessary import.
            use deemru\WavesKit;
            
            // Hide deprecated warnings temporarily.
            error_reporting(E_ALL & ~E_DEPRECATED);
            
            // Specify your account's seed phrase.
            $seedPhrase = 'PASTE YOUR SEED PHRASE';
            
            /* Specify the network chain ID:
             * - Mainnet: 'W'
             * - Testnet: 'T'
             */
            $network = 'T';
            
            /*
             * Specify the node network's link:
             * - Mainnet: 'https://nodes.wavesnodes.com/'
             * - Testnet: 'https://nodes-testnet.wavesnodes.com/'
             */
            $nodeHttp = 'https://nodes-testnet.wavesnodes.com/';
            
            // Initialize the SDK and set the seed.
            $wk = new WavesKit($network);
            $wk->setSeed($seedPhrase);
            
            // Specify the asset ID of the token you want to burn.
            $assetId = 'PASTE AN ASSET ID';
            
            // Build a Burn Transaction.
            $burnTx = $wk->txBurn(
                $assetId, // ID of the asset to burn.
                1000,     // Amount to burn in the smallest units. Example: `1000` for `10` tokens.
                null      // Options. `Null` by default.
            );
            
            // Sign the transaction with the private key.
            $burnTxSigned = $wk->txSign($burnTx);
            
            // Broadcast the transaction to the node.
            $burnTxBroadcasted = $wk->txBroadcast($burnTxSigned);
            
            // Wait for the transaction confirmation.
            sleep(5);
            
            // Fetch a JSON data of the transaction from the node using public API.
            function fetchTransactionJson(string $txId, string $nodeHttp): ?array {
                $url = rtrim($nodeHttp, '/') . '/transactions/info/' . rawurlencode($txId);
                $opts = [
                    "http" => [
                        "method"  => "GET",
                        "header"  => "Accept: application/json\r\n",
                        "timeout" => 10
                    ]
                ];
                $context = stream_context_create($opts);
                $response = @file_get_contents($url, false, $context);
                if ($response === false) return null;
                return json_decode($response, true);
            }
            
            $txId = $burnTxBroadcasted['id'] ?? null;
            if ($txId === null) {
                echo "Broadcast failed; response:\n";
                var_export($burnTxBroadcasted);
                exit(1);
            }
            
            $transactionJson = fetchTransactionJson($txId, $nodeHttp);
            
            // Print the results.
            echo "Transaction ID: " . $txId . PHP_EOL;
            echo "Transaction JSON: " . json_encode($transactionJson, JSON_PRETTY_PRINT) . PHP_EOL;
            
          2. Run the waves.php file:
            php waves.php
            

          # Transfer

          About Transfer Transaction.

          In your project directory:

          1. Replace the waves.php file code with the following snippet:
            <?php
            
            require_once __DIR__ . '/vendor/autoload.php';
            
            // Necessary import.
            use deemru\WavesKit;
            
            // Hide deprecated warnings temporarily.
            error_reporting(E_ALL & ~E_DEPRECATED);
            
            // Specify your account's seed phrase.
            $seedPhrase = 'PASTE YOUR SEED PHRASE';
            
            /* Specify the network chain ID:
             * - Mainnet: 'W'
             * - Testnet: 'T'
             */
            $network = 'T';
            
            /*
             * Specify the node network's link:
             * - Mainnet: 'https://nodes.wavesnodes.com/'
             * - Testnet: 'https://nodes-testnet.wavesnodes.com/'
             */
            $nodeHttp = 'https://nodes-testnet.wavesnodes.com/';
            
            // Initialize the SDK and set the seed.
            $wk = new WavesKit($network);
            $wk->setSeed($seedPhrase);
            
            // Specify the asset ID of the token you want to transfer or use 'WAVES' for WAVES.
            $assetId = 'PASTE AN ASSET ID';
            
            // Specify the recipient address.
            $recipient = 'PASTE AN ADDRESS';
            
            // Build a Transfer Transaction.
            $transferTx = $wk->txTransfer(
                $recipient, // Receipient's address.
                5000,       // Amount to transfer in the smallest units.
                            // Example:
                            // - If a custom asset: `5000` for `50` tokens.
                            // - If WAVES: `5000` for `0.00005000` WAVES.
                $assetID,   // Asset ID.
                '',         // Attachment. Empty string by default.
                null,       // Fee. Null = default fee.
                'WAVES'     // Fee asset. Usually 'WAVES'.
            );
            
            // Sign the transaction with the private key.
            $transferTxSigned = $wk->txSign($transferTx);
            
            // Broadcast the transaction to the node.
            $transferTxBroadcasted = $wk->txBroadcast($transferTxSigned);
            
            // Wait for the transaction confirmation.
            sleep(5);
            
            // Fetch a JSON data of the transaction from the node using public API.
            function fetchTransactionJson(string $txId, string $nodeHttp): ?array {
                $url = rtrim($nodeHttp, '/') . '/transactions/info/' . rawurlencode($txId);
                $opts = [
                    "http" => [
                        "method"  => "GET",
                        "header"  => "Accept: application/json\r\n",
                        "timeout" => 10
                    ]
                ];
                $context = stream_context_create($opts);
                $response = @file_get_contents($url, false, $context);
                if ($response === false) return null;
                return json_decode($response, true);
            }
            
            $txId = $transferTxBroadcasted['id'] ?? null;
            if ($txId === null) {
                echo "Broadcast failed; response:\n";
                var_export($transferTxBroadcasted);
                exit(1);
            }
            
            $transactionJson = fetchTransactionJson($txId, $nodeHttp);
            
            // Print the results.
            echo "Transaction ID: " . $txId . PHP_EOL;
            echo "Transaction JSON: " . json_encode($transactionJson, JSON_PRETTY_PRINT) . PHP_EOL;
            
          2. Run the waves.php file:
            php waves.php
            

          # Mass Transfer

          About Mass Transfer Transaction.

          In your project directory:

          1. Replace the waves.php file code with the following snippet:
            <?php
            
            require_once __DIR__ . '/vendor/autoload.php';
            
            // Necessary import.
            use deemru\WavesKit;
            
            // Hide deprecated warnings temporarily.
            error_reporting(E_ALL & ~E_DEPRECATED);
            
            // Specify your account's seed phrase.
            $seedPhrase = 'PASTE YOUR SEED PHRASE';
            
            /* Specify the network chain ID:
             * - Mainnet: 'W'
             * - Testnet: 'T'
             */
            $network = 'T';
            
            /*
             * Specify the node network's link:
             * - Mainnet: 'https://nodes.wavesnodes.com/'
             * - Testnet: 'https://nodes-testnet.wavesnodes.com/'
             */
            $nodeHttp = 'https://nodes-testnet.wavesnodes.com/';
            
            // Initialize the SDK and set the seed.
            $wk = new WavesKit($network);
            $wk->setSeed($seedPhrase);
            
            // Specify the asset ID of the token you want to transfer or use 'WAVES' for WAVES.
            $assetId = 'PASTE AN ASSET ID';
            
            // Build a Mass Transfer Transaction.
            $recipients = [
                'PASTE 1ST RECIPIENT ADDRESS',
                'PASTE 2ND RECIPIENT ADDRESS',
                // ...
            ];
            $amounts = [
                1000, // Amount to first recipient in the smallest units. Example: `1000` for `10` tokens.
                2000, // Amount to second recipient in the smallest units. Example: `2000` for `20` tokens.
                // ...
            ];
            
            $massTransferTx = $wk->txMass(
                $recipients, // Array of recipients.
                $amounts,    // Array of amounts.
                $assetId     // Asset ID or 'WAVES'.
            );
            
            // Sign the transaction with the private key.
            $massTransferTxSigned = $wk->txSign($massTransferTx);
            
            // Broadcast the transaction to the node.
            $massTransferTxBroadcasted = $wk->txBroadcast($massTransferTxSigned);
            
            // Wait for the transaction confirmation.
            sleep(5);
            
            // Fetch a JSON data of the transaction from the node using public API.
            function fetchTransactionJson(string $txId, string $nodeHttp): ?array {
                $url = rtrim($nodeHttp, '/') . '/transactions/info/' . rawurlencode($txId);
                $opts = [
                    "http" => [
                        "method"  => "GET",
                        "header"  => "Accept: application/json\r\n",
                        "timeout" => 10
                    ]
                ];
                $context = stream_context_create($opts);
                $response = @file_get_contents($url, false, $context);
                if ($response === false) return null;
                return json_decode($response, true);
            }
            
            $txId = $massTransferTxBroadcasted['id'] ?? null;
            if ($txId === null) {
                echo "Broadcast failed; response:\n";
                var_export($massTransferTxBroadcasted);
                exit(1);
            }
            
            $transactionJson = fetchTransactionJson($txId, $nodeHttp);
            
            // Print the results.
            echo "Transaction ID: " . $txId . PHP_EOL;
            echo "Transaction JSON: " . json_encode($transactionJson, JSON_PRETTY_PRINT) . PHP_EOL;
            
          2. Run the waves.php file:
            php waves.php
            

          # Lease

          About Lease Transaction.

          In your project directory:

          1. Replace the waves.php file code with the following snippet:
            <?php
            
            require_once __DIR__ . '/vendor/autoload.php';
            
            // Necessary import.
            use deemru\WavesKit;
            
            // Hide deprecated warnings temporarily.
            error_reporting(E_ALL & ~E_DEPRECATED);
            
            // Specify your account's seed phrase.
            $seedPhrase = 'PASTE YOUR SEED PHRASE';
            
            /* Specify the network chain ID:
             * - Mainnet: 'W'
             * - Testnet: 'T'
             */
            $network = 'T';
            
            /*
             * Specify the node network's link:
             * - Mainnet: 'https://nodes.wavesnodes.com/'
             * - Testnet: 'https://nodes-testnet.wavesnodes.com/'
             */
            $nodeHttp = 'https://nodes-testnet.wavesnodes.com/';
            
            // Initialize the SDK and set the seed.
            $wk = new WavesKit($network);
            $wk->setSeed($seedPhrase);
            
            // Specify the recipient address for leasing.
            $recipient = 'PASTE AN ADDRESS';
            
            // Specify the amount to lease in WAVES tokens.
            $amount = 100000; // Example: `100000` for `0.00100000` WAVES.
            
            // Build a Lease Transaction.
            $leaseTx = $wk->txLease(
                $recipient, // Recipient of the lease.
                $amount     // Amount in WAVES tokens.
            );
            
            // Sign the transaction with the private key.
            $leaseTxSigned = $wk->txSign($leaseTx);
            
            // Broadcast the transaction to the node.
            $leaseTxBroadcasted = $wk->txBroadcast($leaseTxSigned);
            
            // Wait for the transaction confirmation.
            sleep(5);
            
            // Fetch a JSON data of the transaction from the node using public API.
            function fetchTransactionJson(string $txId, string $nodeHttp): ?array {
                $url = rtrim($nodeHttp, '/') . '/transactions/info/' . rawurlencode($txId);
                $opts = [
                    "http" => [
                        "method"  => "GET",
                        "header"  => "Accept: application/json\r\n",
                        "timeout" => 10
                    ]
                ];
                $context = stream_context_create($opts);
                $response = @file_get_contents($url, false, $context);
                if ($response === false) return null;
                return json_decode($response, true);
            }
            
            $txId = $leaseTxBroadcasted['id'] ?? null;
            if ($txId === null) {
                echo "Broadcast failed; response:\n";
                var_export($leaseTxBroadcasted);
                exit(1);
            }
            
            $transactionJson = fetchTransactionJson($txId, $nodeHttp);
            
            // Print the results.
            echo "Transaction ID: " . $txId . PHP_EOL;
            echo "Transaction JSON: " . json_encode($transactionJson, JSON_PRETTY_PRINT) . PHP_EOL;
            
          2. Run the waves.php file:
            php waves.php
            

          # Lease Cancel

          About Lease Cancel Transaction.

          In your project directory:

          1. Replace the waves.php file code with the following snippet:
            <?php
            
            require_once __DIR__ . '/vendor/autoload.php';
            
            // Necessary import.
            use deemru\WavesKit;
            
            // Hide deprecated warnings temporarily.
            error_reporting(E_ALL & ~E_DEPRECATED);
            
            // Specify your account's seed phrase.
            $seedPhrase = 'PASTE YOUR SEED PHRASE';
            
            /* Specify the network chain ID:
             * - Mainnet: 'W'
             * - Testnet: 'T'
             */
            $network = 'T';
            
            /*
             * Specify the node network's link:
             * - Mainnet: 'https://nodes.wavesnodes.com/'
             * - Testnet: 'https://nodes-testnet.wavesnodes.com/'
             */
            $nodeHttp = 'https://nodes-testnet.wavesnodes.com/';
            
            // Initialize the SDK and set the seed.
            $wk = new WavesKit($network);
            $wk->setSeed($seedPhrase);
            
            // Specify the lease transaction ID you want to cancel.
            $leaseId = 'PASTE A LEASE TRANSACTION ID';
            
            // Build a Cancel Lease Transaction.
            $cancelLeaseTx = $wk->txLeaseCancel(
                $leaseId // Lease transaction ID to cancel.
            );
            
            // Sign the transaction with the private key.
            $cancelLeaseTxSigned = $wk->txSign($cancelLeaseTx);
            
            // Broadcast the transaction to the node.
            $cancelLeaseTxBroadcasted = $wk->txBroadcast($cancelLeaseTxSigned);
            
            // Wait for the transaction confirmation.
            sleep(5);
            
            // Fetch a JSON data of the transaction from the node using public API.
            function fetchTransactionJson(string $txId, string $nodeHttp): ?array {
                $url = rtrim($nodeHttp, '/') . '/transactions/info/' . rawurlencode($txId);
                $opts = [
                    "http" => [
                        "method"  => "GET",
                        "header"  => "Accept: application/json\r\n",
                        "timeout" => 10
                    ]
                ];
                $context = stream_context_create($opts);
                $response = @file_get_contents($url, false, $context);
                if ($response === false) return null;
                return json_decode($response, true);
            }
            
            $txId = $cancelLeaseTxBroadcasted['id'] ?? null;
            if ($txId === null) {
                echo "Broadcast failed; response:\n";
                var_export($cancelLeaseTxBroadcasted);
                exit(1);
            }
            
            $transactionJson = fetchTransactionJson($txId, $nodeHttp);
            
            // Print the results.
            echo "Transaction ID: " . $txId . PHP_EOL;
            echo "Transaction JSON: " . json_encode($transactionJson, JSON_PRETTY_PRINT) . PHP_EOL;
            
          2. Run the waves.php file:
            php waves.php
            

          # Create Alias

          About Create Alias Transaction.

          In your project directory:

          1. Replace the waves.php file code with the following snippet:
            <?php
            
            require_once __DIR__ . '/vendor/autoload.php';
            
            // Necessary import.
            use deemru\WavesKit;
            
            // Hide deprecated warnings temporarily.
            error_reporting(E_ALL & ~E_DEPRECATED);
            
            // Specify your account's seed phrase.
            $seedPhrase = 'PASTE YOUR SEED PHRASE';
            
            /* Specify the network chain ID:
             * - Mainnet: 'W'
             * - Testnet: 'T'
             */
            $network = 'T';
            
            /*
             * Specify the node network's link:
             * - Mainnet: 'https://nodes.wavesnodes.com/'
             * - Testnet: 'https://nodes-testnet.wavesnodes.com/'
             */
            $nodeHttp = 'https://nodes-testnet.wavesnodes.com/';
            
            // Initialize the SDK and set the seed.
            $wk = new WavesKit($network);
            $wk->setSeed($seedPhrase);
            
            // Specify an alias.
            $alias = 'youralias'; // Example value.
            
            // Build a Create Alias Transaction.
            $createAliasTx = $wk->txAlias(
                $alias // Alias to create.
            );
            
            // Sign the transaction with the private key.
            $createAliasTxSigned = $wk->txSign($createAliasTx);
            
            // Broadcast the transaction to the node.
            $createAliasTxBroadcasted = $wk->txBroadcast($createAliasTxSigned);
            
            // Wait for the transaction confirmation.
            sleep(5);
            
            // Fetch a JSON data of the transaction from the node using public API.
            function fetchTransactionJson(string $txId, string $nodeHttp): ?array {
                $url = rtrim($nodeHttp, '/') . '/transactions/info/' . rawurlencode($txId);
                $opts = [
                    "http" => [
                        "method"  => "GET",
                        "header"  => "Accept: application/json\r\n",
                        "timeout" => 10
                    ]
                ];
                $context = stream_context_create($opts);
                $response = @file_get_contents($url, false, $context);
                if ($response === false) return null;
                return json_decode($response, true);
            }
            
            $txId = $createAliasTxBroadcasted['id'] ?? null;
            if ($txId === null) {
                echo "Broadcast failed; response:\n";
                var_export($createAliasTxBroadcasted);
                exit(1);
            }
            
            $transactionJson = fetchTransactionJson($txId, $nodeHttp);
            
            // Print the results.
            echo "Transaction ID: " . $txId . PHP_EOL;
            echo "Transaction JSON: " . json_encode($transactionJson, JSON_PRETTY_PRINT) . PHP_EOL;
            
          2. Run the waves.php file:
            php waves.php
            

          # Data

          About Data Transaction.

          In your project directory:

          1. Replace the waves.php file code with the following snippet:
            <?php
            
            require_once __DIR__ . '/vendor/autoload.php';
            
            // Necessary import.
            use deemru\WavesKit;
            
            // Hide deprecated warnings temporarily.
            error_reporting(E_ALL & ~E_DEPRECATED);
            
            // Specify your account's seed phrase.
            $seedPhrase = 'PASTE YOUR SEED PHRASE';
            
            /* Specify the network chain ID:
             * - Mainnet: 'W'
             * - Testnet: 'T'
             */
            $network = 'T';
            
            /*
             * Specify the node network's link:
             * - Mainnet: 'https://nodes.wavesnodes.com/'
             * - Testnet: 'https://nodes-testnet.wavesnodes.com/'
             */
            $nodeHttp = 'https://nodes-testnet.wavesnodes.com/';
            
            // Initialize the SDK and set the seed.
            $wk = new WavesKit($network);
            $wk->setSeed($seedPhrase);
            
            // Generate randomized data entries.
            $n = mt_rand(4, 10);                                   // Number of entries.
            $dataEntries = [];
            for ($i = 0; $i < $n; $i++) {
                if ($i === 0) {
                    $dataEntries["key_$i"] = mt_rand();            // Integer value example.
                } elseif ($i === 1) {
                    $dataEntries["key_$i"] = (bool) mt_rand(0, 1); // Boolean value example.
                } elseif ($i === 2) {
                    $binary = $wk->sha256($wk->randomSeed());
                    $dataEntries["key_$i"] = [$binary];            // Binary value example.
                } else {
                    $dataEntries["key_$i"] = $wk->randomSeed(1);   // String value example.
                }
            }
            
            // Build a Data Transaction.
            $dataTx = $wk->txData($dataEntries);
            
            // Sign the transaction with the private key.
            $dataTxSigned = $wk->txSign($dataTx);
            
            // Broadcast the transaction to the node.
            $dataTxBroadcasted = $wk->txBroadcast($dataTxSigned);
            
            // Wait for the transaction confirmation.
            sleep(5);
            
            // Fetch a JSON data of the transaction from the node using public API.
            function fetchTransactionJson(string $txId, string $nodeHttp): ?array {
                $url = rtrim($nodeHttp, '/') . '/transactions/info/' . rawurlencode($txId);
                $opts = [
                    "http" => [
                        "method"  => "GET",
                        "header"  => "Accept: application/json\r\n",
                        "timeout" => 10
                    ]
                ];
                $context = stream_context_create($opts);
                $response = @file_get_contents($url, false, $context);
                if ($response === false) return null;
                return json_decode($response, true);
            }
            
            $txId = $dataTxBroadcasted['id'] ?? null;
            if ($txId === null) {
                echo "Broadcast failed; response:\n";
                var_export($dataTxBroadcasted);
                exit(1);
            }
            
            $transactionJson = fetchTransactionJson($txId, $nodeHttp);
            
            // Print the results.
            echo "Transaction ID: " . $txId . PHP_EOL;
            echo "Transaction JSON: " . json_encode($transactionJson, JSON_PRETTY_PRINT) . PHP_EOL;
            
          2. Run the waves.php file:
            php waves.php
            

          # Set Script

          About Set Script Transaction.

          In your project directory:

          1. Replace the waves.php file code with the following snippet:
            <?php
            
            require_once __DIR__ . '/vendor/autoload.php';
            
            // Necessary import.
            use deemru\WavesKit;
            
            // Hide deprecated warnings temporarily.
            error_reporting(E_ALL & ~E_DEPRECATED);
            
            // Specify your account's seed phrase.
            $seedPhrase = 'PASTE YOUR SEED PHRASE';
            
            /* Specify the network chain ID:
             * - Mainnet: 'W'
             * - Testnet: 'T'
             */
            $network = 'T';
            
            /*
             * Specify the node network's link:
             * - Mainnet: 'https://nodes.wavesnodes.com/'
             * - Testnet: 'https://nodes-testnet.wavesnodes.com/'
             */
            $nodeHttp = 'https://nodes-testnet.wavesnodes.com/';
            
            // Initialize the SDK and set the seed.
            $wk = new WavesKit($network);
            $wk->setSeed($seedPhrase);
            
            // Specify a Ride script.
            $script = 
                '{-# STDLIB_VERSION 4 #-}
                {-# CONTENT_TYPE DAPP #-}
                {-# SCRIPT_TYPE ACCOUNT #-}
                @Callable(i)
                func default() = []
                '
            ;
            
            // Compile the script.
            $scriptCompilation = $wk->compile( $script );
            $scriptBase64 = $scriptCompilation['script'] ?? null;
            
            // Build a Set Script Transaction.
            $setScriptTx = $wk->txAddressScript($scriptBase64); // Or use `$wk->txAddressScript($null)` to remove script. 
            
            // Sign the transaction with the private key.
            $setScriptTxSigned = $wk->txSign($setScriptTx);
            
            // Broadcast the transaction to the node.
            $setScriptTxBroadcasted = $wk->txBroadcast($setScriptTxSigned);
            
            // Wait for the transaction confirmation.
            sleep(5);
            
            // Fetch a JSON data of the transaction from the node using public API.
            function fetchTransactionJson(string $txId, string $nodeHttp): ?array {
                $url = rtrim($nodeHttp, '/') . '/transactions/info/' . rawurlencode($txId);
                $opts = [
                    "http" => [
                        "method"  => "GET",
                        "header"  => "Accept: application/json\r\n",
                        "timeout" => 10
                    ]
                ];
                $context = stream_context_create($opts);
                $response = @file_get_contents($url, false, $context);
                if ($response === false) return null;
                return json_decode($response, true);
            }
            
            $txId = $setScriptTxBroadcasted['id'] ?? null;
            if ($txId === null) {
                echo "Broadcast failed; response:\n";
                var_export($setScriptTxBroadcasted);
                exit(1);
            }
            
            $transactionJson = fetchTransactionJson($txId, $nodeHttp);
            
            // Print the results.
            echo "Transaction ID: " . $txId . PHP_EOL;
            echo "Transaction JSON: " . json_encode($transactionJson, JSON_PRETTY_PRINT) . PHP_EOL;
            
          2. Run the waves.php file:
            php waves.php
            

          # 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 waves.php file code with the following snippet:
            <?php
            
            require_once __DIR__ . '/vendor/autoload.php';
            
            // Necessary import.
            use deemru\WavesKit;
            
            // Hide deprecated warnings temporarily.
            error_reporting(E_ALL & ~E_DEPRECATED);
            
            // Specify your account's seed phrase.
            $seedPhrase = 'PASTE YOUR SEED PHRASE';
            
            /* Specify the network chain ID:
             * - Mainnet: 'W'
             * - Testnet: 'T'
             */
            $network = 'T';
            
            /*
             * Specify the node network's link:
             * - Mainnet: 'https://nodes.wavesnodes.com/'
             * - Testnet: 'https://nodes-testnet.wavesnodes.com/'
             */
            $nodeHttp = 'https://nodes-testnet.wavesnodes.com/';
            
            // Initialize the SDK and set the seed.
            $wk = new WavesKit($network);
            $wk->setSeed($seedPhrase);
            
            // Specify the asset ID.
            $assetId = 'PASTE AN ASSET ID';
            
            // Specify an asset Ride script.
            $scriptSource =
                "{-# STDLIB_VERSION 5 #-}\n" .
                "{-# CONTENT_TYPE EXPRESSION #-}\n" .
                "{-# SCRIPT_TYPE ASSET #-}\n\n" .
                "true";
            
            // Compile the script.
            $scriptCompilation = $wk->compile($scriptSource);
            $scriptBase64 = $scriptCompilation['script'] ?? null;
            
            // Build a Set Asset Script Transaction.
            $setAssetScriptTx = $wk->txAssetScript(
                $assetId,     // Asset ID.
                $scriptBase64 // Script or `null` to remove the script.
            );
            
            // Sign the transaction with the private key.
            $setAssetScriptTxSigned = $wk->txSign($setAssetScriptTx);
            
            // Broadcast the transaction to the node.
            $setAssetScriptTxBroadcasted = $wk->txBroadcast($setAssetScriptTxSigned);
            
            // Wait for the transaction confirmation.
            sleep(5);
            
            // Fetch a JSON data of the transaction from the node using public API.
            function fetchTransactionJson(string $txId, string $nodeHttp): ?array {
                $url = rtrim($nodeHttp, '/') . '/transactions/info/' . rawurlencode($txId);
                $opts = [
                    "http" => [
                        "method"  => "GET",
                        "header"  => "Accept: application/json\r\n",
                        "timeout" => 10
                    ]
                ];
                $context = stream_context_create($opts);
                $response = @file_get_contents($url, false, $context);
                if ($response === false) return null;
                return json_decode($response, true);
            }
            
            $txId = $setAssetScriptTxBroadcasted['id'] ?? null;
            if ($txId === null) {
                echo "Broadcast failed; response:\n";
                var_export($setAssetScriptTxBroadcasted);
                exit(1);
            }
            
            $transactionJson = fetchTransactionJson($txId, $nodeHttp);
            
            // Print the results.
            echo "Transaction ID: " . $txId . PHP_EOL;
            echo "Transaction JSON: " . json_encode($transactionJson, JSON_PRETTY_PRINT) . PHP_EOL;
            
          2. Run the waves.php file:
            php waves.php
            

          # Update Asset Info

          About Update Asset Info Transaction.

          In your project directory:

          1. Replace the waves.php file code with the following snippet:
            <?php
            
            require_once __DIR__ . '/vendor/autoload.php';
            
            // Necessary import.
            use deemru\WavesKit;
            
            // Hide deprecated warnings temporarily.
            error_reporting(E_ALL & ~E_DEPRECATED);
            
            // Specify your account's seed phrase.
            $seedPhrase = 'PASTE YOUR SEED PHRASE';
            
            /* Specify the network chain ID:
             * - Mainnet: 'W'
             * - Testnet: 'T'
             */
            $network = 'T';
            
            /*
             * Specify the node network's link:
             * - Mainnet: 'https://nodes.wavesnodes.com/'
             * - Testnet: 'https://nodes-testnet.wavesnodes.com/'
             */
            $nodeHttp = 'https://nodes-testnet.wavesnodes.com/';
            
            // Initialize the SDK and set the seed.
            $wk = new WavesKit($network);
            $wk->setSeed($seedPhrase);
            
            // Specify the asset ID to update.
            $assetId = 'PASTE AN ASSET ID';
            
            // Specify updated asset info.
            $assetName        = 'UpdatedTokenName';    // New name.
            $assetDescription = 'Updated description'; // New description.
            
            // Build an Update Asset Info Transaction.
            $updateAssetInfoTx = $wk->txUpdateAssetInfo(
                $assetId,           // Asset ID.
                $assetName,         // Updated name.
                $assetDescription   // Updated description.
            );
            
            // Sign the transaction with the private key.
            $updateAssetInfoTxSigned = $wk->txSign($updateAssetInfoTx);
            
            // Broadcast the transaction to the node.
            $updateAssetInfoTxBroadcasted = $wk->txBroadcast($updateAssetInfoTxSigned);
            
            // Wait for the transaction confirmation.
            sleep(5);
            
            // Fetch a JSON data of the transaction from the node using public API.
            function fetchTransactionJson(string $txId, string $nodeHttp): ?array {
                $url = rtrim($nodeHttp, '/') . '/transactions/info/' . rawurlencode($txId);
                $opts = [
                    "http" => [
                        "method"  => "GET",
                        "header"  => "Accept: application/json\r\n",
                        "timeout" => 10
                    ]
                ];
                $context = stream_context_create($opts);
                $response = @file_get_contents($url, false, $context);
                if ($response === false) return null;
                return json_decode($response, true);
            }
            
            $txId = $updateAssetInfoTxBroadcasted['id'] ?? null;
            if ($txId === null) {
                echo "Broadcast failed; response:\n";
                var_export($updateAssetInfoTxBroadcasted);
                exit(1);
            }
            
            $transactionJson = fetchTransactionJson($txId, $nodeHttp);
            
            // Print the results.
            echo "Transaction ID: " . $txId . PHP_EOL;
            echo "Transaction JSON: " . json_encode($transactionJson, JSON_PRETTY_PRINT) . PHP_EOL;
            
          2. Run the waves.php file:
            php waves.php
            

          # Invoke Script

          About Invoke Script Transaction.

          In your project directory:

          1. Replace the waves.php file code with the following snippet:
            <?php
            
            require_once __DIR__ . '/vendor/autoload.php';
            
            // Necessary import.
            use deemru\WavesKit;
            
            // Hide deprecated warnings temporarily.
            error_reporting(E_ALL & ~E_DEPRECATED);
            
            // Specify your account's seed phrase.
            $seedPhrase = 'PASTE YOUR SEED PHRASE';
            
            /* Specify the network chain ID:
             * - Mainnet: 'W'
             * - Testnet: 'T'
             */
            $network = 'T';
            
            /*
             * Specify the node network's link:
             * - Mainnet: 'https://nodes.wavesnodes.com/'
             * - Testnet: 'https://nodes-testnet.wavesnodes.com/'
             */
            $nodeHttp = 'https://nodes-testnet.wavesnodes.com/';
            
            // Initialize the SDK and set the seed.
            $wk = new WavesKit($network);
            $wk->setSeed($seedPhrase);
            
            // Specify the dApp address or its alias.
            $dAppAddress = 'PASTE A DAPP ADDRESS';
            
            // Specify the function name and arguments to invoke.
            $functionName = 'yourFunctionName';
            $functionArgs = [
                // Example: ['type' => 'integer', 'value' => 123],
                // Add your arguments here as needed.
            ];
            
            // Build an Invoke Script Transaction.
            $invokeScriptTx = $wk->txInvokeScript(
                $dAppAddress,   // dApp address or its alias.
                $functionName,  // Function name.
                $functionArgs   // Function arguments.
            );
            
            // Sign the transaction with the private key.
            $invokeScriptTxSigned = $wk->txSign($invokeScriptTx);
            
            // Broadcast the transaction to the node.
            $invokeScriptTxBroadcasted = $wk->txBroadcast($invokeScriptTxSigned);
            
            // Wait for the transaction confirmation.
            sleep(5);
            
            // Fetch a JSON data of the transaction from the node using public API.
            function fetchTransactionJson(string $txId, string $nodeHttp): ?array {
                $url = rtrim($nodeHttp, '/') . '/transactions/info/' . rawurlencode($txId);
                $opts = [
                    "http" => [
                        "method"  => "GET",
                        "header"  => "Accept: application/json\r\n",
                        "timeout" => 10
                    ]
                ];
                $context = stream_context_create($opts);
                $response = @file_get_contents($url, false, $context);
                if ($response === false) return null;
                return json_decode($response, true);
            }
            
            $txId = $invokeScriptTxBroadcasted['id'] ?? null;
            if ($txId === null) {
                echo "Broadcast failed; response:\n";
                var_export($invokeScriptTxBroadcasted);
                exit(1);
            }
            
            $transactionJson = fetchTransactionJson($txId, $nodeHttp);
            
            // Print the results.
            echo "Transaction ID: " . $txId . PHP_EOL;
            echo "Transaction JSON: " . json_encode($transactionJson, JSON_PRETTY_PRINT) . PHP_EOL;
            
          2. Run the waves.php file:
            php waves.php
            

          # Sponsor Fee

          About Sponsor Fee Transaction.

          In your project directory:

          1. Replace the waves.php file code with the following snippet:
            <?php
            
            require_once __DIR__ . '/vendor/autoload.php';
            
            // Necessary import.
            use deemru\WavesKit;
            
            // Hide deprecated warnings temporarily.
            error_reporting(E_ALL & ~E_DEPRECATED);
            
            // Specify your account's seed phrase.
            $seedPhrase = 'PASTE YOUR SEED PHRASE';
            
            /* Specify the network chain ID:
             * - Mainnet: 'W'
             * - Testnet: 'T'
             */
            $network = 'T';
            
            /*
             * Specify the node network's link:
             * - Mainnet: 'https://nodes.wavesnodes.com/'
             * - Testnet: 'https://nodes-testnet.wavesnodes.com/'
             */
            $nodeHttp = 'https://nodes-testnet.wavesnodes.com/';
            
            // Initialize the SDK and set the seed.
            $wk = new WavesKit($network);
            $wk->setSeed($seedPhrase);
            
            // Specify the asset ID to sponsor.
            $assetId = 'PASTE AN ASSET ID';
            
            // Specify the minimal sponsored fee in WAVES.
            $minSponsoredFee = 100000;
            
            // Build a Sponsorship Transaction.
            $sponsorshipTx = $wk->txSponsorship(
                $assetId,          // Asset ID.
                $minSponsoredFee   // Minimal sponsored fee or 0 to cancel sponsorship.
            );
            
            // Sign the transaction with the private key.
            $sponsorshipTxSigned = $wk->txSign($sponsorshipTx);
            
            // Broadcast the transaction to the node.
            $sponsorshipTxBroadcasted = $wk->txBroadcast($sponsorshipTxSigned);
            
            // Wait for the transaction confirmation.
            sleep(5);
            
            // Fetch a JSON data of the transaction from the node using public API.
            function fetchTransactionJson(string $txId, string $nodeHttp): ?array {
                $url = rtrim($nodeHttp, '/') . '/transactions/info/' . rawurlencode($txId);
                $opts = [
                    "http" => [
                        "method"  => "GET",
                        "header"  => "Accept: application/json\r\n",
                        "timeout" => 10
                    ]
                ];
                $context = stream_context_create($opts);
                $response = @file_get_contents($url, false, $context);
                if ($response === false) return null;
                return json_decode($response, true);
            }
            
            $txId = $sponsorshipTxBroadcasted['id'] ?? null;
            if ($txId === null) {
                echo "Broadcast failed; response:\n";
                var_export($sponsorshipTxBroadcasted);
                exit(1);
            }
            
            $transactionJson = fetchTransactionJson($txId, $nodeHttp);
            
            // Print the results.
            echo "Transaction ID: " . $txId . PHP_EOL;
            echo "Transaction JSON: " . json_encode($transactionJson, JSON_PRETTY_PRINT) . PHP_EOL;
            
          2. Run the waves.php file:
            php waves.php
            
          Run Code Sample
          Use Crypto Utilities
          Run Code Sample
          Use Crypto Utilities