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
    • Waves-python
      • Install SDK
        Install SDK
      Waves-python
    • Waves-rust
      • Install SDK
        Install SDK
      Waves-rust
    Client Libraries
      • English
      • Русский
      On this page
        • Installation and Configuration
        • Compiling Ride Script
        • Assigning Ride Script to Account or Asset
        • Running Tests
        • Ride REPL: Interactive Console
        • All Surfboard Commands
      waves_logo Docs

          # Surfboard

          Surfboard is a command line interface for working with Ride smart contracts and the Waves blockchain.

          Key features:

          • Ride smart contracts compilation.
          • Ride REPL interactive console.
          • Running JavaScript tests and scripts.

          Surfboard provides built-in JavaScript functions for interaction with the Waves blockchain: signing and sending transactions, reading blockchain data, working with account keys and others. See the list of functions of js-test-env .

          # Installation and Configuration

          1. Download and install Node.js: https://nodejs.org/en/download/ .

          2. Install Surfboard:

            npm i -g @waves/surfboard@latest
            

            💡 Beta version of Surfboard supports new features of Waves protocol which are now available on Stagenet only:

            npm i -g @waves/surfboard@beta
            
          3. Create an empty folder and run the following command:

            surfboard init
            

          The command will create the project structure:

          • the ride folder containing the dApp script example,
          • the script folder containing the JS script example that assigns the dApp script to account,
          • the test folder containing the JS test example,
          • the surfboarf.config.json file containing the settings for blockchain operation.

          To configure the settings, edit the surfboarf.config.json file or use the following command:

          surfboard config:change KEY VALUE
          
          • The file supports multiple environments. Set the default environment using the defaultEnv parameter.
          • If necessary, change the blockchain network and node URL.
          • Specify the seed phrase for your account.

          💡 Working with a local node is described in the How to Build, Deploy and Test a Waves RIDE dApp article.

          # Compiling Ride Script

          You can write the script code using any text editor, for example, Visual Studio Code with Ride extension.

          Before assigning the script to an account or asset, compile it. Use the built-in JS function compile (see the example of in the script folder), or the following command:

          surfboard compile FILE
          

          For example:

          surfboard compile ride/wallet.ride > wallet.compiled
          

          This command compiles the Ride script example and writes it to the wallet.compiled file in base64. This output can be included in the set script transaction.

          # Assigning Ride Script to Account or Asset

          You can send a set script transaction, issue transaction, or set asset script transaction by running JS script or JS test. To run JS script, use the command:

          surfboard run FILE
          

          For example:

          surfboard run scripts/wallet.deploy.js  --variables 'dappSeed=insert your seed here'
          

          This command executes the JS script example that compiles the Ride script and sends the set script transaction from the account whose seed phrase is specified in the dappSeed variable.

          # Running Tests

          In JS tests, you can use describe, before, it, expect and other functions of mocha and chai libraries. You can find test example in the test folder.

          To run test, use the command:

          surfboard test FILE
          

          # Ride REPL: Interactive Console

          Ride REPL is the easiest way to try out the Ride language and its execution semantic.

          To run Ride REPL, use the command:

          surfboard repl
          

          💡 Run the .editor command to enter multiline mode so you can type or paste a larger code block or multiple definitions.

          To leave REPL, run the .exit command.

          Learn more about Ride REPL

          # All Surfboard Commands

          See the list of commands in Surfboard repository on GihHub.

          Visual Studio Code Extension
          Ride REPL
          Visual Studio Code Extension
          Ride REPL