Usage

Create your first project in less than 2 minutes

Let's build a very simple hello-world project to demonstrate how easy it is to get started building on Stacks.

Install clarinet

First, let's make sure we've installed clarinet so that we can use the command line tools.

Terminal
brew install clarinet

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.

Terminal
clarinet new hello-world

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.

Terminal
cd hello-world
clarinet contract new 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".

say-hello.clar
(define-read-only (say-hi)
  (print "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.

Terminal
clarinet check
 1 contract checked

And that's it! You can now run clarinet check to verify that your contract is valid.

Application File Structure

say-hello.clar
say-hello.test.ts
Clarinet.toml
...
Tip

For normal usages, you should use Fumadocs UI instead.

Last updated on