Skip to content

taraldefi/taral

Repository files navigation

Logo

taral-docs

Custom badge Maintained

Taral local development environment for clarity contracts
Development environment for Stacks smart contracts with support for unit tests and integration tests


-----------------------------------------------------

➤ Table of Contents

-----------------------------------------------------

➤ Getting started

When getting started with developing smart contracts, you need to first install the packages by calling

./install.sh

This installs a certain version of clarity-cli we're using to interact with the smart contracts locally in unit-test mode

-----------------------------------------------------

➤ Thank you

This wouldn't be possible without the wonderful work of:

  • [Stacks] (https://www.stacks.co/) Powering just about everything.

  • Clarigen Most api provider and contract generation code in the /packages/shared is borrowed with gratitude from Clarigen and modified to fit our usecase.

  • [Clarity-JS-SDK] (https://github.com/blockstack/clarity-js-sdk/) The native cli provider code in /packages/shared/native-cli is borrowed with gratitude from @blockstack/clarity-js-sdk and Clarigen with few modifications.

  • [Clarinet] (https://github.com/hirosystems/clarinet/) Used for checking smart contracts, powering a private testnet and testing. Still using the private testnet in /clarity/docker but will rely more and more on Clarinet.

  • [Catamaran-Swaps] (https://github.com/friedger/stacks-swaps/) Swap code is based largely on Stacks swaps (smart contracts and swap verification functions) with the exception that this one runs directly against the bitcoin node, not using the blockcypher API or other external dependencies.

  • [Arkadiko] (https://github.com/arkadiko-dao/arkadiko/) Currently used for integrating arkadiko functionality on the private testnet. We are going to use the arkadiko deployed contracts outside of the testing environment.

-----------------------------------------------------

➤ Local testnet

The docker folder contains a docker-compose configuration to run a local testnet Stacks blockchain environment from scratch

This starts the following private testnet components:

  • Postgres database
  • Bitcoin - puppet chain
  • Stacks node
  • Stacks api
  • Local stacks blockchain explorer

It contains two docker-compose files:

  • bns.yaml
  • docker-compose.yaml

If you want to import BNS data you should run

$> docker-compose -f bns.yaml pull
$> docker-compose -f bns.yaml build
$> docker-compose -f bns.yaml up

This will import bns data into the /provisioning/private-testnet/bns-data folder.

Moving forward, starting the stack:

$> docker-compose pull
$> docker-compose build
$> docker-compose up

Note:

If you do not want to import bns data, then you will need to comment out the environment line BNS_IMPORT_DIR: /provisioning/private-testnet/bns-data from the stacks-blockchain-api container, otherwise the container will panic if it doesn't find the files

If you did import the bns data, you need to uncomment (if previously commented out) the environment line above and be aware that the stacks-blockchain will experience Connection refused problems from stacks-blockchain-api for the duration of bns data import. After the import, the API will become ready and accept events from stacks-blockchain node

-----------------------------------------------------

➤ Development of smart contracts

The contracts folder contains the smart contracts powering taral (development in progress).

When developing/updating a new smart contract you need to generate:

  • Abi json file
  • Typescript interface file
  • Index file exposing a neat and simple way of accessing the smart contract interface

You can do all that by running:

yarn generate

-----------------------------------------------------

➤ Unit tests

Unit tests will run against an offline version of clarity cli without docker stacks blockchain on.

-----------------------------------------------------

➤ Integration tests

Integration tests run against the local testnet stack started with docker.

The way we run it is:

First, start the local testnet by doing

$> cd docker && docker-compose up

Wait until the local testnet is fully started and then execute the integration tests

$> yarn integration-tests

-----------------------------------------------------

➤ Future work

Start development of the taral token and split this monorepo into multiple separate repositories once the codebase gets larger.

-----------------------------------------------------

➤ FAQ

How can I help the Taral project?

Glad you asked. Taral project is developed by open source developers. Please contact us on Discord or Telegram if you want to help the project.

Is there a token?

A token is being currently developed, the ticker is TAL

When will this get released?

We are actively developing Taral, we will update once we have a clear timeline.

-----------------------------------------------------

➤ Contributors

Doru Cioclea Octavian Vincent L You?
Doru Cioclea Octavian Vincent L You?
🔥 🔥

-----------------------------------------------------

➤ License

Licensed under ISC.