Stake Assets - Custody Wallet
Create a staking request for custody wallets. See the Guide.
-
Create a staking request by specifying the staking details and sending them to BitGo. The example shows the minimum required parameters for staking ether.
Prerequisites:
- Complete the Get Started guide
- Create Wallets
- Enable staking in your enterprise by contacting sales@bitgo.com
-
Validators must process your staking request before the request is ready for approval and signing. To get notified when staking requests are pending approval, you can Create Webhooks.
-
If you have a policy that requires approval, you must approve the staking request before signing and broadcasting. You cannot approve your own transactions — another admin must approve them.
// 1. Create Staking Request
export COIN="<ASSET_ID>"
export WALLET_ID="<YOUR_WALLET_ID>"
export ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>"
export AMOUNT="<AMOUNT_IN_BASE_UNITS>"
curl -X POST \
https://app.bitgo-test.com/api/staking/v1/$COIN/wallets/$WALLET_ID/requests \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-d '{
"amount": "'"$AMOUNT"'",
"type": "STAKE"
}'
// 2. Get Request Status (Optional)
export ENTERPRISE_ID="<YOUR_ENTERPRISE_ID>"
export ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>"
export WALLET_TYPE="<YOUR_WALLET_TYPE>"
export WALLET_ID="<YOUR_WALLET_ID>"
curl -X GET \
https://app.bitgo-test.com/api/staking/v1/enterprises/$ENTERPRISE_ID/requests/transactions \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-d '{
"walletType": "'"$WALLET_TYPE"'",
"walletId": "'"$WALLET_ID"'",
"requestType": "STAKE",
"requestStatus": "PENDING_APPROVAL"
}'
// 3. Approve Request (Optional)
export APPROVAL_ID="<APPROVAL_ID>"
export ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>"
export OTP="<YOUR_OTP>"
curl -X PUT \
https://app.bitgo-test.com/api/v2/pendingApprovals/$APPROVAL_ID \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-d '{
"state": "approved",
"otp": "'"$OTP"'"
}'
// 1. Create Staking Request
const stakingWallet = wallet.toStakingWallet();
const stakingRequest = await stakingWallet.stake({
amount: '<AMOUNT_IN_BASE_UNITS>'
});
// 2. Get Request Status (Optional)
// Use webhooks or call the List staking requests endpoint via REST API
// 3. Approve Request (Optional)
const baseCoin = this.bitgoSDK.coin(initialPendingApproval.coin);
const pendingApproval = await baseCoin.pendingApprovals().get({ id: initialPendingApproval.id });
const result = await pendingApproval.approve(params);
// 1. Create Staking Request Response
{
"id": "c57585dd-2008-4af0-90f8-e20fdc047603",
"requestingUserId": "6092e75c451052000636831deb797bd1",
"type": "STAKE",
"enterpriseId": "1032e75c451052000436831deb797af1",
"walletId": "2032e75g451052000636831abd797bd3",
"walletType": "hot",
"withdrawalAddress": "HLqx4vChmc1X9DSkzds7a2awzV9Vg3NTtR8BVoeCjd1Y",
"coin": "tsol",
"status": "NEW",
"statusModifiedDate": "2022-01-10T14:32:28.621357Z",
"createdDate": "2022-01-10T14:32:28.621333Z",
"delegations": [],
"transactions": [],
"totalStaked": "0",
"amount": "1100000000",
"stakingType": "SOL_STAKE",
"validator": "vgcDar2pryHvMgPkKaZfh8pQy4BJxv7SpwUG7zinWjG",
"objectType": "SOL_STAKE"
}
// 2. Get Request Status Response
{
"requests": [
{
"id": "c57585dd-2008-4af0-90f8-e20fdc047603",
"requestingUserId": "6092e75c451052000636831deb797bd1",
"type": "STAKE",
"enterpriseId": "1032e75c451052000436831deb797af1",
"walletId": "2032e75g451052000636831abd797bd3",
"walletLabel": "Ops Staking Wallet",
"walletType": "hot",
"withdrawalAddress": "HLqx4vChmc1X9DSkzds7a2awzV9Vg3NTtR8BVoeCjd1Y",
"coin": "tsol",
"status": "READY",
"statusModifiedDate": "2022-01-10T14:32:55.273649Z",
"createdDate": "2022-01-10T14:32:48.621333Z",
"delegations": [
{
"id": "21d8a64d-78c3-44ef-ba96-aa0668971618",
"delegationAddress": "vgcDar2pryHvMgPkKaZfh8pQy4BJxv7SpwUG7zinWjG",
"validatorAddress": "vgcDar2pryHvMgPkKaZfh8pQy4BJxv7SpwUG7zinWjG",
"withdrawalAddress": "HLqx4vChmc1X9DSkzds7a2awzV9Vg3NTtR8BVoeCjd1Y",
"provider": "Go",
"providerType": "GO",
"delegated": "0",
"coin": "tsol",
"walletId": "2032e75g451052000636831abd797bd3",
"properties": {
"validatorAddress": "vgcDar2pryHvMgPkKaZfh8pQy4BJxv7SpwUG7zinWjG",
"stakingType": "SOL_STAKE",
"type": "SOL",
"coinSymbol": "tsol"
},
"status": "PENDING",
"rewards": "0",
"lockedRewards": "0",
"pendingUnstake": "0",
"pendingStake": "1100000000",
"reserved": "0",
"pendingReserved": "0",
"apy": "5.26",
"unstakingFee": "0",
"unstakingMin": "0",
"unstakeable": false,
"permissionAttributes": {
"staking": {
"enabled": false,
"disabledReason": "Delegation is not active.",
"allowClientToUseOwnValidator": false
},
"unstaking": {
"enabled": false,
"disabledReason": "Delegation is not active."
}
}
}
],
"transactions": [
{
"id": "a3a0787d-9b40-4b6e-a501-52138a569041",
"stakingRequestId": "c57585dd-2008-4af0-90f8-e20fdc047603",
"delegationId": "21d8a64d-78c3-44ef-ba96-aa0668971618",
"createdDate": "2022-01-10T14:32:48.658655Z",
"transactionType": "delegate",
"status": "READY",
"statusModifiedDate": "2022-01-10T14:32:55.273562Z",
"amount": "1100000000",
"txRequestId": "019fecd0-3116-7396-a9c8-1e7cae382cdf"
}
],
"totalStaked": "0",
"amount": "1100000000",
"stakingType": "SOL_STAKE",
"validator": "vgcDar2pryHvMgPkKaZfh8pQy4BJxv7SpwUG7zinWjG",
"objectType": "SOL_STAKE"
}
],
"page": 1,
"totalPages": 1,
"totalElements": 1
}
// 3. Approve Request Response
{
"id": "c57585dd-2008-4af0-90f8-e20fdc047603",
"coin": "tsol",
"wallet": "2032e75g451052000636831abd797bd3",
"enterprise": "1032e75c451052000436831deb797af1",
"state": "approved",
"approvalsRequired": 1
}