As of version 2.11.0, Clarinet runs
in epoch 3.0 (Nakamoto) by default.
Contracts are set to be deployed in epoch 3.0 and support Clarity 3.
The Devnet runs the latest Stacks blockchain version by default, enabling Nakamoto and support
Clarity 3 contracts.
Once the Devnet reaches the right block height, (Bitcoin block #108 by default), it will deploy the
pox-4.clar contract and run in Epoch 2.5. From there, Clarinet will send stack-stx and
stack-extend requests to the new PoX contract. Eventually, you can observe the
vote-for-aggregate-public-key transactions that they send.
At Bitcoin block #142, the Devnet will switch the epoch 3.0.
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-extend property. Because 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:
# 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)
# Clarinet.toml
[contracts.nakademo]
path='contracts/nakademo.clar'
clarity_version=3
epoch=3.0
Start Devnet with clarinet devnet start, you should see epoch 3.0 and fast blocks at Bitcoin
block 142.
New Clarity keywords
Clarity 3 introduces two new keywords after the Nakamoto hard fork:
tenure-height: Returns the number of tenures passed.
stacks-block-height: Returns the current Stacks block height.