Skip to content

Commit

Permalink
refactor: update clarinet nakamoto guide
Browse files Browse the repository at this point in the history
  • Loading branch information
hugocaillard committed Aug 6, 2024
1 parent 9773f6a commit 163e125
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 8 deletions.
51 changes: 46 additions & 5 deletions content/docs/stacks/nakamoto/guides/clarinet.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,72 @@ Once the devnet reaches the right block height, (Bitcoin block #108 by default),
`stack-extend` requests to the new PoX contract. In Nakamoto mode, devnet has 2 signers. Eventually,
you can observe the `vote-for-aggregate-public-key` transactions that they send.

By default, the Devnet will not get to Epoch 3.0 ("Nakamoto activation" with fast blocks). For that, the `epoch_3_0` height as to be set manually in the `Devnet.toml` file. Using one of your Clarinet projects, or a new one (with `$ clarinet new nakademo`), update the
`settings/Devnet.toml` with the following settings:
By default, the Devnet will not get to Epoch 3.0 ("Nakamoto activation" with fast blocks). For that,
the `epoch_3_0` height as to be set manually in the `Devnet.toml` file. Using one of your Clarinet
projects, or a new one (with `$ clarinet new <project-name>`), update the `settings/Devnet.toml`
with the following settings:

```toml
# settings/Devnet.toml
[devnet]
epoch_3_0 = 144

stacks_node_image_url = "quay.io/hirosystems/stacks-node:devnet-3.0"
stacks_signer_image_url = "quay.io/hirosystems/stacks-signer:devnet-3.0"
```

Set a contract to be deployed in epoch 3.0 with Clarity 3. You can create a new one with `$ clarinet contract new nakademo`). It needs to be manually update in the project manifest (Clarinet.toml)
At the end of the `Devnet.toml` file, you must make sure that the `pox_stacking_orders` are properly
set. You should have 3 stacking orders from 3 different accounts. All should start at **cycle 1**
and take at least **2 slots**. You also need to enable the auto-extends property. Becasue Nakamoto
relies on the Stackers to sign blocks, these settings ensure that there are engouh stacked STX for
each cycles. Here is what it looks like by default in new projects:

```toml
# settings/Devnet.toml
[[devnet.pox_stacking_orders]]
start_at_cycle = 1
duration = 10
auto_extend = true
wallet = "wallet_1"
slots = 2
btc_address = "mr1iPkD9N3RJZZxXRk7xF9d36gffa6exNC"

[[devnet.pox_stacking_orders]]
start_at_cycle = 1
duration = 10
auto_extend = true
wallet = "wallet_2"
slots = 2
btc_address = "muYdXKmX9bByAueDe6KFfHd5Ff1gdN9ErG"

[[devnet.pox_stacking_orders]]
start_at_cycle = 1
duration = 10
auto_extend = true
wallet = "wallet_3"
slots = 2
btc_address = "mvZtbibDAAA3WLpY7zXXFqRa3T4XSknBX7"
```

Set a contract to be deployed in epoch 3.0 with Clarity 3. You can create a new one with
`$ clarinet contract new <contract-name>`). It needs to be manually update in the project manifest
(Clarinet.toml)

```toml
# Clarinet.toml
[contracts.nakademo]
path = 'contracts/nakademo.clar'
clarity_version = 3
epoch = 3.0
```

Start devnet with `clarinet devnet start`.
Start devnet with `clarinet devnet start`, you should see epoch 3.0 and fast blocks at Bitcoin
block 144.

## Deploy contracts on the Nakamoto Testnets

A Nakamoto testnet is available and running in Epoch 3.0. Clarinet can be used to deploy Clarity 3 contracts on this tesnet.
A Nakamoto testnet is available and running in Epoch 3.0. Clarinet can be used to deploy Clarity 3
contracts on this tesnet.

In a Clarinet project, the `settings/Testnet.toml` file can be updated like so:

Expand Down
6 changes: 3 additions & 3 deletions content/docs/stacks/nakamoto/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ The StackingClient in `@stacks/stacking` was updated to match the latest pox-4 c

## Clarinet: What’s new

Make sure to install [Clarinet 2.4.0](https://github.com/hirosystems/clarinet/releases/tag/v2.4.0) or above.
Make sure to install [Clarinet 2.8.0](https://github.com/hirosystems/clarinet/releases/tag/v2.8.0) or above.

- Clarinets devnet can now be used to test Nakamoto functionality. To enable this, add the `use_nakamoto = true` flag to your `Devnet.toml`.
- Clarinet's devnet can now be used to test Nakamoto functionality.
- The devnet now starts 2 signer nodes in Nakamoto mode.
- Running `clarinet check --enable-clarity-wasm` now runs the current interpreter and clarity wasm side-by-side to allow comparing outputs.
- `clarinet console --enable-clarity-wasm` now automatically runs the current interpreter and clarity wasm side-by-side and logs any difference in outputs.

[Learn more](/stacks/nakamoto/guides/clarinet) about the new Clarinet updates.
By default, the Devnet won't start in epoch 3.0, [see this guide](/stacks/nakamoto/guides/clarinet) to configure it.

---

Expand Down

0 comments on commit 163e125

Please sign in to comment.