Create Unstaking Request
Overview
To transact using your staked assets, including your earned rewards, you must first unstake them. Unstaked assets stop receiving rewards. Like staking, unstaking transactions must abide by your enterprise and wallet policies. When unstaking, some assets have a defined cooldown period when the asset can't be used.
For many assets, unstaking requires 2 transactions:
- An unstaking transaction to start the unstaking process.
- A claim transaction to retrieve the delegated amount which, including rewards.
Once the delegated amount is unlocked, you can transfer the funds out of the staking wallet.
When you submit an unstaking request, BitGo determines the number of transactions needed to unstake and generates the first unstaking transaction for you to sign. After BitGo broadcasts the full-signed unstaking transaction, the cooldown period begins. When the cooldown period finishes, BitGo automatically generates the claim transaction you to sign.
Prerequisites
Steps
1. Submit Unstaking Request
For ETH, currently only wallet administrators can create an unstaking request.
1 2 3 4 5 6 7 8 9 10 11
const stakingWallet = wallet.toStakingWallet(); const stakingRequest = await stakingWallet.unstake({ // for assets other than ETH, pass delegationId delegationId: 'e0225adbc-66a3-4ccd-9a9d-726a05bca0cf', // for ETH, pass delegationIds // excluding delegationIds unstakes from all validators delegationIds: [ 'e0225adbc-66a3-4ccd-9a9d-726a05bca0cf' ], cliendId: 'e055adbc-66a3-4ccd-9a9d-726a05bca0cf' });
Step Result
BitGo generates an unstaking transaction for you to sign.
Note: For ETH, you must wait for the unstaking transaction to complete before initiating a new unstaking request for the same wallet.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
{ "id": "e055adbc-66a3-4ccd-9a9d-726a05bca0cf", "requestingUserId": "6092e75c451052000636831deb797bd1", "type": "UNSTAKE", "enterpriseId": "1032e75c451052000436831deb797af1", "walletId": "2032e75g451052000636831abd797bd3", "walletType": "custodial", "withdrawalAddress": "0xeea83a40a0fd35096b84395c1ae14900e460c7a3", "coin": "gteth", "status": "NEW", "statusModifiedDate": "2023-04-19T23:15:12.7244Z", "createdDate": "2023-04-19T23:15:12.724395Z", "delegations": [ { "id": "e0225adbc-66a3-4ccd-9a9d-726a05bca0cf", "delegationAddress": "8dcf640ca21a6e411ce8a2645febdb45cc247272e9fe71246006a54222bcdf0c4881ed30b787d5383f622514483bb427", "withdrawalAddress": "0xeea83a40a0fd35096b84395c1ae14900e460c7a3", "delegated": "32003969181000000000", "coin": "eth", "walletId": "2032e75g451052000636831abd797bd3", "status": "ACTIVE", "rewards": "807047532000000000", "lockedRewards": "0", "pendingUnstake": "32003969181000000000", "pendingStake": "0", "reserved": "0", "pendingReserved": "0", "apy": "4.7200" } ] }
2. (Optional) Get Status of Unstaking Transaction
Get notified when your unstaking transactions are ready for signatures or approvals. To get notified about unstaking transactions pending approval, you can Create Webhooks. To get notified about unstaking transactions pending signature and approval, using the following:
1 2 3 4 5 6 7 8 9
GET /api/staking/v1/enterprises/{enterpriseId}/requests/transactions Request Body { "walletType": "custodial", "walletId": "2032e75g451052000636831abd797bd3", "requestType": "UNSTAKE" "requestStatus": "PENDING_APPROVAL" }
Next Steps
- Transaction Approval (Optional) - If the unstaking transaction requires admin approval, it remains in a pending approval status until receiving final approval.
- If a claim transaction is required, after the unstaking cooldown period, BitGo automatically generates the claim transaction.
- Transaction Approval (Optional) - If the claim transaction requires admin approval, it remains in a pending approval status until receiving final approval.