Staking Transactions
Transactions for delegating ADA and managing stakepools
Staking is the process of participating in the network by delegating, registering, or withdrawing stake. Staking allows users to earn rewards by participating in the network.
To initiate a transaction, we import the Transaction
class from the @meshsdk/core
package and assign the wallet to the initiator
property. We build the transaction with .build()
constructs the transaction and returns a transaction CBOR. Behind the scenes, it selects all of the necessary inputs belonging to the wallet, calculates the fee for this transaction and returns the remaining assets to the change address. Use wallet.signTx()
to sign transaction CBOR.
The verbose
is optional and set to false
by default, setting it to true
will enable verbose logging for the txBodyJson prior going into build.
In this page, you will find the APIs to create transactions for the staking process.
Register Stake Address
New address must "register" before they can delegate to stakepools. To check if a reward address has been register, use blockchainProvider.fetchAccountInfo(rewardAddress). For example this account information, active
shows the address is registered.
You can chain with delegateStake()
to register and delegate to a stake pool.
Register a stake address before delegate to stakepools.
Connect wallet to run this demo
Delegate Stake
Delegation is the process by which ADA holders delegate the stake associated with their ADA to a stake pool. Doing so, this allows ADA holders to participate in the network and be rewarded in proportion to the amount of stake delegated.
Delegate stake to a stake pool
Connect wallet to run this demo
Withdraw Rewards
Withdraw staking rewards. The function accepts the following parameters:
- rewardAddress (string) - the reward address to withdraw from
- lovelace (number) - the amount to withdraw in Lovelace
Withdraw staking rewards.
Connect wallet to run this demo
Deregister Stake
Deregister a stake address. The function accepts the following parameters:
- rewardAddress (string) - the reward address to deregister
Deregister a stake address
Connect wallet to run this demo
Register Stake Pool
Register a stake pool with the following parameters:
You can chain with registerPool()
to register a stake pool.
Retire Stake Pool
To retire a stake pool, you need to provide the poolId
and the epochNo
when the pool will be retired.