Compiler & Toolset

We've developed a toolset for the Move VM and language which allows for:

  • Compiling Move code into bytecode.

  • Testing Move code with tests and formal verification.

  • Viewing Move resources (stored data) from remote blockchain nodes.

  • Disassembling Move binary and even read human readable result.

Installation

All tools stored in our Move-Tools Github repository.

You can download all tools from releases page.

After downloading rename tool(s) removing version and os and moving binary to /usr/local/bin/.

For example, for dove:

mv ./dove-1.1.0-linux-x86_64 ./dove
chmod +x ./dove
mv ./dove /usr/local/bin/dove

For Windows:

  1. Go to "Program Files" directory.

  2. Create there "dove" directory.

  3. Rename the downloaded file to "dove" and put it into "dove" directory.

Now dove is available from "cmd".

To build tools from sources see README.

Dove

Dove is Move compiler and package manager. Using Dove you can create your own Move smart contract projects.

Let's create first project:

dove new first_project --dialect polkadot --address <address>

Replace address with your address.

Navigate to first_project folder and see what's automatically generated inside:

cd ./first_project
ls -la
  • Dove.toml - configuration file/.

  • modules - place modules here.

  • scripts - place scripts here.

  • tests - place tests here.

Let's see what contains Dove.toml:

[package]
name = "first_project1"
account_address = "<your address>"
dialect = "polkadot"
dependencies = [
{ git = "https://github.com/pontem-network/move-stdlib" }
]
  • name - name of project.

  • account_address - address of your account, used during compilation.

  • dialect - can be Diem, or polkadot.

  • dependencies - list of dependencies, git (tag or branch also supported) or local folder (use path).

Let's create empty script and build it:

touch ./scripts/test.move

Put there Move code:

script {
fun test() {
}
}

Build your empty project:

dove build # Build script without providing arguments, so can't use in pallet.
dove ct 'test()' # Build script with arguments.

There is a difference between build and ct commands, if you want just to build your scripts use build, if you want to send transactions to the pallet use ct and provide arguments. Use ct only for scripts, build modules with build command.

dove ct --help

See your builded artifacts in ./target folder:

ls -la ./target/scripts # Just built script
ls -la ./target/transactions # Script with arguments for pallet.

Script Transaction

Command ct allows you to create transactions for an Polkadot based chain with Move Pallet.

ct takes script identifier, type parameters, and arguments and creates a transaction file as an artifact of work:

Example:

dove ct 'store_u64(60)'

This command searches for the script by name 'store_u64' in the script directory. Then it compiles it and creates a transaction file.

This command will fail if:

  • There is no script with the name given name 'store_u64'.

  • There is more than one script with the name 'store_64'.

  • The passed parameters or type parameters do not match the script parameters.

  • There are syntax errors in the script.

  • You can use type parameters like in the move language.

Example:

dove ct 'create_account<0x01::PONT::T>()'

You allow to use addresses:

dove ct 'send_payment(1exaAg2VJRQbyUBAeXcktChCAqjVP9TUxF3zo23R2T6EGdE)'

Supported types:

Numbers (u8, u64, u128):

dove ct 'my_script(10, 1024)'

Boolean:

dove ct 'my_script(true, false)'

Addresses:

dove ct 'my_script(1exaAg2VJRQbyUBAeXcktChCAqjVP9TUxF3zo23R2T6EGdE, 0x1CF326C5AAA5AF9F0E2791E66310FE8F044FAADAF12567EAA0976959D1F7731F)'

Vectors:

dove ct 'my_script([10, 20, 1024])' // Vector u64
dove ct 'my_script([1exaAg2VJRQbyUBAeXcktChCAqjVP9TUxF3zo23R2T6EGdE, 0x1CF326C5AAA5AF9F0E2791E66310FE8F044FAADAF12567EAA0976959D1F7731F, 0x01])' // Vector addresses.

See more in Dove documentation.

More

To learn more commands see help:

dove --help

To continue with Dove and create your first scripts and modules read our Move VM pallet documentation.

Language Server

Move language server used mostly in Ide extensions, like our:

See documentation.

Resource viewer

Resource viewer allows developers to read resources from blockchain storage. In case of Pontem it's Substrate storage.

Disassembler

Allows to dissable compiled .mv (modules/scripts) files:

disassembler --input <path to compiled module or script>