You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/build/get-started/clarity-crash-course.md
+27-5Lines changed: 27 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,15 @@
1
1
# Clarity Crash Course
2
2
3
-
## Clarity Crash Course
3
+
## Intro
4
4
5
5
This is designed for people with some programming experience who are new to Clarity. You don't need prior smart contract development experience, but if you have experience with languages like Solidity, you'll pick this up quickly.
6
6
7
7
Once you've familiarized yourself with the language, consider the book [Clarity of Mind](https://book.clarity-lang.org/title-page.html) or the course [Clarity Universe](https://clarity-lang.org/universe) to continue your learning.
8
8
9
+
{% hint style="info" %}
10
+
Clarity is developed as a joint effort of [Hiro PBC](https://hiro.so/), [Algorand](http://algorand.com/), and various other stakeholders, that originally targets the Stacks blockchain.
11
+
{% endhint %}
12
+
9
13
### Your First Clarity Smart Contract
10
14
11
15
We're going to build a basic Clarity smart contract using [Clarity Tools](https://clarity.tools/code/new), so you won't have to install anything for this introduction. Visit that link and it will open up a new contract for you.
@@ -16,7 +20,7 @@ The initial example contains comments (two semicolons) and a public function dec
16
20
17
21
{% stepper %}
18
22
{% step %}
19
-
### Understanding a simple expression
23
+
####Understanding a simple expression
20
24
21
25
We can think of some constructs as function calls. For example:
22
26
@@ -28,13 +32,13 @@ You can refer to the [`define-read-only`](https://docs.stacks.co/docs/write-smar
28
32
{% endstep %}
29
33
30
34
{% step %}
31
-
### Everything is an expression
35
+
####Everything is an expression
32
36
33
37
Clarity treats everything as expressions inside expressions. Function definitions are calls to built-in functions; the function body is an expression. This uniformity helps reasoning about programs in Clarity.
34
38
{% endstep %}
35
39
36
40
{% step %}
37
-
### Use LISP-like nesting
41
+
####Use LISP-like nesting
38
42
39
43
Expect nested parentheses and expressions. You’ll often read code as lists inside lists, where each parentheses-enclosed group represents a call or expression.
40
44
{% endstep %}
@@ -88,9 +92,27 @@ In Clarity, there are public, private, and read-only functions:
88
92
* (add-number 5)\
89
93
Calls the function with parameter 5 (this is how you can invoke the function in an interactive environment like Clarity Tools).
90
94
95
+
***
96
+
97
+
### Testing Your Clarity Contract
98
+
99
+
{% hint style="danger" %}
100
+
Smart contracts are immutable once deployed. Bugs are permanent. Test them thoroughly.
101
+
{% endhint %}
102
+
103
+
*[Rendezvous Fuzz Testing](../rendezvous/overview.md): Use Rendezvous to hammer your contract with random inputs. It helps expose edge cases and vulnerabilities.
104
+
*[Unit Testing in Clarinet](/broken/pages/xKpkZWiNCO3dwHoA9AeB): Unit testing verifies that individual contract functions behave as expected. 
105
+
106
+
***
107
+
108
+
### Additional Resources
109
+
91
110
This brief overview should get your feet wet with Clarity. For deeper learning, we recommend:
0 commit comments