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
      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.
          • Exchange.
          • Lease.
          • Lease Cancel.
          • Create Alias.
          • Data.
          • Set Script.
          • Set Asset Script.
          • Update Asset Info.
          • Invoke Script.
          • Sponsor Fee.

          # Issue

          About Issue Transaction.

          In your project directory:

          1. Replace the waves.ts file code with the following snippet:
            // Necessary imports.
            import { keyPair } from '@waves/ts-lib-crypto';
            import waves from '@waves/waves-transactions';
            import fetch from 'node-fetch';
            
            // Get the required transaction types.
            const { issue, broadcast } = waves;
            
            // Specify your seed phrase.
            const seed: string = 'PASTE YOUR SEED PHRASE';
            
            // Create the key pair from the seed phrase.
            const { publicKey }: { publicKey: string } = keyPair(seed);
            
            /*
             * Specify the network chain ID:
             * - 'W' for Mainnet.
             * - 'T' for Testnet.
             */
            const chainId: string = 'T';
            
            /*
             * Specify the link for the network:
             * - Mainnet: 'https://nodes.wavesnodes.com/'
             * - Testnet: 'https://nodes-testnet.wavesnodes.com/'
             */
            const nodeUrl: string = 'https://nodes-testnet.wavesnodes.com';
            
            (async (): Promise<void> => {
            try {
                // Compile the Ride script via the Node REST API.
                const scriptSource = `
                {-# STDLIB_VERSION 8 #-}
                {-# CONTENT_TYPE EXPRESSION #-}
                {-# SCRIPT_TYPE ASSET #-}
                true
                `.trim();
            
                const response = await fetch(`${nodeUrl}/utils/script/compileCode`, {
                    method: 'POST',
                    headers: {
                        'Content-Type': 'text/plain',
                        'accept': 'application/json'
                    },
                    body: scriptSource
                });
            
                if (!response.ok) throw new Error(`Failed to compile script: ${response.statusText}`);
                const { script: compiledScript } = await response.json();
            
                // Build an Issue transaction.
                const tx = issue(
                {
                    name: 'TokenName',                // Name.
                    description: 'Token Description', // Description.
                    quantity: 1_00000000,             // Quantity.
                    decimals: 8,                      // Decimals.
                    reissuable: true,                 // Flag indicating whether the asset is reissuable.
                    fee: 1_00000000,                  // Fee amount.
                    chainId,                          // Chain ID.
                    senderPublicKey: publicKey,       // Sender's public key.
                    script: compiledScript            // Asset script or `undefined`.
                },
                seed
                );
            
                // Broadcast the transaction.
                const result = await broadcast(tx, nodeUrl);
            
                // Print the results.
                console.log('Transaction ID:', result.id);
                console.log('Transaction JSON:', JSON.stringify(tx, null, 2));
            } catch (e) {
                console.error('Error:', e);
            }
            })();
            
          2. Run the waves.ts file.

          # Reissue

          About Reissue Transaction.

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

          In your project directory:

          1. Replace the waves.ts file code with the following snippet:
            // Necessary imports.
            import { keyPair } from '@waves/ts-lib-crypto';
            import waves from '@waves/waves-transactions';
            
            // Get the required transaction types.
            const { reissue, broadcast } = waves;
            
            // Specify your seed phrase.
            const seed: string = 'PASTE YOUR SEED PHRASE';
            
            // Create the key pair from the seed phrase.
            const { publicKey }: { publicKey: string } = keyPair(seed);
            
            /*
             * Specify the network chain ID:
             * - 'W' for Mainnet.
             * - 'T' for Testnet.
             */
            const chainId: string = 'T';
            
            /*
             * Specify the link for the network:
             * - Mainnet: 'https://nodes.wavesnodes.com/'
             * - Testnet: 'https://nodes-testnet.wavesnodes.com/'
             */
            const nodeUrl: string = 'https://nodes-testnet.wavesnodes.com';
            
            // Specify an asset ID.
            const assetId: string = 'PASTE AN ASSET ID';
            
            (async (): Promise<void> => {
            try {
                // Build a Reissue transaction.
                const tx = reissue(
                {
                    assetId,                   // ID of the asset to reissue.
                    quantity: 2_00000000,      // Amount to reissue.
                    reissuable: true,          // Flag indicating if further reissue is allowed.
                    fee: 1_00000000,           // Fee amount.
                    chainId,                   // Chain ID.
                    senderPublicKey: publicKey // Sender's public key.
                },
                seed
                );
            
                // Broadcast the transaction.
                const result = await broadcast(tx, nodeUrl);
            
                // Print the results.
                console.log('Transaction ID:', result.id);
                console.log('Transaction JSON:', JSON.stringify(tx, null, 2));
            } catch (e) {
                console.error('Error:', e);
            }
            })();
            
          2. Run the waves.ts file.

          # Burn

          About Burn Transaction.

          In your project directory:

          1. Replace the waves.ts file code with the following snippet:
            // Necessary imports.
            import { keyPair } from '@waves/ts-lib-crypto';
            import waves from '@waves/waves-transactions';
            
            // Get the required transaction types.
            const { burn, broadcast } = waves;
            
            // Specify your seed phrase.
            const seed: string = 'PASTE YOUR SEED PHRASE';
            
            // Create the key pair from the seed phrase.
            const { publicKey }: { publicKey: string } = keyPair(seed);
            
            /*
             * Specify the network chain ID:
             * - 'W' for Mainnet.
             * - 'T' for Testnet.
             */
            const chainId: string = 'T';
            
            /*
             * Specify the link for the network:
             * - Mainnet: 'https://nodes.wavesnodes.com/'
             * - Testnet: 'https://nodes-testnet.wavesnodes.com/'
             */
            const nodeUrl: string = 'https://nodes-testnet.wavesnodes.com';
            
            // Specify an asset ID.
            const assetId: string = 'PASTE AN ASSET ID';
            
            (async (): Promise<void> => {
            try {
                // Build a Burn transaction.
                const tx = burn(
                {
                    assetId,                    // ID of the asset to burn.
                    amount: 50000000,           // Amount to burn in the smallest unit. Example: `50000000` equals 0.5 tokens.
                    fee: 1_00000000,            // Fee amount.
                    chainId,                    // Chain ID.
                    senderPublicKey: publicKey  // Sender's public key.
                },
                seed
                );
            
                // Broadcast the transaction.
                const result = await broadcast(tx, nodeUrl);
            
                // Print the results.
                console.log('Transaction ID:', result.id);
                console.log('Transaction JSON:', JSON.stringify(tx, null, 2));
            } catch (e) {
                console.error('Error:', e);
            }
            })();
            
          2. Run the waves.ts file.

          # Transfer

          About Transfer Transaction.

          In your project directory:

          1. Replace the waves.ts file code with the following snippet:
            // Necessary imports.
            import { keyPair } from '@waves/ts-lib-crypto';
            import waves from '@waves/waves-transactions';
            
            // Get the required transaction types.
            const { transfer, broadcast } = waves;
            
            // Specify your seed phrase.
            const seed: string = 'PASTE YOUR SEED PHRASE';
            
            // Create the key pair from the seed phrase.
            const { publicKey }: { publicKey: string } = keyPair(seed);
            
            // Specify recipient address.
            const recipient: string = 'PASTE A RECIPIENT ADDRESS';
            
            // Specify asset ID or `null` for WAVES.
            const assetId: string | null = null;
            
            /*
             * Specify the network chain ID:
             * - 'W' for Mainnet.
             * - 'T' for Testnet.
             */
            const chainId: string = 'T';
            
            /*
             * Specify the link for the network:
             * - Mainnet: 'https://nodes.wavesnodes.com/'
             * - Testnet: 'https://nodes-testnet.wavesnodes.com/'
             */
            const nodeUrl: string = 'https://nodes-testnet.wavesnodes.com';
            
            (async (): Promise<void> => {
            try {
                // Build a Transfer transaction.
                const tx = transfer(
                {
                    amount: 50000000,          // Amount to transfer in the smallest units.
                    recipient,                 // Recipient's address.
                    assetId,                   // Asset ID or `null` for WAVES.
                    fee: 100000,               // Fee amount in WAVES.
                    feeAssetId: null,          // Fee asset ID or `null` for WAVES.
                    attachment: '',            // Optional attachment as a string.
                    chainId,                   // Chain ID.
                    senderPublicKey: publicKey // Sender's public key.
                },
                seed
                );
            
                // Broadcast the transaction.
                const result = await broadcast(tx, nodeUrl);
            
                // Print the results.
                console.log('Transaction ID:', result.id);
                console.log('Transaction JSON:', JSON.stringify(tx, null, 2));
            } catch (e) {
                console.error('Error:', e);
            }
            })();
            
          2. Run the waves.ts file.

          # Mass Transfer

          About Mass Transfer Transaction.

          In your project directory:

          1. Replace the waves.ts file code with the following snippet:
            // Necessary imports.
            import { keyPair } from '@waves/ts-lib-crypto';
            import waves from '@waves/waves-transactions';
            
            // Get the required transaction types.
            const { massTransfer, broadcast } = waves;
            
            // Specify your seed phrase.
            const seed: string = 'PASTE YOUR SEED PHRASE';
            
            // Create the key pair from the seed phrase.
            const { publicKey }: { publicKey: string } = keyPair(seed);
            
            // Specify the asset ID or `null` for WAVES.
            const assetId: string | null = null;
            
            /*
             * Specify the recipients.
             * Each entry contains a recipient address and the transfer amount in the smallest unit.
             */
            const transfers = [
                {
                    recipient: 'PASTE 1ST RECIPIENT ADDRESS',
                    amount: 10000000 // Example: 0.1 token.
                },
                {
                    recipient: 'PASTE 2ND RECIPIENT ADDRESS',
                    amount: 20000000 // Example: 0.2 token.
                },
                // ...
            ];
            
            /*
             * Specify the network chain ID:
             * - 'W' for Mainnet.
             * - 'T' for Testnet.
             */
            const chainId: string = 'T';
            
            /*
             * Specify the link for the network:
             * - Mainnet: 'https://nodes.wavesnodes.com/'
             * - Testnet: 'https://nodes-testnet.wavesnodes.com/'
             */
            const nodeUrl: string = 'https://nodes-testnet.wavesnodes.com';
            
            (async (): Promise<void> => {
            try {
                // Build a Mass Transfer transaction.
                const tx = massTransfer(
                {
                    assetId,                                // Asset ID or `null` for WAVES.
                    transfers,                              // List of transfers.
                    fee: 100000 + 50000 * transfers.length, // Base fee + 0.0005 WAVES per transfer.
                    attachment: '',                         // Optional attachment.
                    chainId,                                // Chain ID.
                    senderPublicKey: publicKey              // Sender's public key.
                },
                seed
                );
            
                // Broadcast the transaction.
                const result = await broadcast(tx, nodeUrl);
            
                // Print the results.
                console.log('Transaction ID:', result.id);
                console.log('Transaction JSON:', JSON.stringify(tx, null, 2));
            } catch (e) {
                console.error('Error:', e);
            }
            })();
            
          2. Run the waves.ts file.

          # Exchange

          About Exchange Transaction.

          In your project directory:

          1. Replace the waves.ts file code with the following snippet:
            // Necessary imports.
            import { keyPair } from '@waves/ts-lib-crypto';
            import { order, exchange, broadcast } from '@waves/waves-transactions';
            import axios from 'axios';
            
            // Specify your seed phrase.
            const seed: string = 'PASTE YOUR SEED PHRASE';
            
            // Create the key pair from the seed phrase.
            const { publicKey }: { publicKey: string; privateKey: string } = keyPair(seed);
            
            // Specify asset IDs.
            const matcherFeeAssetId: string | null = null;                             // null = WAVES.
            const amountAsset: string = 'kza1SwBGYkha3tWMjZ68p5dUN1o4CgenbbKkVFFEVc4'; // Custom token example.
            const priceAsset: string | null = null;                                    // null = WAVES.
            
            // Specify the matcher address.
            const matcherPublicKey: string = publicKey;
            
            // Helper to fetch decimals for any asset.
            async function getTokenDecimals(assetId: string | null, nodeUrl: string): Promise<number> {
            if (!assetId) return 8; // WAVES always has 8 decimals.
            const resp = await axios.get(`${nodeUrl}/assets/details/${assetId}`);
            return resp.data.decimals;
            }
            
            /*
             * Specify the network chain ID:
             * - 'W' for Mainnet.
             * - 'T' for Testnet.
             */
            const chainId: number = 'T'.charCodeAt(0);
            
            /*
             * Specify the link for the network:
             * - Mainnet: 'https://nodes.wavesnodes.com/'
             * - Testnet: 'https://nodes-testnet.wavesnodes.com/'
             */
            const nodeUrl: string = 'https://nodes-testnet.wavesnodes.com';
            
            // Define shared order parameters.
            const commonOrderParams = {
            matcherPublicKey,                        // Matcher’s public key.
            matcherFee: 300000,                      // Matcher fee.
            version: 3 as const,                     // Order version.
            expiration: Date.now() + 1000 * 60 * 60, // Expiration time: 1 hour.
            timestamp: Date.now()                    // Timestamp.
            };
            
            (async (): Promise<void> => {
            try {
                // Fetch decimals for both assets.
                const amountAssetDecimals = await getTokenDecimals(amountAsset, nodeUrl);
                const priceAssetDecimals = await getTokenDecimals(priceAsset, nodeUrl);
            
                // Calculate the amount and price based on decimals.
                const amount = 1 * 10 ** amountAssetDecimals;                                     // 1 token in the minimal units.
                const pricePerTokenInWaves = 0.01;                                                // Token price: 0.01 WAVES.
                const priceInWavesMinimalUnits = pricePerTokenInWaves * 10 ** priceAssetDecimals; // 1_000_000.
                const price = (priceInWavesMinimalUnits * 10 ** amountAssetDecimals).toString();  // Final price example value.
            
                // Create a buy order.
                const buyOrder = order(
                {
                    ...commonOrderParams,
                    orderType: 'buy',           // Order type.
                    price,                      // Price per token.
                    amount,                     // Token amount.
                    senderPublicKey: publicKey, // Sender's public key.
                    matcherFeeAssetId,          // Matcher fee asset.
                    amountAsset,                // Amount asset.
                    priceAsset                  // Price asset.
                },
                seed
                );
            
                // Create a sell order.
                const sellOrder = order(
                {
                    ...commonOrderParams,
                    orderType: 'sell',          // Order type.
                    price,                      // Price per token.
                    amount,                     // Token amount.
                    senderPublicKey: publicKey, // Sender's public key.
                    matcherFeeAssetId,          // Matcher fee asset.
                    amountAsset,                // Amount asset.
                    priceAsset                  // Price asset.
                },
                seed
                );
            
                // Build an Exchange transaction.
                const tx = exchange(
                {
                    order1: buyOrder,           // First order: buy.
                    order2: sellOrder,          // Second order: sell.
                    amount,                     // Exchange amount.
                    price,                      // Exchange price.
                    buyMatcherFee: 300000,      // Buy matcher fee.
                    sellMatcherFee: 300000,     // Sell matcher fee.
                    fee: 700000,                // Total fee.
                    senderPublicKey: publicKey, // Sender's public key.
                    chainId,                    // Chain ID.
                    type: 7,                    // Transaction type.
                    timestamp: Date.now(),      // Timestamp.
                    version: 3,                 // Exchange tx version.
                    proofs: []                  // Proofs if any.
                },
                seed
                );
            
                // Broadcast the transaction.
                const result = await broadcast(tx, nodeUrl);
            
                // Print the results.
                console.log('Transaction ID:', result.id);
                console.log('Transaction JSON:', JSON.stringify(tx, null, 2));
            } catch (e) {
                console.error('Error:', e);
            }
            })();
            
          2. Run the waves.ts file.

          # Lease

          About Lease Transaction.

          In your project directory:

          1. Replace the waves.ts file code with the following snippet:
            // Necessary imports.
            import { keyPair } from '@waves/ts-lib-crypto';
            import waves from '@waves/waves-transactions';
            
            // Get the required transaction types.
            const { lease, broadcast } = waves;
            
            // Specify your seed phrase.
            const seed: string = 'PASTE YOUR SEED PHRASE';
            
            // Create the key pair from the seed phrase.
            const { publicKey }: { publicKey: string } = keyPair(seed);
            
            // Specify the recipient address.
            const recipient: string = 'PASTE A RECIPIENT ADDRESS';
            
            /*
             * Specify the network chain ID:
             * - 'W' for Mainnet.
             * - 'T' for Testnet.
             */
            const chainId: string = 'T';
            
            /*
             * Specify the link for the network:
             * - Mainnet: 'https://nodes.wavesnodes.com/'
             * - Testnet: 'https://nodes-testnet.wavesnodes.com/'
             */
            const nodeUrl: string = 'https://nodes-testnet.wavesnodes.com';
            
            (async (): Promise<void> => {
            try {
                // Build a Lease transaction.
                const tx = lease(
                {
                    recipient,                 // Address that will receive leased tokens.
                    amount: 500000000,         // Amount to lease in the smallest unit. Example: `500000000` for 5 WAVES.
                    fee: 100000,               // Fee amount.
                    chainId,                   // Chain ID.
                    senderPublicKey: publicKey // Sender's public key.
                },
                seed
                );
            
                // Broadcast the transaction.
                const result = await broadcast(tx, nodeUrl);
            
                // Print the results.
                console.log('Transaction ID:', result.id);
                console.log('Transaction JSON:', JSON.stringify(tx, null, 2));
            } catch (e) {
                console.error('Error:', e);
            }
            })();
            
          2. Run the waves.ts file.

          # Lease Cancel

          About Lease Cancel Transaction.

          In your project directory:

          1. Replace the waves.ts file code with the following snippet:
            // Necessary imports.
            import { keyPair } from '@waves/ts-lib-crypto';
            import waves from '@waves/waves-transactions';
            
            // Get the required transaction types.
            const { cancelLease, broadcast } = waves;
            
            // Specify your seed phrase.
            const seed: string = 'PASTE YOUR SEED PHRASE';
            
            // Create the key pair from the seed phrase.
            const { publicKey }: { publicKey: string } = keyPair(seed);
            
            // Specify the lease transaction ID to cancel.
            const leaseId: string = 'PASTE A LEASE TRANSACTION ID';
            
            /*
             * Specify the network chain ID:
             * - 'W' for Mainnet.
             * - 'T' for Testnet.
             */
            const chainId: string = 'T';
            
            /*
             * Specify the link for the network:
             * - Mainnet: 'https://nodes.wavesnodes.com/'
             * - Testnet: 'https://nodes-testnet.wavesnodes.com/'
             */
            const nodeUrl: string = 'https://nodes-testnet.wavesnodes.com';
            
            (async (): Promise<void> => {
            try {
                // Build a Lease Cancel transaction.
                const tx = cancelLease(
                {
                    leaseId,                   // ID of the lease transaction to cancel.
                    fee: 100000,               // Fee amount.
                    chainId,                   // Chain ID.
                    senderPublicKey: publicKey // Sender's public key.
                },
                seed
                );
            
                // Broadcast the transaction.
                const result = await broadcast(tx, nodeUrl);
            
                // Print the results.
                console.log('Transaction ID:', result.id);
                console.log('Transaction JSON:', JSON.stringify(tx, null, 2));
            } catch (e) {
                console.error('Error:', e);
            }
            })();
            
          2. Run the waves.ts file.

          # Create Alias

          About Create Alias Transaction.

          In your project directory:

          1. Replace the waves.ts file code with the following snippet:
            // Necessary imports.
            import { keyPair } from '@waves/ts-lib-crypto';
            import waves from '@waves/waves-transactions';
            
            // Get the required transaction types.
            const { alias, broadcast } = waves;
            
            // Specify your seed phrase.
            const seed: string = 'PASTE YOUR SEED PHRASE';
            
            // Create the key pair from the seed phrase.
            const { publicKey }: { publicKey: string } = keyPair(seed);
            
            // Specify the alias to register.
            const aliasName: string = 'my-custom-alias'; // Alias example.
            
            /*
             * Specify the network chain ID:
             * - 'W' for Mainnet.
             * - 'T' for Testnet.
             */
            const chainId: string = 'T';
            
            /*
             * Specify the link for the network:
             * - Mainnet: 'https://nodes.wavesnodes.com/'
             * - Testnet: 'https://nodes-testnet.wavesnodes.com/'
             */
            const nodeUrl: string = 'https://nodes-testnet.wavesnodes.com';
            
            (async (): Promise<void> => {
            try {
                // Build an Alias transaction.
                const tx = alias(
                {
                    alias: aliasName,          // Alias name to register.
                    fee: 100000,               // Fee amount.
                    chainId,                   // Chain ID.
                    senderPublicKey: publicKey // Sender's public key.
                },
                seed
                );
            
                // Broadcast the transaction.
                const result = await broadcast(tx, nodeUrl);
            
                // Print the results.
                console.log('Transaction ID:', result.id);
                console.log('Transaction JSON:', JSON.stringify(tx, null, 2));
            } catch (e) {
                console.error('Error:', e);
            }
            })();
            
          2. Run the waves.ts file.

          # Data

          About Data Transaction.

          In your project directory:

          1. Replace the waves.ts file code with the following snippet:
            // Necessary imports.
            import { keyPair } from '@waves/ts-lib-crypto';
            import waves from '@waves/waves-transactions';
            
            // Get the required transaction types.
            const { data, broadcast } = waves;
            
            // Specify your seed phrase.
            const seed: string = 'PASTE YOUR SEED PHRASE';
            
            // Create the key pair from the seed phrase.
            const { publicKey }: { publicKey: string } = keyPair(seed);
            
            // Specify key-value data entries to store on the blockchain.
            const dataEntries = [
            { key: 'intKey', type: 'integer' as const, value: 123 },
            { key: 'boolKey', type: 'boolean' as const, value: true },
            { key: 'stringKey', type: 'string' as const, value: 'Hello Waves' },
            { key: 'binaryKey', type: 'binary' as const, value: 'base64:SGVsbG8=' }
            ];
            
            /*
             * Specify the network chain ID:
             * - 'W' for Mainnet.
             * - 'T' for Testnet.
             */
            const chainId: string = 'T';
            
            /*
             * Specify the link for the network:
             * - Mainnet: 'https://nodes.wavesnodes.com/'
             * - Testnet: 'https://nodes-testnet.wavesnodes.com/'
             */
            const nodeUrl: string = 'https://nodes-testnet.wavesnodes.com';
            
            (async (): Promise<void> => {
            try {
                // Build a Data transaction.
                const tx = data(
                {
                    data: dataEntries,         // Key-value data entries.
                    fee: 500000,               // Fee amount.
                    chainId,                   // Chain ID.
                    senderPublicKey: publicKey // Sender's public key.
                },
                seed
                );
            
                // Broadcast the transaction.
                const result = await broadcast(tx, nodeUrl);
            
                // Print the results.
                console.log('Transaction ID:', result.id);
                console.log('Transaction JSON:', JSON.stringify(tx, null, 2));
            } catch (e) {
                console.error('Error:', e);
            }
            })();
            
          2. Run the waves.ts file.

          # Set Script

          About Set Script Transaction.

          In your project directory:

          1. Replace the waves.ts file code with the following snippet:
            // Necessary imports.
            import { keyPair } from '@waves/ts-lib-crypto';
            import waves from '@waves/waves-transactions';
            import fetch from 'node-fetch';
            
            // Get the required transaction types.
            const { setScript, broadcast } = waves;
            
            // Specify your seed phrase.
            const seed: string = 'PASTE YOUR SEED PHRASE';
            
            // Create the key pair from the seed phrase.
            const { publicKey }: { publicKey: string } = keyPair(seed);
            
            // Specify a Ride account script.
            const script: string = `
            {-# STDLIB_VERSION 6 #-}
            {-# CONTENT_TYPE EXPRESSION #-}
            {-# SCRIPT_TYPE ACCOUNT #-}
            true
            `;
            
            /*
             * Specify the network chain ID:
             * - 'W' for Mainnet.
             * - 'T' for Testnet.
             */
            const chainId: string = 'T';
            
            /*
             * Specify the link for the network:
             * - Mainnet: 'https://nodes.wavesnodes.com/'
             * - Testnet: 'https://nodes-testnet.wavesnodes.com/'
             */
            const nodeUrl: string = 'https://nodes-testnet.wavesnodes.com';
            
            (async (): Promise<void> => {
            try {
                // Compile the script using the Node REST API.
                const response = await fetch(`${nodeUrl}/utils/script/compileCode`, {
                    method: 'POST',
                    headers: {
                        'Content-Type': 'text/plain',
                        'accept': 'application/json'
                    },
                    body: script.trim()
                });
            
                if (!response.ok) throw new Error(`Failed to compile script: ${response.statusText}`);
                const { script: scriptBase64 } = await response.json();
            
                // Build a Set Script transaction.
                const tx = setScript(
                {
                    script: scriptBase64,      // Compiled base64 Ride script or `null` to remove the script.
                    fee: 1400000,              // Fee amount.
                    chainId,                   // Chain ID.
                    senderPublicKey: publicKey // Sender's public key.
                },
                seed
                );
            
                // Broadcast the transaction.
                const result = await broadcast(tx, nodeUrl);
            
                // Print the results.
                console.log('Transaction ID:', result.id);
                console.log('Transaction JSON:', JSON.stringify(tx, null, 2));
            } catch (e) {
                console.error('Error:', e);
            }
            })();
            
          2. Run the waves.ts file.

          # 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.ts file code with the following snippet:
            // Necessary imports.
            import { keyPair } from '@waves/ts-lib-crypto';
            import waves from '@waves/waves-transactions';
            import fetch from 'node-fetch';
            
            // Get the required transaction types.
            const { setAssetScript, broadcast } = waves;
            
            // Specify your seed phrase.
            const seed: string = 'PASTE YOUR SEED PHRASE';
            
            // Create the key pair from the seed phrase.
            const { publicKey }: { publicKey: string } = keyPair(seed);
            
            // Specify the asset ID whose script will be updated.
            const assetId: string = 'PASTE AN ASSET ID';
            
            // Specify a Ride asset script.
            const script: string = `
            {-# STDLIB_VERSION 6 #-}
            {-# CONTENT_TYPE EXPRESSION #-}
            {-# SCRIPT_TYPE ASSET #-}
            true
            `;
            
            /*
             * Specify the network chain ID:
             * - 'W' for Mainnet.
             * - 'T' for Testnet.
             */
            const chainId: string = 'T';
            
            /*
             * Specify the link for the network:
             * - Mainnet: 'https://nodes.wavesnodes.com/'
             * - Testnet: 'https://nodes-testnet.wavesnodes.com/'
             */
            const nodeUrl: string = 'https://nodes-testnet.wavesnodes.com';
            
            (async (): Promise<void> => {
            try {
                // Compile the script using the Node REST API.
                const response = await fetch(`${nodeUrl}/utils/script/compileCode`, {
                    method: 'POST',
                    headers: {
                        'Content-Type': 'text/plain',
                        'accept': 'application/json'
                    },
                    body: script.trim()
                });
            
                if (!response.ok) throw new Error(`Failed to compile script: ${response.statusText}`);
                const { script: scriptBase64 } = await response.json();
            
                // Build a Set Asset Script transaction.
                const tx = setAssetScript(
                {
                    assetId,                   // ID of the asset.
                    script: scriptBase64,      // Compiled base64 Ride script or `null`.
                    fee: 100000000,            // Fee amount in WAVES.
                    chainId,                   // Chain ID.
                    senderPublicKey: publicKey // Sender's public key.
                },
                seed
                );
            
                // Broadcast the transaction.
                const result = await broadcast(tx, nodeUrl);
            
                // Print the results.
                console.log('Transaction ID:', result.id);
                console.log('Transaction JSON:', JSON.stringify(tx, null, 2));
            } catch (e) {
                console.error('Error:', e);
            }
            })();
            
          2. Run the waves.ts file.

          # Update Asset Info

          About Update Asset Info Transaction.

          In your project directory:

          1. Replace the waves.ts file code with the following snippet:
            // Necessary imports.
            import { keyPair } from '@waves/ts-lib-crypto';
            import waves from '@waves/waves-transactions';
            
            // Get the required transaction types.
            const { updateAssetInfo, broadcast } = waves;
            
            // Specify your seed phrase.
            const seed: string = 'PASTE YOUR SEED PHRASE';
            
            // Create the key pair from the seed phrase.
            const { publicKey }: { publicKey: string } = keyPair(seed);
            
            // Specify the asset ID to update.
            const assetId: string = 'PASTE AN ASSET ID';
            
            /*
             * Specify the network chain ID:
             * - 'W' for Mainnet.
             * - 'T' for Testnet.
             */
            const chainId: string = 'T';
            
            /*
             * Specify the link for the network:
             * - Mainnet: 'https://nodes.wavesnodes.com/'
             * - Testnet: 'https://nodes-testnet.wavesnodes.com/'
             */
            const nodeUrl: string = 'https://nodes-testnet.wavesnodes.com';
            
            (async (): Promise<void> => {
            try {
                // Build an Update Asset Info transaction.
                const tx = updateAssetInfo(
                {
                    assetId,                            // Asset ID to update.
                    name: 'NewTokenName',               // New name.
                    description: 'Updated description', // New description.
                    fee: 100000000,                     // Fee amount. Example: `100000000` for 1 WAVES.
                    chainId,                            // Chain ID.
                    senderPublicKey: publicKey          // Sender's public key.
                },
                seed
                );
            
                // Broadcast the transaction.
                const result = await broadcast(tx, nodeUrl);
            
                // Print the results.
                console.log('Transaction ID:', result.id);
                console.log('Transaction JSON:', JSON.stringify(tx, null, 2));
            } catch (e) {
                console.error('Error:', e);
            }
            })();
            
          2. Run the waves.ts file.

          # Invoke Script

          About Invoke Script Transaction.

          In your project directory:

          1. Replace the waves.ts file code with the following snippet:
            // Necessary imports.
            import { keyPair } from '@waves/ts-lib-crypto';
            import waves from '@waves/waves-transactions';
            
            // Get the required transaction types.
            const { invokeScript, broadcast } = waves;
            
            // Specify your seed phrase.
            const seed: string = 'PASTE YOUR SEED PHRASE';
            
            // Create the key pair from the seed phrase.
            const { publicKey }: { publicKey: string } = keyPair(seed);
            
            // Specify the dApp address.
            const dappAddress: string = 'PASTE A DAPP ADDRESS';
            
            // Specify the asset ID or `null` for WAVES.
            const assetId: string = 'kza1SwBGYkha3tWMjO68p5dUN1o4CgenbbKkVFFEVc5'; // Example value.
            
            /*
             * Specify the network chain ID:
             * - 'W' for Mainnet.
             * - 'T' for Testnet.
             */
            const chainId: string = 'T';
            
            /*
             * Specify the link for the network:
             * - Mainnet: 'https://nodes.wavesnodes.com/'
             * - Testnet: 'https://nodes-testnet.wavesnodes.com/'
             */
            const nodeUrl: string = 'https://nodes-testnet.wavesnodes.com';
            
            (async (): Promise<void> => {
            try {
                // Build an Invoke Script transaction.
                const tx = invokeScript(
                {
                    dApp: dappAddress,                // Smart contract address.
                    call: {
                        function: 'yourFunctionName', // Function to call.
                        args: []                      // Arguments, if any.
                    },
                    payment: [
                        {
                            assetId,                  // Asset ID or `null` for WAVES.
                            amount: 1000000           // Amount to send.
                        }
                    ],
                    fee: 500000,                      // Fee amount. The minimum equals 0.005 WAVES.
                    chainId,                          // Chain ID.
                    senderPublicKey: publicKey        // Sender's public key.
                },
                seed
                );
            
                // Broadcast the transaction.
                const result = await broadcast(tx, nodeUrl);
            
                // Print the results.
                console.log('Transaction ID:', result.id);
                console.log('Transaction JSON:', JSON.stringify(tx, null, 2));
            } catch (e) {
                console.error('Error:', e);
            }
            })();
            
          2. Run the waves.ts file.

          # Sponsor Fee

          About Sponsor Fee Transaction.

          In your project directory:

          1. Replace the waves.ts file code with the following snippet:
            // Necessary imports.
            import { keyPair } from '@waves/ts-lib-crypto';
            import waves from '@waves/waves-transactions';
            
            // Get the required transaction types.
            const { sponsorship, broadcast } = waves;
            
            // Specify your seed phrase.
            const seed: string = 'PASTE YOUR SEED PHRASE';
            
            // Create the key pair from the seed phrase.
            const { publicKey }: { publicKey: string } = keyPair(seed);
            
            // Specify the asset ID to sponsor.
            const assetId: string = 'PASTE AN ASSET ID';
            
            /*
             * Specify the network chain ID:
             * - 'W' for Mainnet.
             * - 'T' for Testnet.
             */
            const chainId: string = 'T';
            
            /*
             * Specify the link for the network:
             * - Mainnet: 'https://nodes.wavesnodes.com/'
             * - Testnet: 'https://nodes-testnet.wavesnodes.com/'
             */
            const nodeUrl: string = 'https://nodes-testnet.wavesnodes.com';
            
            (async (): Promise<void> => {
            try {
                // Build a Sponsor Fee transaction.
                const tx = sponsorship(
                {
                    assetId,                   // Asset ID to sponsor.
                    minSponsoredAssetFee: 1,   // Minimum fee in asset's smallest units.
                    fee: 100000000,            // Fee amount in WAVES.
                    chainId,                   // Chain ID.
                    senderPublicKey: publicKey // Sender's public key.
                },
                seed
                );
            
                // Broadcast the transaction.
                const result = await broadcast(tx, nodeUrl);
            
                // Print the results.
                console.log('Transaction ID:', result.id);
                console.log('Transaction JSON:', JSON.stringify(tx, null, 2));
            } catch (e) {
                console.error('Error:', e);
            }
            })();
            
          2. Run the waves.ts file.
          Run Code Sample
          Use Crypto Utilities
          Run Code Sample
          Use Crypto Utilities