Skip to content

Commit fa87af4

Browse files
eric-stacksgitbook-bot
authored andcommitted
GITBOOK-28: update Devnet page
1 parent 7113c59 commit fa87af4

File tree

4 files changed

+170
-6
lines changed

4 files changed

+170
-6
lines changed

docs/build/clarinet-integrations/vscode-extension.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# VSCode Extension
22

3+
{% hint style="info" %}
4+
The [VSCode extension](https://marketplace.visualstudio.com/items?itemName=StacksLabs.clarity-stacks) for Clarity is now published under the Stacks Labs organization.
5+
{% endhint %}
6+
37
## Features
48

59
### Smart auto-completion
@@ -76,25 +80,25 @@ When implementing traits (like SIP-009 NFTs or SIP-010 tokens), the extension ve
7680

7781
{% stepper %}
7882
{% step %}
79-
#### Set breakpoints
83+
**Set breakpoints**
8084

8185
Set breakpoints by clicking line numbers in the editor.
8286
{% endstep %}
8387

8488
{% step %}
85-
#### Start debugging
89+
**Start debugging**
8690

8791
Press `F5` or use Run → Start Debugging to begin a debugging session.
8892
{% endstep %}
8993

9094
{% step %}
91-
#### Step through code
95+
**Step through code**
9296

9397
Step through code line-by-line to follow execution.
9498
{% endstep %}
9599

96100
{% step %}
97-
#### Inspect state
101+
**Inspect state**
98102

99103
Inspect variables and stack state while paused at breakpoints.
100104
{% endstep %}
@@ -114,3 +118,9 @@ Visual debugging requires VS Code Desktop and Clarinet installed locally.
114118
| Documentation | External lookup | Inline hover docs |
115119
| Debugging | Console only | Visual debugger |
116120
| Cross-file navigation | Manual | Jump to definition |
121+
122+
***
123+
124+
### Additional Resources
125+
126+
* \[[zed.dev](https://zed.dev/extensions?query=clarity)] Zed extension for Clarity

docs/build/clarinet/local-blockchain-development.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,78 @@ epoch_2_4 = 0 # Pox-4 from genesis
205205
epoch_3_0 = 101 # Nakamoto activation at block 101
206206
```
207207

208+
### Custom node/signer images
209+
210+
Clarinet runs Devnet with specific tags for each Docker image. For example, Clarinet v3.10.0 uses the following images:
211+
212+
* stacks node: `blockstack/stacks-blockchain:3.3.0.0.1-alpine`
213+
* stacks signer: `blockstack/stacks-signer:3.3.0.0.1.0-alpine`
214+
215+
We recommend Devnet users let Clarinet handle it and use the default version. This ensures that your Clarinet version can handle and properly configure the images it uses.
216+
217+
In some cases, you may need to use other images. Clarinet lets you do this by configuring it in `settings/Devnet.toml`. For example, if you don't want to run the `alpine` images:
218+
219+
```toml
220+
# setting/Devnet.toml
221+
[network]
222+
name = "devnet"
223+
deployment_fee_rate = 10
224+
225+
# ...
226+
227+
[devnet]
228+
stacks_node_image_url = "blockstack/stacks-blockchain:3.3.0.0.1"
229+
stacks_signer_image_url = "blockstack/stacks-signer:3.3.0.0.1.0"
230+
```
231+
232+
<details>
233+
234+
<summary>Build an image locally and use it</summary>
235+
236+
* Clone the stacks-core repository (or a fork) and checkout the desired branch.
237+
238+
```
239+
git clone [email protected]:stacks-network/stacks-core.git
240+
cd stacks-core
241+
git checkout develop
242+
```
243+
244+
* Build the Docker image `stacks-node:local`:
245+
246+
```
247+
docker build -t stacks-node:local -f ./Dockerfile ./
248+
```
249+
250+
* Clarinet needs the image to be available in a registry. You can host a local one and push the image to it.
251+
252+
```
253+
docker run -d -e REGISTRY_HTTP_ADDR=0.0.0.0:5001 -p 5001:5001 --name registry registry:2
254+
docker tag stacks-node:local localhost:5001/stacks-node:local
255+
docker push localhost:5001/stacks-node:local
256+
```
257+
258+
* Set the image to be used:
259+
260+
```
261+
# setting/Devnet.toml
262+
[network]
263+
name = "devnet"
264+
deployment_fee_rate = 10
265+
266+
# ...
267+
268+
[devnet]
269+
stacks_node_image_url = "localhost:5001/stacks-node:local"
270+
```
271+
272+
* Then start Devnet:
273+
274+
```
275+
clarinet devnet sta
276+
```
277+
278+
</details>
279+
208280
### Package deployment
209281

210282
Create reusable devnet configurations:
@@ -401,3 +473,7 @@ clarinet deployments apply --devnet
401473
</details>
402474

403475
***
476+
477+
### Additional Resources
478+
479+
* \[[Hiro Blog](https://www.hiro.so/blog/5-ways-to-interact-with-devnet-in-the-hiro-platform)] 5 Ways to Interact With Devnet in the Hiro Platform&#x20;

docs/build/clarinet/overview.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,17 @@ For the latest releases and versions of Clarinet, check out the open-source repo
1414

1515
<div data-with-frame="true"><figure><img src="../.gitbook/assets/clarinet-diagram.png" alt=""><figcaption></figcaption></figure></div>
1616

17+
{% updates format="full" %}
18+
{% update date="2025-11-05" %}
19+
## Clarinet was migrated to Stacks Labs
20+
21+
* The Clarinet repository now belongs to the stx-labs organization.
22+
* The NPM packages are now published under the `@stacks` organization.
23+
* The VSCode extension is now published under the Stacks Labs organization.
24+
* Check out the [discussion](https://github.com/stx-labs/clarinet/discussions/2055) to see how to migrate older projects.
25+
{% endupdate %}
26+
{% endupdates %}
27+
1728
## Key features
1829

1930
* [**Leverage a powerful CLI**](https://app.gitbook.com/s/GVj1Z9vMuEOMe7oH7Wnq/clarinet/cli-reference) - Create new projects, manage your smart contracts and their dependencies using clarinet requirements, and interact with your code through the built-in REPL.
@@ -73,7 +84,6 @@ For a deeper understanding of when to use these networks, check out the dedicate
7384
### Additional Resources
7485

7586
* \[[Hiro Blog](https://www.hiro.so/blog/clarinet-roadmap-looking-to-the-future)] The Humble Beginning of Clarinet
76-
* \[[zed.dev](https://zed.dev/extensions?query=clarity)] Zed extension for Clarity
7787

7888
***
7989

docs/build/get-started/clarity-crash-course.md

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ Great! You just interacted with your first Clarity smart contract. Hopefully thi
193193

194194
### Read Access into Bitcoin
195195

196-
Smart contracts on the Stacks layer can read Bitcoin state and can be triggered by standard Bitcoin transactions. This is because Stacks nodes also run Bitcoin nodes as part of consensus, and they read and index Bitcoin state.
196+
Clarity smart contracts on the Stacks layer can also read Bitcoin state and can be triggered by standard Bitcoin transactions. This is because Stacks nodes also run Bitcoin nodes as part of consensus, and they read and index Bitcoin state.
197197

198198
Reading Bitcoin state in Clarity is made by possible by the built-in function: `get-burn-block-info?` and the keyword `burn-block-height` .
199199

@@ -211,6 +211,74 @@ Reading Bitcoin state in Clarity is made by possible by the built-in function: `
211211
;; Returns (some 0xe671...)
212212
```
213213

214+
<details>
215+
216+
<summary>Verifying bitcoin transactions in Clarity</summary>
217+
218+
One of the most popular Clarity contracts that leverages read access into Bitcoin is the `clarity-bitcoin-lib` contract, maintained by Friedger. This contract intakes data of a bitcoin transaction and will verify that it was indeed mined in a Bitcoin block.
219+
220+
For more info: [https://github.com/friedger/clarity-bitcoin](https://github.com/friedger/clarity-bitcoin)
221+
222+
</details>
223+
224+
***
225+
226+
### Flexible and secure modularization
227+
228+
Many DAOs of the major Stacks apps implement a familiar contract design and architecture. This familiarity is inspired by the [ExecutorDAO](https://github.com/MarvinJanssen/executor-dao) framework, written by Marvin Janssen. This ExecutorDAO framework leverages the flexibility of having modularization in your smart contracts by compartmentalizing duties.
229+
230+
The core tenets of the ExecutorDAO framework that make this possible are:
231+
232+
1. Proposals are smart contracts.
233+
2. The core executes, the extensions give form.
234+
3. Ownership control happens via sending context.
235+
236+
{% tabs %}
237+
{% tab title="Main DAO contract" %}
238+
The main DAO contract acts as the core contract where its sole purpose is to execute proposals and to keep a list of authorised extensions.
239+
240+
{% code title="dao.clar" expandable="true" %}
241+
```clarity
242+
(use-trait proposal-trait .proposal-trait.proposal-trait)
243+
(use-trait extension-trait .extension-trait.extension-trait)
244+
245+
;; ...
246+
247+
;; --- Authorisation check
248+
(define-private (is-self-or-extension)
249+
(ok (asserts! (or (is-eq tx-sender (as-contract tx-sender)) (is-extension contract-caller)) err-unauthorised))
250+
)
251+
252+
;; ...
253+
254+
;; --- Admin function to execute proposals
255+
(define-public (execute (proposal <proposal-trait>) (sender principal))
256+
(begin
257+
(try! (is-self-or-extension))
258+
(asserts! (map-insert executed-proposals (contract-of proposal) block-height) err-already-executed)
259+
(print {event: "execute", proposal: proposal})
260+
(as-contract (contract-call? proposal execute sender))
261+
)
262+
)
263+
```
264+
{% endcode %}
265+
{% endtab %}
266+
267+
{% tab title="A proposal extension contract" %}
268+
This proposal contract updates the whitelist of an example `.nft-escrow` contract that is owned by the main DAO contract. This proposal contract implements the `proposal-trait` and is passed into the main DAO contract's `execute` function for final approved execution.
269+
270+
{% code title="proposal.clar" %}
271+
```clarity
272+
(impl-trait .proposal-trait.proposal-trait)
273+
274+
(define-public (execute (sender principal))
275+
(contract-call? .nft-escrow set-whitelisted .some-nft true)
276+
)
277+
```
278+
{% endcode %}
279+
{% endtab %}
280+
{% endtabs %}
281+
214282
***
215283

216284
### Testing Clarity Smart Contracts

0 commit comments

Comments
 (0)