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: .gitbook/includes/note-for-existing-signersth....md
+3-3
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,7 @@ The output will specify which configuration key caused the panic (there may be m
26
26
27
27
```
28
28
$ stacks-node check-config --config ./Config.toml
29
-
INFO [1737057614.446096] [testnet/stacks-node/src/main.rs:278] [main] stacks-node 3.1.0.0.3 (release/3.1.0.0.3:906a8cc, release build, linux [x86_64])
29
+
INFO [1738695683.067315] [testnet/stacks-node/src/main.rs:278] [main] stacks-node 3.1.0.0.5 (release/3.1.0.0.5:513dbc5, release build, linux [x86_64])
30
30
INFO [1729707265.671604] [testnet/stacks-node/src/main.rs:318] [main] Loading config at path ./Config.toml
31
31
WARN [1729707265.671992] [testnet/stacks-node/src/main.rs:325] [main] Invalid config file: Invalid toml: unknown field `foo`, expected one of `name`, `seed`, `deny_nodes`, `working_dir`, `rpc_bind`, `p2p_bind`, `p2p_address`, `data_url`, `bootstrap_node`, `local_peer_seed`, `miner`, `stacker`, `mock_mining`, `mock_mining_output_dir`, `mine_microblocks`, `microblock_frequency`, `max_microblocks`, `wait_time_for_microblocks`, `wait_time_for_blocks`, `next_initiative_delay`, `prometheus_bind`, `marf_cache_strategy`, `marf_defer_hashing`, `pox_sync_sample_secs`, `use_test_genesis_chainstate`, `always_use_affirmation_maps`, `require_affirmed_anchor_blocks`, `chain_liveness_poll_time_secs`, `stacker_dbs`, `fault_injection_block_push_fail_probability` for key `node` at line 20 column 1
32
32
```
@@ -40,6 +40,6 @@ Note that in the Stacks node config file, the `block_proposal_token` field has b
40
40
For quick reference, here are the current latest versions you'll want to be running as a signer. If you don't yet have your signer up and running, this guide will walk you through that.
Copy file name to clipboardExpand all lines: example-contracts/stacking.md
+25-26
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
Stacking is implemented as a smart contract using Clarity. You can always find the Stacking contract identifier using the Stacks Blockchain API [`v2/pox` endpoint](https://docs.hiro.so/api#operation/get\_pox\_info).
4
4
5
-
Currently stacking uses the pox-4 contract. The deployed pox-4 contract and included comments can be [viewed in the explorer](https://explorer.hiro.so/txid/SP000000000000000000002Q6VF78.pox-4?chain=mainnet).
5
+
Currently, stacking uses the pox-4 contract. The deployed pox-4 contract and included comments can be [viewed in the explorer](https://explorer.hiro.so/txid/SP000000000000000000002Q6VF78.pox-4?chain=mainnet).
6
6
7
7
In this walkthrough, we'll cover the entire stacking contract from start to finish, including descriptions of the various functions and errors, and when you might use/encounter them.
8
8
@@ -12,7 +12,7 @@ Rather than walking through the contract line by line, which you can do by simpl
12
12
13
13
At the bottom you will find a list of some errors you may run into and their explanations.
14
14
15
-
There are a few utilities that make interacting with this contract easier including [Lockstacks](https://lockstacks.com) as a UI and the [@stacks/stacking package](https://www.npmjs.com/package/@stacks/stacking) for a JS library.
15
+
There are a few utilities that make interacting with this contract easier including [Leather Earn](https://earn.leather.io) as an UI and the [@stacks/stacking package](https://www.npmjs.com/package/@stacks/stacking) for a JS library.
16
16
17
17
Hiro has a [detailed guide](https://docs.hiro.so/stacks.js/guides/how-to-integrate-stacking) available for stacking using this library as well as a [Nakamoto guide](https://docs.hiro.so/nakamoto/stacks-js) specifically for the additions made to work with `pox-4`.
18
18
@@ -86,14 +86,14 @@ Here's the full code for that function, then we'll dive into how it works below
86
86
87
87
First let's cover the needed parameters.
88
88
89
-
*`amount-ustx` is the amount of STX you would like to lock, denoted in micro-STX, or uSTX (1 STX = 1,000,000 uSTX)
90
-
*`pox-addr` is a tuple that encodes the Bitcoin address to be used for the PoX rewards, details below
91
-
*`start-burn-ht` is the Bitcoin block height you would like to begin stacking. You will receive rewards in the reward cycle following `start-burn-ht`. Importantly, `start-burn-ht` may not be further into the future than the next reward cycle, and in most cases should be set to the current burn block height.
92
-
*`lock-period` sets the number of reward cycles you would like you lock your STX for, this can be 1-12
93
-
*`signer-sig` is a unique generatedf signature that proves ownership of this signer. Further details for its role and how to generate it can be found in the [How to Stack](../guides-and-tutorials/stack-stx/stacking-flow.md)doc
94
-
*`signer-key` is the public key of your signer, more details in the [How to Run a Signer](../guides-and-tutorials/running-a-signer/)doc
95
-
*`max-amount` sets the maximum amount allowed to be stacked during the provided stacking period
96
-
*`auth-id` is a unique string to prevent re-use of this stacking transaction
89
+
*`amount-ustx` is the amount of STX you would like to lock, denoted in micro-STX, or uSTX (1 STX = 1,000,000 uSTX).
90
+
*`pox-addr` is a tuple that encodes the Bitcoin address to be used for the PoX rewards, details below.
91
+
*`start-burn-ht` is the Bitcoin block height you would like to begin stacking. You will receive rewards in the reward cycle following `start-burn-ht`. Importantly, `start-burn-ht` may not be further into the future than the current reward cycle, and in most cases should be set to the current burn block height.
92
+
*`lock-period` sets the number of reward cycles you would like you lock your STX for, this can be between 1 and 12.
93
+
*`signer-sig` is a unique generated signature that proves ownership of this signer. Further details for its role and how to generate it can be found in the [How to Stack](../guides-and-tutorials/stack-stx/stacking-flow.md)document.
94
+
*`signer-key` is the public key of your signer, more details in the [How to Run a Signer](../guides-and-tutorials/running-a-signer/)document.
95
+
*`max-amount` sets the maximum amount allowed to be stacked during the provided stacking period.
96
+
*`auth-id` is a unique string to prevent re-use of this stacking transaction.
97
97
98
98
{% hint style="warning" %}
99
99
It's important to make sure that these fields match what you pass in to the signer signature generation. If they don't, you will likely get error 35 (`ERR_INVALID_SIGNATURE_PUBKEY`) \
@@ -145,7 +145,7 @@ Finally we return the lock up information so the node can carry out the lock by
145
145
146
146
From here, the locked STX tokens will be unlocked automatically at the end of the lock period.
147
147
148
-
The other option is that the stacker can call the `stack-increase` or `stack-extend` functions to either increase the amount of STX they have locked or increase the amount of time to lock them, respectively.
148
+
The other option is that the stacker can call the `stack-increase` or `stack-extend` functions to either increase the amount of STX they have locked or extend the time to lock them, respectively.
149
149
150
150
### Delegated Stacking
151
151
@@ -158,7 +158,6 @@ Delegated stacking has a few additional steps to it. It is essentially a three-s
158
158
There are also a few alternative steps here depending on the action you want to take.
159
159
160
160
* Revoke delegation
161
-
*
162
161
163
162
Each of these steps has a corresponding function. Let's dig into them.
164
163
@@ -211,9 +210,9 @@ This function does not actually lock the STX, but just allows the pool operator
211
210
212
211
This function takes a few parameters:
213
212
214
-
*`amount-ustx` is the amount the stacker is delegating denoted in uSTX
215
-
*`delegate-to` is the Stacks address of the pool operator (or delegate) being delegated to
216
-
*`until-burn-ht` is an optional parameter that describes when this delegation expires
213
+
*`amount-ustx` is the amount the stacker is delegating denoted in uSTX.
214
+
*`delegate-to` is the Stacks address of the pool operator (or delegate) being delegated to.
215
+
*`until-burn-ht` is an optional parameter that describes when this delegation expires.
217
216
*`pox-addr` is an optional Bitcoin address. If this is provided, the pool operator must send rewards to this address. If it is not provided, it is up to the discretion of the pool operator where to send the rewards.
218
217
219
218
It first runs through a few checks to ensure that the function caller is allowed, the provided `pox-addr` is valid, and that the stacker is not already delegating. 
@@ -304,11 +303,11 @@ This function can only be called after a stacker has called their respective `de
304
303
305
304
Like the other functions, this function takes in several parameters and runs through several checks before updating the contract state.
306
305
307
-
*`stacker` is the principal of the stacker who has delegated their STX
308
-
*`amount-ustx` is the amount they have delegated in uSTX
309
-
*`pox-addr` is the Bitcoin address the rewards will be sent to. If the stacker passed this field in to their `delegate-stx` function, this must be the same value
310
-
*`start-burn-ht` corresponds to the field passed in by the stacker
311
-
*`lock-period` corresponds to the same field that the stacker passed in
306
+
*`stacker` is the principal of the stacker who has delegated their STX.
307
+
*`amount-ustx` is at most the amount of uSTX they have delegated.
308
+
*`pox-addr` is the Bitcoin address the rewards will be sent to. If the stacker passed this field in to their `delegate-stx` function, this must be the same value.
309
+
*`start-burn-ht` corresponds to the field passed in by the stacker.
310
+
*`lock-period` corresponds to the number of cycles to lock the funds for. This can be at most 12, or the number of cycles left until the cycle matching `until-burn-ht` argument in `delegate-stx` (if set by delegator).
312
311
313
312
Now we assign a few variables using `let` before running several checks.
314
313
@@ -332,9 +331,9 @@ After those checks and partial stacking, we update the `stacking-state` map and
332
331
333
332
At this point this stacker's STX are considered partially stacked. We still need to perform one more step as the pool operator in order to officially lock them.
334
333
335
-
#### stack-aggregation-commit
334
+
#### stack-aggregation-commit-indexed
336
335
337
-
The `stack-aggregation-commit` function is just a wrapper for the private `inner-stack-aggregation-commit` function, so that is the source code included here.
336
+
The `stack-aggregation-commit-indexed` function is just a wrapper for the private `inner-stack-aggregation-commit` function, so that is the source code included here.
338
337
339
338
```clojure
340
339
;; Commit partially stacked STX and allocate a new PoX reward address slot.
@@ -442,7 +441,7 @@ The reason is because there are a finite amount of reward slots (4,000) and each
442
441
443
442
Stackers need to be able to stack the minimum in order to be eligible for one of these reward slots. A delegator may choose to delegate to a pool (even if they meet the minimum stacking requirement) if they do not want to handle the infrastructure of running a signer or the actual stacking operations, which is why this option exists.
444
443
445
-
#### delegate-stack-stx and stack-aggregation-commit
444
+
#### delegate-stack-stx and stack-aggregation-commit-indexed
446
445
447
446
In both of these functions, `pox-addr` corresponds to the address where the pool operator would like the rewards to be sent.
448
447
@@ -469,8 +468,8 @@ To fix this, check all of the data you passed in to see where the mismatch is.
469
468
470
469
#### Error 4 - ERR\_STACKING\_NO\_SUCH\_PRINCIPAL
471
470
472
-
The stacking contract looks up partially stacked stx (after you have called `delegate-stack-stx`) with the lookup key `(pox-addr, stx-address, reward-cycle`. This error means that either when you generated your signature or called the `stack-aggregation-commit` function, you passed in the wrong parameter for one of these. More information in the [stacking guide](../guides-and-tutorials/stack-stx/stacking-flow.md#delegator-initiates-delegation).
471
+
The stacking contract looks up partially stacked stx (after you have called `delegate-stack-stx`) with the lookup key `(pox-addr, stx-address, reward-cycle)`. This error means that either when you generated your signature or called the `stack-aggregation-commit` function, you passed in the wrong parameter for one of these. More information in the [stacking guide](../guides-and-tutorials/stack-stx/stacking-flow.md#delegator-initiates-delegation).
This means that the `start-burn-height`parameter parsed was invalid (in a past or future cycle, instead of the current one). This error will mostly be seen in `stack-stx` or `delegate-stack-stx` failed transactions.
0 commit comments