Simplified Template Testing on Tari - One-Click Environment Setup
The Tari core developers always trying to improve and simplify the process of developing templates. However, if you’re eager to start experimenting with templates on Tari, we’ve simplified the process to help you get started.
We’ve developed a Docker image that sets up a clean local network with essential components such as the base node, base layer console wallet, validator nodes, indexers, second layer wallets, and other necessary services, providing you with a convenient one-click testing environment.
Almost. It’s not entirely one-click yet but we are continuously improving our tools to reach that goal.
To begin, follow these steps:
- Install Docker on your system.
- Run the following command:
docker run -it -p 18000-18100:18000-18100 \ quay.io/tarilabs/dan-testing:latest \ /bin/bash
Once the Docker image is up and running, execute the Python script:
python3 main.py
Alternatively, if you prefer to compile from source, you can clone the repository from https://github.com/tari-project/dan-testing and run the same command.
This will start up the process, and you’ll be presented with a startup screen.
On the page, you’ll find links to open the Validator Node, Wallet, and Indexers UI and logs.
At the bottom of the page, there’s a button to upload WASMs as a template.
A great starting point for coding templates is to use the wasm-template repository with cargo generate. You can find more information in a previous developer update.
To use the wasm-template
repository, run the following command:
cargo generate https://github.com/tari-project/wasm-template.git counter
Follow the instructions, edit the contract as needed, and then compile it:
cd package
cargo build-wasm
Once you have your template ready, upload it using the provided form:
In development, the second layer has a confirmation time of 3 blocks, but this may be different in the mainnet
second layer.
To proceed, click the Mine
button in this box three times:
Now, if you look at the validator node, a new template will be registered, and you can click on it to see its available methods:
With these steps completed, you are ready to start experimenting and testing your templates on Tari’s platform. Enjoy!