Create a new Clarinet project with the basic directory structure and configuration files:
Terminal
$
clarinet new my-project
This will create a project directory with the following directory layout:
Devnet.toml
Mainnet.toml
Testnet.toml
.gitignore
Clarinet.toml
package.json
tsconfig.json
vitest.config.js
The Clarinet.toml file contains configuration for the smart contracts in your project. When you create contracts in your project, Clarinet will automatically add them to this file.
The settings/Devnet.toml file contains configuration for accounts in the Clarinet console, including the seed phrases and initial balances for a set of out-of-the-box wallets that you can use for testing in the devnet environment.
This command updates your project's configuration and creates a new contract file and a corresponding test file:
my-contract.clar
my-contract.test.ts
.gitignore
Clarinet.toml
package.json
tsconfig.json
vitest.config.js
[contracts.my-contract]
path='contracts/my-contract.clar'
clarity_version=2
epoch=2.4
Adding contracts manually
You can also add contracts to your project by adding the files manually. However, you must add the appropriate configuration to Clarinet.toml in order for Clarinet to recognize the contracts.
Validate the syntax and semantics of your contracts:
Terminal
$
clarinet check
$
clarinet check path/to/my-contract.clar
This command uses the Clarinet.toml file to locate and analyze all the contracts in the project. If the Clarity code is valid, the command will indicate success with the response below.
Note
The clarinet check command may also report warnings indicating the code is valid.
To step through these breakpoints, you can use one of the following commands:
Step-in (step or s): Step into the sub-expressions.
Step-out (finish or f): Complete execution of the current expression and return the result to the parent.
Step-over (next or n): Continue to completion of the current expression, stepping over sub-expressions.
Continue (continue or c): Continue execution until hitting a breakpoint or completing execution.
Using the continue command, the breakpoint you set in the double function will trigger twice due to two count-up calls, which enables you to do variable and map analysis.