Surfboard is a command line interface for working with Ride smart contracts and the Waves blockchain.
- Ride smart contracts compilation.
- Ride REPL interactive console.
# Installation and Configuration
Download and install Node.js: https://nodejs.org/en/download/.
nmp i -g @waves/surfboard
Create an empty folder and run the following command:
The command will create the project structure:
ridefolder containing the dApp script example,
scriptfolder containing the JS script example that assigns the dApp script to account,
testfolder containing the JS test example,
surfboarf.config.jsonfile 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
- 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
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
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
# Running Tests
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:
💡 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
# All Surfboard Commands
See the list of commands in Surfboard repository on GihHub.