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
    • 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 Waves-PHP 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 imports.
            use Waves\Account\PrivateKey;
            use Waves\API\Node;
            use Waves\Transactions\Amount;
            use Waves\Transactions\IssueTransaction;
            use Waves\Model\ChainId;
            use Waves\Model\Base64String;
            
            // Hide deprecated warnings temporarily.
            error_reporting(E_ALL & ~E_DEPRECATED);
            
            // Specify your account's seed phrase.
            $seedPhrase = 'PASTE YOUR SEED PHRASE';
            
            // Generate the private key from the seed phrase.
            $privateKey = PrivateKey::fromSeed($seedPhrase);
            
            /* 
             * Specify the network chain ID:
             * - Mainnet:  `ChainId::MAINNET()`
             * - Testnet:  `ChainId::TESTNET()`
             * - Stagenet: `ChainId::STAGENET()`
             */
            $networkChainId = ChainId::TESTNET();
            
            /*
             * Specify the node network's link:
             * - Mainnet: 'https://nodes.wavesnodes.com/'
             * - Testnet: 'https://nodes-testnet.wavesnodes.com/'
             * - Stagenet: 'https://nodes-stagenet.wavesnodes.com/'
             */
            $node = new Node('https://nodes-testnet.wavesnodes.com', $networkChainId);
            
            // 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 Ride script.
            $compiled = $node->compileScript($scriptSource);
            
            // Get the compiled script as a Base64 string.
            $scriptBase64 = $compiled->script();
            
            // Build an Issue Transaction.
            $issueTx = IssueTransaction::build(
                $privateKey->publicKey(),                      // Sender's public key.
                'TokenName',                                   // Name.
                100000000,                                     // Amount in the smallest units.
                8,                                             // Decimals.
                true,                                          // Flag indicating of the asset is reissuable.
                'Description of the token'                     // Description.
            )
                ->setFee(Amount::of(100000000))                // Transaction fee: 1 WAVES.
                ->setChainId($networkChainId)                  // Network chain ID.
                ->setScript($scriptBase64)                     // Script. To issue an asset without script, remove this line.
                ->setTimestamp(round(microtime(true) * 1000)); // Current timestamp.
            
            // Sign the transaction with the private key.
            $issueTxSigned = $issueTx->addProof($privateKey);
            
            // Broadcast the transaction to the node.
            $issueTxBroadcasted = $node->broadcast($issueTxSigned);
            
            // Wait for the transaction to appear on the blockchain.
            sleep(5);
            
            // Wait for the transaction confirmation.
            $issueTxConfirmed = $node->waitForTransaction($issueTxBroadcasted->id());
            
            // Fetch a JSON data of the transaction from the node.
            function fetchTransactionJson(string $txId): ?array {
                $url = "https://nodes-testnet.wavesnodes.com/transactions/info/" . $txId;
                $response = file_get_contents($url);
                if ($response === false) return null;
                return json_decode($response, true);
            }
            
            $transactionJson = fetchTransactionJson($issueTxConfirmed->id()->toString());
            
            // Print the results.
            echo "Transaction ID: " . $issueTxConfirmed->id()->toString() . 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 imports.
            use Waves\Account\PrivateKey;
            use Waves\API\Node;
            use Waves\Transactions\Amount;
            use Waves\Transactions\ReissueTransaction;
            use Waves\Model\ChainId;
            use Waves\Model\AssetId;
            
            // Hide deprecated warnings temporarily.
            error_reporting(E_ALL & ~E_DEPRECATED);
            
            // Specify your account's seed phrase.
            $seedPhrase = 'PASTE YOUR SEED PHRASE';
            
            // Generate the private key from the seed phrase.
            $privateKey = PrivateKey::fromSeed($seedPhrase);
            
            /* 
             * Specify the network chain ID:
             * - Mainnet:  `ChainId::MAINNET()`
             * - Testnet:  `ChainId::TESTNET()`
             * - Stagenet: `ChainId::STAGENET()`
             */
            $networkChainId = ChainId::TESTNET();
            
            /*
             * Specify the node network's link:
             * - Mainnet: 'https://nodes.wavesnodes.com/'
             * - Testnet: 'https://nodes-testnet.wavesnodes.com/'
             * - Stagenet: 'https://nodes-stagenet.wavesnodes.com/'
             */
            $node = new Node('https://nodes-testnet.wavesnodes.com', $networkChainId);
            
            // Specify the asset ID.
            $assetId = AssetId::fromString('PASTE AN ASSET ID');
            
            // Create the amount object with the value and asset ID.
            $amount = Amount::of(100000000, $assetId); // `100000000` for `1.00000000` tokens.
            
            // Build a Reissue Transaction.
            $reissueTx = ReissueTransaction::build(
                $privateKey->publicKey(),                      // Sender's public key.
                $amount,                                       // Amount to reissue.
                true                                           // Flag indicating whether the asset is reissuable.
            )
                ->setFee(Amount::of(100000000))                // Transaction fee: 1 WAVES.
                ->setChainId($networkChainId)                  // Network chain ID.
                ->setTimestamp(round(microtime(true) * 1000)); // Current timestamp.
            
            // Sign the transaction with the private key.
            $reissueTxSigned = $reissueTx->addProof($privateKey);
            
            // Broadcast the transaction to the node.
            $reissueTxBroadcasted = $node->broadcast($reissueTxSigned);
            
            // Wait for the transaction to appear on the blockchain.
            sleep(5);
            
            // Wait for the transaction confirmation.
            $reissueTxConfirmed = $node->waitForTransaction($reissueTxBroadcasted->id());
            
            // Fetch a JSON data of the transaction from the node.
            function fetchTransactionJson(string $txId): ?array {
                $url = "https://nodes-testnet.wavesnodes.com/transactions/info/" . $txId;
                $response = file_get_contents($url);
                if ($response === false) return null;
                return json_decode($response, true);
            }
            
            $transactionJson = fetchTransactionJson($reissueTxConfirmed->id()->toString());
            
            // Print the results.
            echo "Transaction ID: " . $reissueTxConfirmed->id()->toString() . 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 imports.
            use Waves\Account\PrivateKey;
            use Waves\API\Node;
            use Waves\Transactions\Amount;
            use Waves\Transactions\BurnTransaction;
            use Waves\Model\ChainId;
            use Waves\Model\AssetId;
            
            // Hide deprecated warnings temporarily.
            error_reporting(E_ALL & ~E_DEPRECATED);
            
            // Specify your account's seed phrase.
            $seedPhrase = 'PASTE YOUR SEED PHRASE';
            
            // Generate the private key from the seed phrase.
            $privateKey = PrivateKey::fromSeed($seedPhrase);
            
            /* 
             * Specify the network chain ID:
             * - Mainnet:  `ChainId::MAINNET()`
             * - Testnet:  `ChainId::TESTNET()`
             * - Stagenet: `ChainId::STAGENET()`
             */
            $networkChainId = ChainId::TESTNET();
            
            /*
             * Specify the node network's link:
             * - Mainnet: 'https://nodes.wavesnodes.com/'
             * - Testnet: 'https://nodes-testnet.wavesnodes.com/'
             * - Stagenet: 'https://nodes-stagenet.wavesnodes.com/'
             */
            $node = new Node('https://nodes-testnet.wavesnodes.com', $networkChainId);
            
            // Specify the asset ID.
            $assetId = AssetId::fromString('PASTE AN ASSET ID');
            
            // Create the amount object with the value and asset ID.
            $amount = Amount::of(50000000, $assetId); // `50000000` for `0.50000000` tokens.
            
            // Build a Burn Transaction.
            $burnTx = BurnTransaction::build(
                $privateKey->publicKey(),                      // Sender's public key.
                $amount                                        // Amount to burn.
            )
                ->setFee(Amount::of(100000000))                // Transaction fee: 1 WAVES.
                ->setChainId($networkChainId)                  // Network chain ID.
                ->setTimestamp(round(microtime(true) * 1000)); // Current timestamp.
            
            // Sign the transaction with the private key.
            $burnTxSigned = $burnTx->addProof($privateKey);
            
            // Broadcast the transaction to the node.
            $burnTxBroadcasted = $node->broadcast($burnTxSigned);
            
            // Wait for the transaction to appear on the blockchain.
            sleep(5);
            
            // Wait for the transaction confirmation.
            $burnTxConfirmed = $node->waitForTransaction($burnTxBroadcasted->id());
            
            // Fetch a JSON data of the transaction from the node.
            function fetchTransactionJson(string $txId): ?array {
                $url = "https://nodes-testnet.wavesnodes.com/transactions/info/" . $txId;
                $response = file_get_contents($url);
                if ($response === false) return null;
                return json_decode($response, true);
            }
            
            $transactionJson = fetchTransactionJson($burnTxConfirmed->id()->toString());
            
            // Print the results.
            echo "Transaction ID: " . $burnTxConfirmed->id()->toString() . 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 imports.
            use Waves\Account\PrivateKey;
            use Waves\API\Node;
            use Waves\Transactions\Amount;
            use Waves\Transactions\TransferTransaction;
            use Waves\Transactions\Recipient;
            use Waves\Model\ChainId;
            use Waves\Model\AssetId;
            use Waves\Common\Base58String;
            
            // Hide deprecated warnings temporarily.
            error_reporting(E_ALL & ~E_DEPRECATED);
            
            // Specify your account's seed phrase.
            $seedPhrase = 'PASTE YOUR SEED PHRASE';
            
            // Generate the private key from the seed phrase.
            $privateKey = PrivateKey::fromSeed($seedPhrase);
            
            /* 
             * Specify the network chain ID:
             * - Mainnet:  `ChainId::MAINNET()`
             * - Testnet:  `ChainId::TESTNET()`
             * - Stagenet: `ChainId::STAGENET()`
             */
            $networkChainId = ChainId::TESTNET();
            
            /*
             * Specify the node network's link:
             * - Mainnet: 'https://nodes.wavesnodes.com/'
             * - Testnet: 'https://nodes-testnet.wavesnodes.com/'
             * - Stagenet: 'https://nodes-stagenet.wavesnodes.com/'
             */
            $node = new Node('https://nodes-testnet.wavesnodes.com', $networkChainId);
            
            /* Specify the asset to transfer:
             * - Paste an asset ID;
             * - Or use `AssetId::WAVES()` for WAVES.
             */
            $assetId = AssetId::fromString('PASTE AN ASSET ID');
            
            // Define a recipient address.
            $recipient = Recipient::fromAddressOrAlias('PASTE A RECIPIENT ADDRESS');
            
            // Define the amount to transfer.
            $amount = Amount::of(200000, $assetId); // Example: `200000` for `0.002` WAVES.
            
            // Define an attachment as Base58 encoded string or `null`.
            $attachment = null; // Or Base58String::fromString('Some base58 string');
            
            // Build a Transfer Transaction.
            $transferTx = TransferTransaction::build(
                $privateKey->publicKey(),                       // Sender's public key.
                $recipient,                                     // Recipient's address.
                $amount,                                        // Amount.
                $attachment                                     // Attachment.
            )
                ->setChainId($networkChainId)                   // Chain ID.
                ->setFee(Amount::of(100000))                    // Transaction fee: 0.001 WAVES.
                ->setTimestamp(round(microtime(true) * 1000));  // Current timestamp.
            
            // Sign the transaction with the private key.
            $transferTxSigned = $transferTx->addProof($privateKey);
            
            // Broadcast the transaction to the node.
            $transferTxBroadcasted = $node->broadcast($transferTxSigned);
            
            // Wait for the transaction to appear on the blockchain.
            sleep(5);
            
            // Wait for the transaction confirmation.
            $transferTxConfirmed = $node->waitForTransaction($transferTxBroadcasted->id());
            
            // Fetch a JSON data of the transaction from the node.
            function fetchTransactionJson(string $txId): ?array {
                $url = "https://nodes-testnet.wavesnodes.com/transactions/info/" . $txId;
                $response = file_get_contents($url);
                if ($response === false) return null;
                return json_decode($response, true);
            }
            
            $transactionJson = fetchTransactionJson($transferTxConfirmed->id()->toString());
            
            // Print the results.
            echo "Transaction ID: " . $transferTxConfirmed->id()->toString() . 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 imports.
            use Waves\Account\PrivateKey;
            use Waves\Account\Address;
            use Waves\API\Node;
            use Waves\Transactions\Amount;
            use Waves\Transactions\MassTransferTransaction;
            use Waves\Transactions\Recipient;
            use Waves\Model\ChainId;
            use Waves\Model\AssetId;
            use Waves\Transactions\Mass\Transfer;
            
            // Hide deprecated warnings temporarily.
            error_reporting(E_ALL & ~E_DEPRECATED);
            
            // Specify your account's seed phrase.
            $seedPhrase = 'PASTE YOUR SEED PHRASE';
            
            // Generate the private key from the seed phrase.
            $privateKey = PrivateKey::fromSeed($seedPhrase);
            
            /* 
             * Specify the network chain ID:
             * - Mainnet:  `ChainId::MAINNET()`
             * - Testnet:  `ChainId::TESTNET()`
             * - Stagenet: `ChainId::STAGENET()`
             */
            $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 = new Node('https://nodes-testnet.wavesnodes.com', $networkChainId);
            
            /* Specify the asset to transfer:
             * - Paste an asset ID;
             * - Or use `AssetId::WAVES()` for WAVES.
             */
            $assetId = AssetId::fromString('PASTE AN ASSET ID');
            
            // Define an array of transfers with recipients and their transfer amounts.
            $transfers = [
                new Transfer(
                    Recipient::fromAddressOrAlias('PASTE 1ST RECIPIENT ADDRESS'),
                    10000000 // Amount in smallest units: 0.1 token).
                ),
                new Transfer(
                    Recipient::fromAddressOrAlias('PASTE 2ND RECIPIENT ADDRESS'),
                    20000000 // Amount in smallest units: 0.2 token).
                ),
            ];
            
            // Build a Mass Transfer Transaction.
            $massTransferTx = MassTransferTransaction::build(
                $privateKey->publicKey(),                      // Sender's public key.
                $assetId,                                      // Asset ID.
                $transfers                                     // Array of transfer objects.
            )
                ->setChainId($networkChainId)                  // Network chain ID.
                ->setFee(Amount::of(200000))                   // Transaction fee: 0.002 WAVES.
                ->setTimestamp(round(microtime(true) * 1000)); // Current timestamp.
            
            // Sign the transaction with the private key.
            $massTransferTxSigned = $massTransferTx->addProof($privateKey);
            
            // Broadcast the transaction to the node.
            $massTransferTxBroadcasted = $node->broadcast($massTransferTxSigned);
            
            // Wait for the transaction to appear on the blockchain.
            sleep(5);
            
            // Wait for the transaction confirmation.
            $massTransferTxConfirmed = $node->waitForTransaction($massTransferTxBroadcasted->id());
            
            // Fetch a JSON data of the transaction from the node.
            function fetchTransactionJson(string $txId): ?array {
                $url = "https://nodes-testnet.wavesnodes.com/transactions/info/" . $txId;
                $response = file_get_contents($url);
                if ($response === false) return null;
                return json_decode($response, true);
            }
            
            $transactionJson = fetchTransactionJson($massTransferTxConfirmed->id()->toString());
            
            // Print the results.
            echo "Transaction ID: " . $massTransferTxConfirmed->id()->toString() . 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 imports.
            use Waves\Account\PrivateKey;
            use Waves\API\Node;
            use Waves\Transactions\Recipient;
            use Waves\Transactions\LeaseTransaction;
            use Waves\Model\ChainId;
            use Waves\Transactions\Amount;
            
            // Hide deprecated warnings temporarily.
            error_reporting(E_ALL & ~E_DEPRECATED);
            
            // Specify your account's seed phrase.
            $seedPhrase = 'PASTE YOUR SEED PHRASE';
            
            // Generate the private key from the seed phrase.
            $privateKey = PrivateKey::fromSeed($seedPhrase);
            
            /* 
             * Specify the network chain ID:
             * - Mainnet:  `ChainId::MAINNET()`
             * - Testnet:  `ChainId::TESTNET()`
             * - Stagenet: `ChainId::STAGENET()`
             */
            $networkChainId = ChainId::TESTNET();
            
            /*
             * Specify the node network's link:
             * - Mainnet: 'https://nodes.wavesnodes.com/'
             * - Testnet: 'https://nodes-testnet.wavesnodes.com/'
             * - Stagenet: 'https://nodes-stagenet.wavesnodes.com/'
             */
            $node = new Node('https://nodes-testnet.wavesnodes.com', $networkChainId);
            
            // Specify the lease recipient address.
            $recipient = Recipient::fromAddressOrAlias('PASTE AN ADDRESS');
            
            // Specify the amount to lease in smallest WAVES units.
            $leaseAmount = 100000000; // Example: `100000000` for 1 WAVES.
            
            // Build a Lease Transaction.
            $leaseTx = LeaseTransaction::build(
                $privateKey->publicKey(),                      // Sender's public key.
                $recipient,                                    // Recipient's address.
                $leaseAmount                                   // Amount.
            )
                ->setChainId($networkChainId)                  // Network chain ID.
                ->setFee(Amount::of(100000))                   // Fee: 0.001 WAVES.
                ->setTimestamp(round(microtime(true) * 1000)); // Current timestamp in milliseconds.
            
            // Sign the transaction with the private key.
            $leaseTxSigned = $leaseTx->addProof($privateKey);
            
            // Broadcast the transaction to the node.
            $leaseTxBroadcasted = $node->broadcast($leaseTxSigned);
            
            // Wait for the transaction to appear on the blockchain.
            sleep(5);
            
            // Wait for the transaction confirmation.
            $leaseTxConfirmed = $node->waitForTransaction($leaseTxBroadcasted->id());
            
            // Fetch a JSON data of the transaction from the node.
            function fetchTransactionJson(string $txId): ?array {
                $url = "https://nodes-testnet.wavesnodes.com/transactions/info/" . $txId;
                $response = file_get_contents($url);
                if ($response === false) return null;
                return json_decode($response, true);
            }
            
            $transactionJson = fetchTransactionJson($leaseTxConfirmed->id()->toString());
            
            // Print the results.
            echo "Transaction ID: " . $leaseTxConfirmed->id()->toString() . 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 imports.
            use Waves\Account\PrivateKey;
            use Waves\API\Node;
            use Waves\Transactions\LeaseCancelTransaction;
            use Waves\Model\ChainId;
            use Waves\Model\Id;
            use Waves\Transactions\Amount;
            
            // Hide deprecated warnings temporarily.
            error_reporting(E_ALL & ~E_DEPRECATED);
            
            // Specify your account's seed phrase.
            $seedPhrase = 'PASTE YOUR SEED PHRASE';
            
            // Generate the private key from the seed phrase.
            $privateKey = PrivateKey::fromSeed($seedPhrase);
            
            /* 
             * Specify the network chain ID:
             * - Mainnet:  `ChainId::MAINNET()`
             * - Testnet:  `ChainId::TESTNET()`
             * - Stagenet: `ChainId::STAGENET()`
             */
            $networkChainId = ChainId::TESTNET();
            
            /*
             * Specify the node network's link:
             * - Mainnet: 'https://nodes.wavesnodes.com/'
             * - Testnet: 'https://nodes-testnet.wavesnodes.com/'
             * - Stagenet: 'https://nodes-stagenet.wavesnodes.com/'
             */
            $node = new Node('https://nodes-testnet.wavesnodes.com', $networkChainId);
            
            // Define the lease transaction ID to cancel.
            $leaseTxIdToCancel = Id::fromString('PASTE A LEASE TRANSACTION ID');
            
            // Build a Lease Cancel Transaction.
            $leaseCancelTx = LeaseCancelTransaction::build(
                $privateKey->publicKey(),                      // Sender's public key.
                $leaseTxIdToCancel                             // Lease Transaction's ID.
            )
                ->setChainId($networkChainId)                  // Network chain ID.
                ->setFee(Amount::of(100000))                   // Fee: 0.001 WAVES.
                ->setTimestamp(round(microtime(true) * 1000)); // Current timestamp.
            
            // Sign the transaction with the private key.
            $leaseCancelTxSigned = $leaseCancelTx->addProof($privateKey);
            
            // Broadcast the transaction to the node.
            $leaseCancelTxBroadcasted = $node->broadcast($leaseCancelTxSigned);
            
            // Wait for the transaction to appear on the blockchain.
            sleep(5);
            
            // Wait for the transaction confirmation.
            $leaseCancelTxConfirmed = $node->waitForTransaction($leaseCancelTxBroadcasted->id());
            
            // Fetch a JSON data of the transaction from the node.
            function fetchTransactionJson(string $txId): ?array {
                $url = "https://nodes-testnet.wavesnodes.com/transactions/info/" . $txId;
                $response = file_get_contents($url);
                if ($response === false) return null;
                return json_decode($response, true);
            }
            
            $transactionJson = fetchTransactionJson($leaseCancelTxConfirmed->id()->toString());
            
            // Print the results.
            echo "Transaction ID: " . $leaseCancelTxConfirmed->id()->toString() . 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 imports.
            use Waves\Account\PrivateKey;
            use Waves\API\Node;
            use Waves\Transactions\CreateAliasTransaction;
            use Waves\Model\ChainId;
            use Waves\Model\Alias;
            use Waves\Transactions\Amount;
            
            // Hide deprecated warnings temporarily.
            error_reporting(E_ALL & ~E_DEPRECATED);
            
            // Specify your account's seed phrase.
            $seedPhrase = 'PASTE YOUR SEED PHRASE';
            
            // Generate the private key from the seed phrase.
            $privateKey = PrivateKey::fromSeed($seedPhrase);
            
            /* 
             * Specify the network chain ID:
             * - Mainnet:  `ChainId::MAINNET()`
             * - Testnet:  `ChainId::TESTNET()`
             * - Stagenet: `ChainId::STAGENET()`
             */
            $networkChainId = ChainId::TESTNET();
            
            /*
             * Specify the node network's link:
             * - Mainnet: 'https://nodes.wavesnodes.com/'
             * - Testnet: 'https://nodes-testnet.wavesnodes.com/'
             * - Stagenet: 'https://nodes-stagenet.wavesnodes.com/'
             */
            $node = new Node('https://nodes-testnet.wavesnodes.com', $networkChainId);
            
            // Create an alias object.
            $aliasName = 'SPECIFY YOUR ALIAS';
            $alias = Alias::fromString($aliasName);
            
            // Build a Create Alias Transaction.
            $createAliasTx = CreateAliasTransaction::build(
                $privateKey->publicKey(),                      // Sender's public key.
                $alias                                         // Alias.
            )
                ->setChainId($networkChainId)                  // Network chain ID.
                ->setFee(Amount::of(100000))                   // Fee: 0.001 WAVES.
                ->setTimestamp(round(microtime(true) * 1000)); // Current timestamp.
            
            // Sign the transaction with the private key.
            $createAliasTxSigned = $createAliasTx->addProof($privateKey);
            
            // Broadcast the transaction to the node.
            $createAliasTxBroadcasted = $node->broadcast($createAliasTxSigned);
            
            // Wait for the transaction to appear on the blockchain.
            sleep(5);
            
            // Wait for the transaction confirmation.
            $createAliasTxConfirmed = $node->waitForTransaction($createAliasTxBroadcasted->id());
            
            // Fetch a JSON data of the transaction from the node.
            function fetchTransactionJson(string $txId): ?array {
                $url = "https://nodes-testnet.wavesnodes.com/transactions/info/" . $txId;
                $response = file_get_contents($url);
                if ($response === false) return null;
                return json_decode($response, true);
            }
            
            $transactionJson = fetchTransactionJson($createAliasTxConfirmed->id()->toString());
            
            // Print the results.
            echo "Transaction ID: " . $createAliasTxConfirmed->id()->toString() . 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 imports.
            use Waves\Account\PrivateKey;
            use Waves\API\Node;
            use Waves\Transactions\Amount;
            use Waves\Transactions\DataTransaction;
            use Waves\Model\ChainId;
            use Waves\Model\DataEntry;
            use Waves\Model\EntryType;
            
            // Hide deprecated warnings temporarily.
            error_reporting(E_ALL & ~E_DEPRECATED);
            
            // Specify your account's seed phrase.
            $seedPhrase = 'PASTE YOUR SEED PHRASE';
            
            // Generate the private key from the seed phrase.
            $privateKey = PrivateKey::fromSeed($seedPhrase);
            
            /* 
             * Specify the network chain ID:
             * - Mainnet:  `ChainId::MAINNET()`
             * - Testnet:  `ChainId::TESTNET()`
             * - Stagenet: `ChainId::STAGENET()`
             */
            $networkChainId = ChainId::TESTNET();
            
            /*
             * Specify the node network's link:
             * - Mainnet: 'https://nodes.wavesnodes.com/'
             * - Testnet: 'https://nodes-testnet.wavesnodes.com/'
             * - Stagenet: 'https://nodes-stagenet.wavesnodes.com/'
             */
            $node = new Node('https://nodes-testnet.wavesnodes.com', $networkChainId);
            
            // Prepare data entries.
            $data = [
                DataEntry::build('key_string', EntryType::STRING, 'value string'),
                DataEntry::build('key_boolean', EntryType::BOOLEAN, true),
                DataEntry::build('key_integer', EntryType::INTEGER, 42),
                DataEntry::build('key_binary', EntryType::BINARY, base64_encode('Hello Binary')),
                DataEntry::build('key_delete', EntryType::DELETE)
            ]; // Example values.
            
            // Build a Data Transaction.
            $dataTx = DataTransaction::build(
                $privateKey->publicKey(),                      // Sender's public key.
                $data                                          // Data entries array.
            )
                ->setFee(Amount::of(100000))                   // Transaction fee: 0.001 WAVES.
                ->setChainId($networkChainId)                  // Network chain ID.
                ->setTimestamp(round(microtime(true) * 1000)); // Current timestamp.
            
            // Sign the transaction with the private key.
            $dataTxSigned = $dataTx->addProof($privateKey);
            
            // Broadcast the transaction to the node.
            $dataTxBroadcasted = $node->broadcast($dataTxSigned);
            
            // Wait for the transaction to appear on the blockchain.
            sleep(5);
            
            // Wait for the transaction confirmation.
            $dataTxConfirmed = $node->waitForTransaction($dataTxBroadcasted->id());
            
            // Fetch a JSON data of the transaction from the node.
            function fetchTransactionJson(string $txId): ?array {
                $url = "https://nodes-testnet.wavesnodes.com/transactions/info/" . $txId;
                $response = file_get_contents($url);
                if ($response === false) return null;
                return json_decode($response, true);
            }
            
            $transactionJson = fetchTransactionJson($dataTxConfirmed->id()->toString());
            
            // Print the results.
            echo "Transaction ID: " . $dataTxConfirmed->id()->toString() . 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 imports.
            use Waves\Account\PrivateKey;
            use Waves\API\Node;
            use Waves\Transactions\Amount;
            use Waves\Transactions\SetScriptTransaction;
            use Waves\Model\ChainId;
            
            // Hide deprecated warnings temporarily.
            error_reporting(E_ALL & ~E_DEPRECATED);
            
            // Specify your account's seed phrase.
            $seedPhrase = 'PASTE YOUR SEED PHRASE';
            
            // Generate the private key from the seed phrase.
            $privateKey = PrivateKey::fromSeed($seedPhrase);
            
            /* 
             * Specify the network chain ID:
             * - Mainnet:  `ChainId::MAINNET()`
             * - Testnet:  `ChainId::TESTNET()`
             * - Stagenet: `ChainId::STAGENET()`
             */
            $networkChainId = ChainId::TESTNET();
            
            /*
             * Specify the node network's link:
             * - Mainnet: 'https://nodes.wavesnodes.com/'
             * - Testnet: 'https://nodes-testnet.wavesnodes.com/'
             * - Stagenet: 'https://nodes-stagenet.wavesnodes.com/'
             */
            $node = new Node('https://nodes-testnet.wavesnodes.com', $networkChainId);
            
            // Define a Ride script.
            $scriptSource = 
            "{-# STDLIB_VERSION 6 #-}\n" .
            "{-# CONTENT_TYPE EXPRESSION #-}\n" .
            "{-# SCRIPT_TYPE ACCOUNT #-}\n\n" .
            "true";
            
            // Compile the Ride script.
            $compiled = $node->compileScript($scriptSource);
            
            // Get the compiled script as a Base64 string.
            $scriptBase64 = $compiled->script();
            
            // Build a Set Script Transaction.
            $setScriptTx = (new SetScriptTransaction())
                ->setSender($privateKey->publicKey())              // Sender's public key.
                ->setScript($scriptBase64)                         // Account script. To remove the script, remove this line.
                ->setType(SetScriptTransaction::TYPE)              // Transaction type.
                ->setVersion(SetScriptTransaction::LATEST_VERSION) // Transaction version.
                ->setFee(Amount::of(1400000))                      // Minimum transaction fee.
                ->setChainId($networkChainId)                      // Network chain ID.
                ->setTimestamp(round(microtime(true) * 1000));     // Current timestamp.
            
            // Sign the transaction with the private key.
            $setScriptTxSigned = $setScriptTx->addProof($privateKey);
            
            // Broadcast the transaction to the node.
            $setScriptTxBroadcasted = $node->broadcast($setScriptTxSigned);
            
            // Wait for the transaction to appear on the blockchain.
            sleep(5);
            
            // Wait for the transaction confirmation.
            $setScriptTxConfirmed = $node->waitForTransaction($setScriptTxBroadcasted->id());
            
            // Fetch a JSON data of the transaction from the node.
            function fetchTransactionJson(string $txId): ?array {
                $url = "https://nodes-testnet.wavesnodes.com/transactions/info/" . $txId;
                $response = file_get_contents($url);
                if ($response === false) return null;
                return json_decode($response, true);
            }
            
            $transactionJson = fetchTransactionJson($setScriptTxConfirmed->id()->toString());
            
            // Print the results.
            echo "Transaction ID: " . $setScriptTxConfirmed->id()->toString() . 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 imports.
            use Waves\Account\PrivateKey;
            use Waves\API\Node;
            use Waves\Model\ChainId;
            use Waves\Model\Base64String;
            use Waves\Model\AssetId;
            use Waves\Transactions\SetAssetScriptTransaction;
            use Waves\Transactions\Amount;
            
            // Hide deprecated warnings temporarily.
            error_reporting(E_ALL & ~E_DEPRECATED);
            
            // Specify your account's seed phrase.
            $seedPhrase = 'PASTE YOUR SEED PHRASE';
            
            // Generate the private key from the seed phrase.
            $privateKey = PrivateKey::fromSeed($seedPhrase);
            
            /* 
             * Specify the network chain ID:
             * - Mainnet:  `ChainId::MAINNET()`
             * - Testnet:  `ChainId::TESTNET()`
             * - Stagenet: `ChainId::STAGENET()`
             */
            $networkChainId = ChainId::TESTNET();
            
            /*
             * Specify the node network's link:
             * - Mainnet: 'https://nodes.wavesnodes.com/'
             * - Testnet: 'https://nodes-testnet.wavesnodes.com/'
             * - Stagenet: 'https://nodes-stagenet.wavesnodes.com/'
             */
            $node = new Node('https://nodes-testnet.wavesnodes.com', $networkChainId);
            
            // Specify a Ride script for the asset.
            $scriptSource =
                "{-# STDLIB_VERSION 6 #-}\n" .
                "{-# CONTENT_TYPE EXPRESSION #-}\n" .
                "{-# SCRIPT_TYPE ASSET #-}\n\n" .
                "true";
            
            // Compile the Ride script.
            $compiled = $node->compileScript($scriptSource);
            
            // Get the compiled script as a Base64 string.
            $scriptBase64 = $compiled->script();
            
            // Set the asset ID to modify.
            $assetId = AssetId::fromString('PASTE AN ASSET ID');
            
            // Build a Set Asset Script transaction.
            $setAssetScriptTx = SetAssetScriptTransaction::build(
                $privateKey->publicKey(),                      // Sender's public key.
                $assetId,                                      // Asset ID.
                $scriptBase64                                  // Compiled script.
            )
                ->setFee(Amount::of(100000000))                // Transaction fee: 1 WAVES.
                ->setChainId($networkChainId)                  // Network chain ID.
                ->setTimestamp(round(microtime(true) * 1000)); // Current timestamp.
            
            // Sign the transaction with the private key.
            $setAssetScriptTxSigned = $setAssetScriptTx->addProof($privateKey);
            
            // Broadcast the transaction to the node.
            $setAssetScriptBroadcasted = $node->broadcast($setAssetScriptTxSigned);
            
            // Wait a few seconds for confirmation.
            sleep(5);
            
            // Wait for the transaction to be confirmed.
            $setAssetScriptConfirmed = $node->waitForTransaction($setAssetScriptBroadcasted->id());
            
            // Fetch a JSON data of the transaction from the node.
            function fetchTransactionJson(string $txId): ?array {
                $url = "https://nodes-testnet.wavesnodes.com/transactions/info/" . $txId;
                $response = file_get_contents($url);
                if ($response === false) return null;
                return json_decode($response, true);
            }
            
            $transactionJson = fetchTransactionJson($setAssetScriptConfirmed->id()->toString());
            
            // Print the results.
            echo "Transaction ID: " . $setAssetScriptConfirmed->id()->toString() . PHP_EOL;
            

          echo "Transaction JSON: " . json_encode($transactionJson, JSON_PRETTY_PRINT) . PHP_EOL; 2. Run the `waves.php` file:bash 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 imports.
            use Waves\Account\PrivateKey;
            use Waves\API\Node;
            use Waves\Transactions\Amount;
            use Waves\Transactions\UpdateAssetInfoTransaction;
            use Waves\Model\ChainId;
            use Waves\Model\AssetId;
            
            // Hide deprecated warnings temporarily.
            error_reporting(E_ALL & ~E_DEPRECATED);
            
            // Specify your account's seed phrase.
            $seedPhrase = 'PASTE YOUR SEED PHRASE';
            
            // Generate the private key from the seed phrase.
            $privateKey = PrivateKey::fromSeed($seedPhrase);
            
            /* 
             * Specify the network chain ID:
             * - Mainnet:  `ChainId::MAINNET()`
             * - Testnet:  `ChainId::TESTNET()`
             * - Stagenet: `ChainId::STAGENET()`
             */
            $networkChainId = ChainId::TESTNET();
            
            /*
             * Specify the node network's link:
             * - Mainnet: 'https://nodes.wavesnodes.com/'
             * - Testnet: 'https://nodes-testnet.wavesnodes.com/'
             * - Stagenet: 'https://nodes-stagenet.wavesnodes.com/'
             */
            $node = new Node('https://nodes-testnet.wavesnodes.com', $networkChainId);
            
            // Specify an asset ID.
            $assetId = AssetId::fromString('PASTE AN ASSET ID');
            
            // Build an Update Asset Info Transaction.
            $updateTx = UpdateAssetInfoTransaction::build(
                $privateKey->publicKey(),                      // Sender's public key.
                $assetId,                                      // Asset ID.
                'UpdatedName',                                // New name.
                'Updated description of the token'             // New description.
            )
                ->setFee(Amount::of(100000000))                // Transaction fee: 1 WAVES.
                ->setChainId($networkChainId)                  // Chain ID.
                ->setTimestamp(round(microtime(true) * 1000)); // Current timestamp.
            
            // Sign the transaction with the private key.
            $signedTx = $updateTx->addProof($privateKey);
            
            // Broadcast the transaction to the node.
            $broadcastedTx = $node->broadcast($signedTx);
            
            // Wait for the transaction to appear on the blockchain.
            sleep(5);
            
            // Wait for the transaction confirmation.
            $confirmedTx = $node->waitForTransaction($broadcastedTx->id());
            
            // Fetch a JSON data of the transaction from the node.
            function fetchTransactionJson(string $txId): ?array {
                $url = "https://nodes-testnet.wavesnodes.com/transactions/info/" . $txId;
                $response = file_get_contents($url);
                if ($response === false) return null;
                return json_decode($response, true);
            }
            
            $transactionJson = fetchTransactionJson($confirmedTx->id()->toString());
            
            // Print the results.
            echo "Transaction ID: " . $confirmedTx->id()->toString() . 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 imports.
            use Waves\Account\PrivateKey;
            use Waves\API\Node;
            use Waves\Transactions\Amount;
            use Waves\Transactions\Invocation\Arg;
            use Waves\Transactions\Invocation\FunctionCall;
            use Waves\Transactions\InvokeScriptTransaction;
            use Waves\Transactions\Recipient;
            use Waves\Common\Value;
            use Waves\Model\ChainId;
            
            // Hide deprecated warnings temporarily.
            error_reporting(E_ALL & ~E_DEPRECATED);
            
            // Specify your account's seed phrase.
            $seedPhrase = 'PASTE YOUR SEED PHRASE';
            
            // Generate the private key from the seed phrase.
            $privateKey = PrivateKey::fromSeed($seedPhrase);
            
            /* 
             * Specify the network chain ID:
             * - Mainnet:  `ChainId::MAINNET()`
             * - Testnet:  `ChainId::TESTNET()`
             * - Stagenet: `ChainId::STAGENET()`
             */
            $networkChainId = ChainId::TESTNET();
            
            /*
             * Specify the node network's link:
             * - Mainnet: 'https://nodes.wavesnodes.com/'
             * - Testnet: 'https://nodes-testnet.wavesnodes.com/'
             * - Stagenet: 'https://nodes-stagenet.wavesnodes.com/'
             */
            $node = new Node('https://nodes-testnet.wavesnodes.com', $networkChainId);
            
            // Specify a dApp address.
            $dApp = Recipient::fromAddressOrAlias('PASTE A DAPP ADDRESS');
            
            // Prepare arguments. Example values:
            $args = [];
            $args[] = Arg::as(Arg::STRING, Value::as('ExampleString'));
            $args[] = Arg::as(Arg::INTEGER, Value::as(123));
            $args[] = Arg::as(Arg::BOOLEAN, Value::as(true));
            
            // Prepare a function call.
            $functionCall = FunctionCall::as('functionName', $args); // Example value.
            
            // Payments array, empty if no payments.
            $payments = [];
            
            // Build an Invoke Script Transaction.
            $invokeTx = InvokeScriptTransaction::build(
                $privateKey->publicKey(),                      // Sender's public key.
                $dApp,                                         // dApp's address.
                $functionCall,                                 // Function call.
                $payments                                      // Attached payments.
            )
                ->setFee(Amount::of(500000))                   // Transaction fee: 0.005 WAVES.
                ->setChainId($networkChainId)                  // Chain ID.
                ->setTimestamp(round(microtime(true) * 1000)); // Current timestamp.
            
            // Sign the transaction with the private key.
            $invokeTxSigned = $invokeTx->addProof($privateKey);
            
            // Broadcast the transaction to the node.
            $invokeTxBroadcasted = $node->broadcast($invokeTxSigned);
            
            // Wait for the transaction to appear on the blockchain.
            sleep(5);
            $invokeTxConfirmed = $node->waitForTransaction($invokeTxBroadcasted->id());
            
            // Fetch a JSON data of the transaction from the node.
            function fetchTransactionJson(string $txId): ?array {
                $url = "https://nodes-testnet.wavesnodes.com/transactions/info/" . $txId;
                $response = file_get_contents($url);
                if ($response === false) return null;
                return json_decode($response, true);
            }
            
            $transactionJson = fetchTransactionJson($invokeTxConfirmed->id()->toString());
            
            // Print the results.
            echo "Transaction ID: " . $invokeTxConfirmed->id()->toString() . 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 imports.
            use Waves\Account\PrivateKey;
            use Waves\API\Node;
            use Waves\Transactions\Amount;
            use Waves\Transactions\SponsorFeeTransaction;
            use Waves\Model\ChainId;
            use Waves\Model\AssetId;
            
            // Hide deprecated warnings temporarily.
            error_reporting(E_ALL & ~E_DEPRECATED);
            
            // Specify your account's seed phrase.
            $seedPhrase = 'PASTE YOUR SEED PHRASE';
            
            // Generate the private key from the seed phrase.
            $privateKey = PrivateKey::fromSeed($seedPhrase);
            
            /* 
             * Specify the network chain ID:
             * - Mainnet:  `ChainId::MAINNET()`
             * - Testnet:  `ChainId::TESTNET()`
             * - Stagenet: `ChainId::STAGENET()`
             */
            $networkChainId = ChainId::TESTNET();
            
            /*
             * Specify the node network's link:
             * - Mainnet: 'https://nodes.wavesnodes.com/'
             * - Testnet: 'https://nodes-testnet.wavesnodes.com/'
             * - Stagenet: 'https://nodes-stagenet.wavesnodes.com/'
             */
            $node = new Node('https://nodes-testnet.wavesnodes.com', $networkChainId);
            
            // Specify an asset ID.
            $assetId = AssetId::fromString('PASTE AN ASSET ID');
            
            // Build a Sponsor Fee Transaction.
            $sponsorTx = SponsorFeeTransaction::build(
                $privateKey->publicKey(),                      // Sender's public key.
                $assetId,                                      // Asset ID.
                true                                           // Flag indicating whether sponsorship is enabled.
            )
                ->setFee(Amount::of(100000))                   // Fee: 0.001 WAVES.
                ->setChainId($networkChainId)                  // Chain ID.
                ->setTimestamp(round(microtime(true) * 1000)); // Current timestamp.
            
            // Sign the transaction with the private key.
            $sponsorTxSigned = $sponsorTx->addProof($privateKey);
            
            // Broadcast the transaction to the node.
            $sponsorTxBroadcasted = $node->broadcast($sponsorTxSigned);
            
            // Wait for the transaction to appear on the blockchain.
            sleep(5);
            
            // Wait for the transaction confirmation.
            $sponsorTxConfirmed = $node->waitForTransaction($sponsorTxBroadcasted->id());
            
            // Fetch a JSON data of the transaction from the node.
            function fetchTransactionJson(string $txId): ?array {
                $url = "https://nodes-testnet.wavesnodes.com/transactions/info/" . $txId;
                $response = file_get_contents($url);
                if ($response === false) return null;
                return json_decode($response, true);
            }
            
            $transactionJson = fetchTransactionJson($sponsorTxConfirmed->id()->toString());
            
            // Print the results.
            echo "Transaction ID: " . $sponsorTxConfirmed->id()->toString() . 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