Quickstart
Create your first project in less than 2 minutes.
You will learn how to:
- Generate a new project with the
clarinet
CLI - Create a smart contract with Clarity
- Verify and debug your smart contract in your terminal
Install clarinet
Let's build a very simple hello-world
project to demonstrate how easy it is to get started building on Stacks.
First, let's make sure we've installed clarinet
so that we can use the command line tools.
Create a new hello-world
project
Now let's create a hello-world
project. This will scaffold all the necessary files and directories for us to get started.
Create a say-hello
contract
Now that our project has been generated we can start creating our first contract. Let's name this one say-hello
.
Create a read-only
function called say-hi
Now that we have our say-hello.clar
file generated, let's create a read-only
function that prints out "Hello World".
Verify your contracts
In order to verify that our code is valid, we can run clarinet check
inside of our project directory to ensure our say-hi
function is valid.
Next step: Add unit tests with the Clarinet SDK
The Clarinet SDK allows you to write unit tests for your Clarity smart contracts. You can theoretically use any JavaScript test framework, but the SDK supports Vitest out of the box.
Additional resources
Last updated on