Delegated Staking
Last updated
Was this helpful?
Last updated
Was this helpful?
This feature is currently available on IntegrationNet only.
This guide walks you through integrating with Constellation Network’s Delegated Staking system, including how to create, update, and withdraw delegated stakes for users that want to automate this process through the network APIs.
Delegated staking allows users to lock their tokens on the network and delegate them to a node operator, receiving a share of the validator’s rewards in return. The process relies on TokenLocks and is managed via the Global L0 (gL0) and DAG L1 (dagL1) APIs.
Manual staking using Stargazer Wallet is supported through the DAG Explorer website.
For node operators looking for information on how to participate in Delegated Staking and how to attract delegators to their nodes, see .
Before getting started, familiarize yourself with the following endpoints. Note that you'll be interacting with API endpoints on both the and APIs.
/token-locks
POST
Submit a TokenLock.
/token-locks/:address/last-reference
GET
Get the latest transaction reference for use in a TokenLock.
/delegated-stakes/:address/info
GET
Fetch current delegated stake positions for an address.
/delegated-stakes
POST
Create or update a delegated stake position.
/delegated-stakes
PUT
Withdraw a delegated stake position.
/node-params
GET
Fetch node metadata including node IDs and reward settings.
To create a delegated stake, follow these steps:
Use the following API call to list the nodes currently accepting delegated stakes:
Each node record includes:
nodeId
: used to delegate
name
: name provided by the operator
description
: description provided by the operator
rewardFraction
: the validator's share of rewards
You’ll use the nodeId
from this list when creating your stake.
Before creating a TokenLock, you need the last reference for your wallet address:
This value will be used as the parentReference
in your new TokenLock transaction.
Submit a TokenLock to lock your tokens:
source
: set to the address of the wallet sending the request
amount
: number of tokens to lock (in smallest unit, i.e., datum)
fee
: set to zero
currencyId
: set to null
unlockEpoch
: set to null
— this ensures only the network can unlock the tokens upon withdrawal
parent
: from previous step
Now fetch your DelegatedStake's last reference:
Use the returned value as parent
when submitting the new stake.
Now that you have your tokenLockRef
and parent reference, submit the stake:
Request body includes:
nodeId
: from /node-params
amount
: must exactly match the amount of the TokenLock referenced
fee
: should be zero
tokenLockRef
: from TokenLock response
parent
: from /delegated-stakes/:address/info
If successful, a hash
of the DelegatedStake record will be returned.
Use:
Check that your stake is listed in the activeDelegatedStakes
array, and that rewardsAmount
is increasing.
Delegated stakes can be redirected to a new node without withdrawal or penalty.
Re-run:
Choose a new node ID to delegate to.
Use the same tokenLockRef
and stake amount, but change the nodeId
.
This will update the position to the new node without incurring a withdrawal penalty. All fields other than nodeId
must remain the same as the original request.
Use:
Ensure the nodeId
has updated and rewardAmount
continues to increase.
To withdraw a delegated stake (unlock your tokens and receive rewards), follow this process:
You’ll need:
Reference to the original DelegatedStake position
This will start the 21-day unbonding period.
After submitting, verify the stake has moved to pendingWithdrawals
:
During this time:
The position no longer accrues rewards
Tokens remain locked
After ~21 days (estimated in network epochProgress
), check your wallet:
TokenLock should be removed
Rewards should be distributed in a reward transaction
All POST
and PUT
requests below follow the brotli compressed signing scheme described in . If using a library like dag4.js to generate and send requests to the network, serialization and signing will be handled for you automatically. If sending requests directly to the REST APIs without using a library, you will need to generate the signatures manually.