Installing Jstz
Jstz has several components, but the primary tool that you need to develop on Jstz is the Jstz CLI, which is available as the NPM package @jstz-dev/cli
.
It allows you to start the Jstz sandbox, deploy smart functions to it, and interact with them.
Jstz is available only on Unix-based systems.
Follow these instructions to install the Jstz CLI:
Ensure that Docker is installed on your system.
Then, download and install jstz
via NPM with this command:
npm i -g @jstz-dev/cli
or with yarn:
yarn global add @jstz-dev/cli
Congratulations! 🎉 jstz
is now installed and configured on your system.
You are now ready to write your first smart function 🚀.
Building from source​
For simplicity, you can install and initialize the Nix package management and system configuration tool, which provides the dependencies to build Jstz. If you don't use Nix, you must install the dependencies yourself.
These sections show how to build Jstz on MacOS and Linux systems:
Building on MacOS​
Nix is the easiest way to build Jstz on MacOS:
-
Clone the Jstz repository:
git clone https://github.com/jstz-dev/jstz.git
-
Install and configure Nix:
-
Install Nix as described in its documentation: https://nixos.org/download.html.
-
Ensure that Nix flakes are enabled: https://nixos.wiki/wiki/Flakes#Enable_flakes.
-
Run
nix develop
to enter a shell with the build dependencies or usedirenv
to automatically enter the shell when you enter thejstz
directory.
-
-
Build the Jstz kernel by running this command:
make build
You can locate the resulting built artifact at
target/wasm32-unknown-unknown/release/jstz_kernel.wasm
. -
Build and start the sandbox by running these commands:
cargo run --bin jstzd -- run
Building on Linux​
Nix is not required on Linux systems but it is easier than installing dependencies individually.
-
Clone the Jstz repository:
git clone https://github.com/jstz-dev/jstz.git
-
(Optional) If you are using Nix, install and configure it:
-
Install Nix as described in its documentation: https://nixos.org/download.html.
-
Ensure that Nix flakes are enabled: https://nixos.wiki/wiki/Flakes#Enable_flakes.
-
Run
nix develop
to enter a shell with the build dependencies or usedirenv
to automatically enter the shell when you enter thejstz
directory.
-
-
If you are not using Nix, install these dependencies manually:
-
Install LLVM:
Ubuntu:
sudo apt install clang
export CC=clangFedora:
sudo dnf install clang
export CC=clangLinux:
pacman -S clang
export CC=clang -
From the
jstz
directory, install the specific version of Rust that Jstz requires, which is specified in therust-toolchain
file:curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
-
Install the following Octez binaries:
octez-client
octez-node
octez-smart-rollup-node
- The appropriate Octez baker for the current protocol
You can get the Octez suite of tools from the Octez release page here: https://gitlab.com/tezos/tezos/-/releases.
Currently, Jstz uses the protocol-specific baker, such as
octez-baker-PsRiotum
oroctez-baker-PsQuebec
, not the agnostic baker namedoctez-baker
.For each of these binaries, you must download or build the appropriate binary for your system architecture (x86 or arm64), rename the file to remove the architecture prefix (so, for example,
arm64-octez-baker-PsQuebec
becomesoctez-baker-PsQuebec
), make the binary executable with thechmod +x
command, and ensure that the file is on your system'sPATH
environment variable.
-
-
Build the Jstz kernel by running this command:
make build
You can locate the resulting built artifact at
target/wasm32-unknown-unknown/release/jstz_kernel.wasm
. -
Build and start the sandbox by running these commands:
echo '{"protocol":{"protocol":"rio"}}' > config.json
cargo run --bin jstzd -- run config.json