Operate a Pool
This guide covers how to operate a stacking pool: accepting delegated STX from stackers, committing them to reward cycles, and managing the pool's stacked position.
This guide assumes you are familiar with stacking at a conceptual level. If not, read the Stacking concept guide first.
If you want to delegate your STX to a pool instead, see the Stack with a Pool guide.
Prerequisites
A running signer or a signer you are collaborating with. See the Run a Signer guide.
A pool operator wallet: a separate STX address used to manage delegations and make stacking transactions. This is different from your signer key. See Key and Address Rotation for why this separation matters.
Funding: your pool operator wallet needs enough STX to cover transaction fees.
As a pool operator, you should have two separate accounts:
Pool operator account: used for all stacking operations (
delegate-stack-stx,stack-aggregation-commit-indexed, etc.).Signer account: the key used to configure your signer. The signer public key is what you pass into the aggregation commit function.
This separation is recommended because you can rotate a signer key without disrupting delegations, but you cannot rotate a pool operator key without delegators needing to un-stack and re-delegate. See Key and Address Rotation for more details.
Set up your pool operator wallet using any Stacks wallet such as Leather or Xverse. Share this wallet's STX address with parties that will delegate to you.
For improved UX, you might use the helper contract pox4-pools and add your pool to earn.leather.io.
There are several ways to make stacking transactions. This guide covers using Leather Earn, which is the simplest option. You can also call the functions directly from the deployed contract, or use the @stacks/stacking NPM package.
Accept Delegations
After a delegator calls delegate-stx (see Stack with a Pool), you as the pool operator call delegate-stack-stx to commit each delegator's STX. This must be called for every individual stacker.
The arguments are:
Stacker: the STX address of the delegator
Amount: denoted in uSTX (1 STX = 1,000,000 uSTX)
Pox Address: the BTC address where you will receive rewards. If the delegator specified a BTC address in their
delegate-stxcall, you must use that same address.Start burn height: the current BTC block height (add 1 or 2 to the current height when initiating the transaction). The delegation will not actively be stacked at this height, but at whatever reward cycle is committed in the aggregation commit step.
Lock period: number of cycles to lock for (maximum 12). If the delegator specified an expiration burn height, the lock period cannot extend past that.
This step also lets you choose which stackers to accept. For closed pools, only call this function for approved stackers.
You can repeat this for multiple stackers before proceeding to the commit step.
Commit Delegated STX
Once the total delegated STX exceeds the minimum stacking threshold, call stack-aggregation-commit-indexed to commit the pool's aggregate balance to a reward cycle. This is when you provide your signer key and signature.
The minimum stacking threshold can be found at https://api.hiro.so/v2/pox under min_threshold_ustx (1 STX = 1,000,000 uSTX).
Use stack-aggregation-commit-indexed instead of the legacy stack-aggregation-commit. The indexed version returns the reward index, which is required if you later need to call stack-aggregation-increase.
Function source code
Note that stack-aggregation-commit-indexed wraps inner-stack-aggregation-commit. The inner function is shown here.
The arguments are:
Pox Address: the BTC address to receive rewards
Reward-cycle: the future reward cycle to commit for
Signer public key: the public key of your signer (this is how you associate your pool operator address with your signer)
Signer signature: a signature proving control of your signing key (see Generate a Signer Signature)
Max Amount: used to validate the signer signature
Auth Id: used to validate the signer signature
The delegate-stack-stx function sets the stacker's first reward cycle to the next reward cycle. When generating your signature and calling stack-aggregation-commit-indexed, make sure the reward cycles match.
For example, if you are in cycle 557 when calling delegate-stack-stx, pass cycle 558 or higher in both your signature and your stack-aggregation-commit-indexed transaction.
For solo stacking methods, you use the current reward cycle in the signature. For stack-aggregation-commit-indexed, you use the target reward cycle because you can commit for future cycles, not just N+1.
Once this succeeds, your pool is eligible for reward slots in that cycle. All steps up to this point must be completed before the prepare phase begins.
Using Leather Earn
Pool operators can log in to Leather Earn and visit https://earn.leather.io/pool-admin to manage pool operations:
delegate-stack-stx: After a user delegates, call this for each individual stacker.
stack-aggregation-commit: Enter the reward cycle, BTC address, signer public key, signer key signature, Auth ID, and Max amount. This must be done for every individual reward cycle where the pool will be acting as a signer.
Increase Committed Amount
Even after committing, you can increase the total committed STX when new delegations are received.
Update the delegator's locked amount
Call delegate-stack-increase for each delegator whose locked amount needs to increase.
Arguments:
Stacker: the STX address of the delegator
Pox Address: the BTC address for rewards. Must match the delegator's specified address if one was set.
Increase by: the amount of uSTX to add to the delegator's locked amount
Commit or increase the stacked amount
After updating locked amounts, you must commit the change:
If you have not yet committed for the given cycle: call
stack-aggregation-commit-indexed(see above).If you have already committed: call
stack-aggregation-increasewith the index returned from the first commit and a new signature.
Arguments for stack-aggregation-increase:
Pox Address: the BTC address to receive rewards
Reward Cycle: a reward cycle in the future
Reward Cycle Index: the index returned by
stack-aggregation-commit-indexed
This is a sequential process. First call delegate-stack-increase, then commit the change:
Use
stack-aggregation-commit-indexedif this is the first commit for that cycle.Use
stack-aggregation-increaseif you have already committed.
Failing to commit (or properly increase after a commit) will result in the increased delegation not taking effect.
How Signer Registration Works for Pools
The delegated stacking workflow requires multiple transactions to register a signer:
Stackers delegate their STX
Stackers call delegate-stx to give the pool operator permission.
Pool operator accepts delegations
The pool operator calls delegate-stack-stx for each individual stacker.
Pool operator commits
The pool operator calls stack-aggregation-commit-indexed to commit all delegated STX. This is where the signer key is associated with the pool.
All steps must be completed before the prepare phase of the target reward cycle. During the prepare phase, DKG occurs and the signer is automatically registered. No manual action is needed beyond monitoring.
Last updated
Was this helpful?