Why Can’t I Use Clarinet Console in Clarity Web3 Development?

I wasn’t an early developer in the Web3 space, but have really enjoyed getting involved whether that be in Ethereum or Bitcoin. After spending some time learning Solidity, I ventured into Clarity and Stacks and became very interested both in the language and community.

Clarity is a LISP based language and uses a mixture of Polish notation and TypeScript testing to help build error free smart contracts. It was because of the ease of use and elegance of the language that I really dove in. One of my favorite things about this language is the Clarinet cli tooling, which is what I’d like to look at today.

Common Clarinet Commands

Clarity has its own command line interface tool, Clarinet. This cli allows developers to run syntax checks on their entire codebase, start a console for sandbox play, run automated tests on their smart contracts and interact with a seeded chain and wallets. If you can think of a way to manipulate your code, Clarinet has tools to help you do it.

A lot of this tooling is straightforward and easy to use, but when I first started in Clarity development I ran into issues getting into the console. Is seemed pretty straightforward to launch the console as all you needed was to run `clarinet console.` However, sometimes the console would fail to load. This led me to do some digging and reproduce my issues using simple examples.

Building a Simple Counter with Clarity

To illustrate what I found, I want to run through a quick example. One of the most basic apps you can build, whether Python, JavaScript or Clarity, is a counter. This demonstrates an understanding of getting and setting values and maintaining a sort of state.

For my simple Clarity project I wanted to create a state place holder for my value, count, a method to increment the count state and a method to print the current value of count. The following code is what I came up with:

When I went to manually test my methods in the console I got the following error:

I wasn’t trying to check my code’s syntax, just open the console by running:

clarinet console

It was here that I learned about the implicit call to:

clarinet check

that is performed every time you try to access the console. From this I learned that Clarinet requires you to have a valid syntax in your code before allowing you to sandbox by performing a full codebase syntax check every time you try to access the console.

I quickly found my error as a simple deviation from the LISP operator then operands syntax and fixed the code to be this:

After this my checks ran fine and I was able to access the console and manually test my code!


A key aspect of Clarity is that it is decidable. Without going too deep into this, a decidable language is one that you can tell if it will run and how it will run before running the code. Because of this we are able to do checks on the codebase before we even attempt manual tests. While it can seem like a pain at first, I hope you now understand why it happens and this will lead you to better informed and cleaner code!



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Daniel Pericich

Daniel Pericich

Former Big Beer Engineer turned Full Stack Software Engineer