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);
Response
// 1. Create Staking Request Response
{
"id": "e055adbc-66a3-4ccd-9a9d-726a05bca0cf",
"clientId": "e055adbc-66a3-4ccd-9a9d-726a05bca0cf",
"requestUserId": "6092e75c451052000636831deb797bd1",
"enterpriseId": "1032e75c451052000436831deb797af1",
"walletId": "2032e75g451052000636831abd797bd3",
"walletType": "custodial",
"type": "STAKE",
"coin": "hteth",
"createdDate": "2022-01-10T14:32:28Z",
"statusModifiedDate": "2022-01-10T14:32:28Z",
"status": "NEW",
"withdrawalAddress": "0x5a6406c9710f588ca733360bfa8033d0ef9ecd7c",
"amount": 6400000000000000000,
"gasPrice": 1000000000000000
}
// 2. Get Request Status Response
{
"page": 1,
"totalPages": 1,
"totalElements": 1,
"requests": [
{
"id": "e055adbc-66a3-4ccd-9a9d-726a05bca0cf",
"status": "PENDING_APPROVAL",
"transactions": [
{
"id": "d0355adbc-55b43-5tta-9a9d-726a05bca0ai",
"status": "PENDING_APPROVAL",
"amount": "3200000000000000000",
"transactionType": "delegate"
}
]
}
]
}
// 3. Approve Request Response
{
"id": "e055adbc-66a3-4ccd-9a9d-726a05bca0cf",
"coin": "hteth",
"wallet": "2032e75g451052000636831abd797bd3",
"enterprise": "1032e75c451052000436831deb797af1",
"state": "approved",
"approvalsRequired": 1
}