@ -44,9 +44,9 @@ Clarity is a list processing (LISP) language, as such it is not compiled. Omitti
Clarity is in pre-release and does not yet directly interact with the live Stacks blockchain. For the pre-release period you need a test environment to run Clarity contracts. Blockstack provides a Docker image called `clarity-developer-preview` that you can use or you can build a test environment locally from code. Either the Docker image or a local environment is sufficient for testing Clarity programming for standalone contracts.
You use the `clarity-cli` command line to check, launch, and execute standalone Clarity contracts. You can use this same command line to create simulate mining Stacks and inspecting a blockchain.
You use the `clarity-cli` command line to check, launch, and execute standalone Clarity contracts inside the virtual test environment. You can use this same command line to create simulate mining Stacks and inspecting a blockchain.
Blockstack expects that some decentralized applications (DApp) will want to make use of Clarity contracts as part of their applications. For this purpose, you should use the Clarity SDK, also in pre-release. The SDK is a development environment, testing framework, and deployment tool. It provides a library for safe interactions with Clarity contracts from a DApp written with the blockstack.js library.
Blockstack expects that some decentralized applications (DApp) will want to make use of Clarity contracts as part of their applications. For this purpose, you should use the Clarity SDK, also in pre-release. The SDK is a development environment, testing framework, and deployment tool. It provides a library for safe interactions with Clarity contracts from a DApp written with the blockstack.js library. The SDK has a `clarity` command line for creating Clarity projects.
You can use the software developer kit (SDK) to develop, test, and deploy Clarity smart contracts. The SDK goes beyond the basic test environment to allow for development of Javascript or TypeScript clients that call upon Clarity contracts.
@ -30,36 +30,70 @@ $ which npm
If you don't find `npm` in your system, [install it](https://www.npmjs.com/get-npm).
## Task 1: Generate an initial Clarity project
## Task 1: Install the SDK command line
In this task, you generate a project scaffold — an initial set of directories and files.
The SDK comes with a command line for setting up the SDK and creating new projects. Use `npm` to install the `clarity` SDK command:
1. Create a new directory for your project.
```
npm install -g @blockstack/clarity-cli
```
```sh
mkdir hello-clarity-sdk
```
2. Change into your new project directory.
Verify you have installed the command correctly:
```sh
cd hello-clarity-sdk
```
```
$ clarity --help
The Clarity CLI is used to manage Clarity smart contracts from the command line.
setup Install blockstack-core and its dependencies
```
## Task 2: Generate an initial Clarity project
In this task, you generate a project scaffold — an initial set of directories and files.
3. Use the `npm` command to initialize a Clarity project.
1. Create a new Clarity project .
```sh
npm init clarity-dev
...
clarity new hello-clarity-sdk
```
The system responds by creating a scaffolding for your Clarity project and initializing the packaging:
added 153 packages from 630 contributors and audited 280 packages in 4.73s
```
$ clarity new hello-clarity-sdk
create .vscode/extensions.json
create .vscode/launch.json
create contracts/sample/hello-world.clar
create test/mocha.opts
create tsconfig.json
create test/hello-world.ts
create .gitignore
create package.json
...
added 126 packages from 632 contributors and audited 226 packages in 4.678s
found 0 vulnerabilities
Project created at /private/tmp/hello-clarity-sdk
Project created at /tmp/hello-clarity-sdk
```
Depending on your connection speed, it may take time to construct the scaffolding.
## Task 2: Investigate the generated project
2. Change into your new project directory.
```sh
cd hello-clarity-sdk
```
## Task 3: Investigate the generated project
Your project should contain three directories:
@ -154,7 +188,7 @@ npm run test
In the next section, try your hand at expanding the `hello-world.clar` program.
## Task 3: Try to expand the contract
## Task 4: Try to expand the contract
In this task, you are challenged to expand the contents of the `contracts/hello-world.clar` file. Use your favorite editor and open the `contracts/hello-world.clar` file. If you use Visual Studio Code, you can install the Blockstack Clarity extension. The extension provides `syntax coloration` and some `autocompletion`.
In this tutorial, you learn how to use Clarity, Blockstack's smart contracting language. Use this tutorial to get a quick introduction to Clarity and the default Blockstack test environment.
In this tutorial, you learn how to use Clarity, Blockstack's smart contracting language inside of a virtual environment. The environment is run using a Docker image. Use this tutorial to get a quick introduction to Clarity and the default Blockstack test environment.
1. Select the **MacOS Download** button <ahref="https://wallet.blockstack.org"target="\_blank">on this page</a>.
1. <ahref="https://wallet.blockstack.org"target="\_blank">Go to the wallet download page</a> in your browser.
2. Select the **MacOS Download** button.
This button downloads the software to your computer.
2. Open a terminal window.
3. Open a terminal window.
To find the terminal software, enter `terminal` into the Spotlight search.
![](images/mac-terminal.png)
3. In the terminal window, enter the command to change directory to the folder where you downloaded the wallet software.
4. In the terminal window, enter the command to change directory to the folder where you downloaded the wallet software.
The default location is the **Downloads** folder, type the following into the terminal and press RETURN on your keyboard.
@ -38,7 +39,7 @@ by Blockstack PBC." %}
cd ~/Downloads
```
4. In the terminal window, type the following Command
5. In the terminal window, type the following Command
```
shasum -a 512 Stacks-Wallet-macOS-3.0.0.dmg
@ -46,7 +47,7 @@ by Blockstack PBC." %}
![](images/mac-shasum.png)
5. Verify that the resulting hash (a string of letters and numbers) is the same as the latest hash published <ahref="https://github.com/blockstack/stacks-wallet/releases"target="\_blank">on this page</a>.
6. Verify that the resulting hash (a string of letters and numbers) is the same as the latest hash published <ahref="https://github.com/blockstack/stacks-wallet/releases"target="\_blank">on this page</a>.