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
      WavesJ
    • Ts-lib-crypto
      • Install SDK
        Install SDK
      Ts-lib-crypto
    • Waves-PHP
      • Install SDK
        Install SDK
      Waves-PHP
    • PyWaves-CE
      • Install SDK
        Install SDK
      PyWaves-CE
    • Waves-rust
      • Install SDK
        Install SDK
      Waves-rust
    Client Libraries
      • English
      • Русский
      On this page
        • Sign Transaction Using Your Own Seed
        • Sign Transaction on Behalf of User
      waves_logo Docs

          # How to Create Transaction and Send It to Blockchain

          All events on the blockchain are represented as transactions. For example:

          • data transaction writes data to an account data storage;
          • transfer transaction moves a certain amount of the token from one account to another.

          Waves provides variety of transaction types. See the Transaction Type article for more information. Depending on the type, transactions may contain different fields.

          Transaction Proof

          On Waves, each transaction can be sent only from the account. Transaction that is sent from ordinary account (without script) must contain a proof – sender's digital signature. (Smart accounts and dApps can set their own rules for verification of outgoing transations). See the Transaction Proof section for more information.

          There are two options to sign a transaction:

          • If your app sends trancastions on your behalf, you can use your own seed phrase or private key to sign transactions. This way is described in Sign Transaction Using Your Own Seed section below.
          • If your app sends transactions on behalf of range of users, do not ask them for their seed phrases or private keys. Instead, use the interface to the wallet software. This way is described in Sign Transaction on Behalf of User section below.

          Transaction Fee

          Waves transactions are very cheap but not free. Each transaction must contain a fee not less than specified in Transaction fee article.

          💡 On Testnet, a user can top up their WAVES balance using Testnet Faucet.

          Workflow

          In order to put a transaction on the blockchain, complete the following steps:

          1. Fill in the transaction fields.
          2. Sign transaction: generate sender's signature and add it to the transaction.
          3. Send transaction to a node.

          You can send a request to your own node or to one of the Waves nodes with public API:

          • Testnet: https://nodes-testnet.wavesnodes.com
          • Mainnet: https://nodes.wavesnodes.com

          The node checks transaction for validity. If a transaction is valid, then it is put to a generated block in the blockchain, if not — it's rejected by the blockchain. (Invoke script transactions and Exchange transactions can be saved on the blockchain even if the dApp script or the asset script failed, and a fee is charged for such transactions.)

          # Sign Transaction Using Your Own Seed

          # Using JavaScript

          Use waves-transactions library. Transaction proof is generated using your seed phrase. If transaction fee is not specified, it is calculated automatically.

          See function descriptions in documentation on Github.

          import { broadcast } from "@waves/waves-transactions";
          import { data, transfer } from "@waves/waves-transactions";
          
          const nodeUrl = 'https://nodes-testnet.wavesnodes.com';
          const seed = 'insert your seed here';
          
            // Data transaction: add records to the sender's account data storage
          
            const records = [
              { key: 'integerVal', value: 1 },
              { key: 'booleanVal', value: true },
              { key: 'stringVal', value: 'Lorem ipsum dolor sit amet' }
            ]
          
            const dataTx = data({ data: records }, seed); // Create and sign data transaction
          
            broadcast(dataTx,nodeUrl).then(resp => console.log(resp));
          
            // Transfer transaction: send 1 WAVES to the specified address
          
            const money = {
              recipient: '3N1HYdheNiiTtHgi2n3jLAek6N3H4guaciG',
              amount: 100000000 // Actual amount multiplied by 10^decimals
            }
          
            const transferTx = transfer(money, seed); // Create and sign transfer transaction
          
            broadcast(transferTx,nodeUrl).then(resp => console.log(resp));
          
          

          # Using Python

          The simplest way to send a transaction using Python is implementing PyWaves-CE library developed by Waves community. Use Address class to do the operations in blockchain. Explore more use cases in the library documentation .

          import pywaves as pw
          
          myAddress = pw.Address(seed='insert your seed here')
          
          data = [{'type':'string', 'key': 'stringVal', 'value':'Lorem ipsum dolor sit amet'},
                  {'type':'integer',  key: 'integerVal', value: 1 },
                  {'type':'boolean',  key: 'booleanVal', value: true }]
          
          myAddress.dataTransaction(data)
          myAddress.sendWaves(recipient = pw.Address('3P8pGyzZL9AUuFs9YRYPDV3vm73T48ptZxs'),
                              amount = 100000000)
          

          # Sign Transaction on Behalf of User

          # Using JavaScript

          Use Signer library together with ProviderWeb and ProviderCloud developed by the WX Network team. The provider opens a windows where user can confirm a transaction. After that the provider generates a transaction proof.

          If transaction fee is not specified, it is calculated by Signer automatically.

          See full description in Signer documentation.

          Example:

          import { Signer } from '@waves/signer';
          import { ProviderWeb } from '@waves.exchange/provider-web';
          
          // Library initialization
          
          const signer = new Signer({
            NODE_URL: 'https://nodes-testnet.wavesnodes.com'
          });
          signer.setProvider(new ProviderWeb());
          
          // Data transaction: add records to the sender's account data storage
          
          const records = [
            { key: 'integerVal', value: 1 },
            { key: 'booleanVal', value: true },
            { key: 'stringVal', value: 'Lorem ipsum dolor sit amet' }
          ]
          
          const dataTx = signer
            .data({ data: records })
            .broadcast();
          
          dataTx.then(resp => console.log(resp));
          
          console.log('Data tx: ' + dataTx);
          
          // Transfer transaction: send 1 WAVES to the specified address
          
          const money = {
            recipient: '3N1HYdheNiiTtHgi2n3jLAek6N3H4guaciG',
            amount: 100000000,
            }
          
          const transferTx = signer
            .transfer(money)
            .broadcast();
            
          transferTx.then(resp => console.log(resp));
          
          Reading Blockchain Data
          Tokenization
          Reading Blockchain Data
          Tokenization