📦 Installing jstz
Download and Install
DANGER
⚠️ jstz
is only available on Unix-based systems. ⚠️
Ensure docker
is installed on your system. If not, please follow this guide. To download and install jstz
, run the following command in your terminal:
source <(curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/jstz-dev/jstz/main/scripts/install-jstz-cli.sh)
Congratulations! 🎉 jstz
is now installed and configured on your system. You are now ready to write your first smart function 🚀.
Building from Source
Below are instruction on how to build jstz
from source. Additionally, this section details how to install all the prerequisites needed to build jstz
from sources.
Cloning the Repository
git clone https://github.com/jstz-dev/jstz.git
Prerequisites 📋
TIP
Both jstz
and Octez are packaged with Nix, a package manager and system configuration tool that makes building from sources easy! See the Nix docs for instructions for your system. Additionally, ensure Nix flakes are enabled.
LLVM 🛠️
brew install llvm
export CC="$(brew --prefix llvm)/bin/clang"
sudo apt-get install clang-11
export CC=clang-11
sudo dnf install clang
export CC=clang
pacman -S clang
export CC=clang
nix-env -iA nixpkgs.llvm
Rust 🦀
jstz
requires a specific release of Rust. The version of Rust required is specified in therust-toolchain
file.
Install the Rust toolchain:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Octez 🐙
TIP
The Nix shell ships with Octez binaries for convenience but it does take a little while to build for the very first time. Skip ahead to Building
The jstz sandbox uses a custom distribution of Octez found here. See the Octez docs for instructions on building Octez from source.
Once Octez has been built, copy the following binaries to jstz
:
octez-client
octez-node
octez-smart-rollup-node
Building 👷♂️
TIP
Using Nix, simply run nix develop
to enter a shell with all build dependencies or use direnv
to automatically enter the shell when you cd
into the jstz
directory.
The kernel can be built with:
make build
You can locate the resulting build artifact at /target/wasm32-unknown-unknown/release/jstz_kernel.wasm
.
Running the Sandbox 🏝️
You can start the sandbox with:
make build-cli
PATH=.:$PATH cargo run --bin jstz -- sandbox start
This will initially run octez-node
and initialize octez-client
. Once the client is initialized, the jstz_kernel
and jstz_bridge
is originated, a octez-smart-rollup-node
and jstz-node
is spun up.