Smart Contract Development Tool

Zetrix Development Tool

The following guide explains how to use our Zetrix development toolarrow-up-right, built for professionals. It facilitates performing frequent tasks, such as smart contract deployment and testing.

Getting Started

For the purpose of this guide, clone the repositoryarrow-up-right to your local machine. It will be used a base project for your own smart contract development on Zetrix.

After cloning the repository, we install the NPM packages for this project by running the following command:

npm install

Then create a .env file in the root of your project and insert your key/value pairs in the following format of KEY=VALUE:

If you're using the Zetrix testnet:

NODE_URL=test-node.zetrix.com

If you're using the Zetrix mainnet:

NODE_URL=node.zetrix.com

Insert the Zetrix address you are going to use to deploy the smart contract from

ZTX_ADDRESS=<YOUR ZETRIX ADDRESS>

Insert the private key of the Zetrix address you are going to use to deploy the smart contract from

PRIVATE_KEY=<THE PRIVATE KEY TO YOUR ZETRIX ADDRESS>

Contract development

The smart contract components can be found in the contracts directory. If you change the filename(s), please modify the contract name in scripts directory as well.

Manual for running script:

Contract deployment:

Contract upgrade:

Run test with coverage:

Run integration test:

Development Guide

The development of Zetrix smart contract is using Javascript ES5 which has less support on OOP concepts such as class. Hence, we imitate the OOP implementation by using functionalities available in ES5.

Class

OOP implementation

ES5 Javascript implementation

Managing private, protected and public method

OOP implementation

ES5 Javascript implementation

Inheritance and override

OOP implementation

ES5 Javascript implementation

This is the end of the tutorial. Happy buidling!

Last updated