Overview

To stake assets, you create a staking-request transaction. BitGo uses the request to generate one or more delegation transactions, depending on the asset. Each transaction must abide by your policies, requiring approval, if configured, followed by signing and broadcasting.

Note

Staking protocols differ by asset. To learn asset-specific staking details, you can call the List coins available for staking endpoint.

Prerequisites

Cookbooks

Need just the steps? Expand a cookbook below to get started:

Stake Assets - Custody WalletOpen Cookbook Stake Assets - Self-Custody WalletOpen Cookbook Stake Assets - Go AccountOpen Cookbook

1. Create Staking Request

Create a staking request by specifying the staking details and sending them to BitGo. The following example shows the minimum required parameters for staking ether.

Endpoint: 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"
  }'

Step Result

BitGo uses the data you pass to build an unsigned staking request. The following example builds a staking request for 64 HTETH.

{
  "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 (Optional)

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. To get notified when staking requests are pending approval or signature, you can call the following:

Endpoint: List staking requests by enterprise

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"
  }'

Step Result

{
  "page": 1,
  "totalPages": 1,
  "totalElements": 1,
  "requests": [
    {
      "id": "e055adbc-66a3-4ccd-9a9d-726a05bca0cf",
      "clientId": "f054adbc-26a3-4acd-8a9d-726a05bca0dr",
      "requestUserId": "6092e75c451052000636831deb797bd1",
      "enterpriseId": "1032e75c451052000436831deb797af1",
      "walletId": "2032e75g451052000636831abd797bd3",
      "walletType": "custodial",
      "type": "STAKE",
      "coin": "hteth",
      "createdDate": "2022-01-10T14:32:28.000Z",
      "statusModifiedDate": "2022-01-10T14:32:28.000Z",
      "status": "NEW",
      "withdrawalAddress": "0x5a6406c9710f588ca733360bfa8033d0ef9ecd7c",
      "delegations": [
        {
          "id": "e0225adbc-66a3-4ccd-9a9d-726a05bca0cf",
          "delegationAddress": "0x5a6406c9710f588ca733360bfa8033d0ef9ecdy5",
          "withdrawalAddress": "0x5a6406c9710f588ca733360bfa8033d0ef9ecd7c",
          "delegated": "3200000000000000000",
          "status": "PENDING_APPROVAL",
          "rewards": "0",
          "lockedRewards": "0",
          "pendingUnstake": "3200000000000000000",
          "pendingStake": "0",
          "apy": "8.3",
          "coin": "hteth",
          "walletId": "2032e75g451052000636831abd797bd3",
          "unstakingFee": "100000000000000",
          "unstakingMin": "0"
        }
      ],
      "transactions": [
        {
          "id": "d0355adbc-55b43-5tta-9a9d-726a05bca0ai",
          "stakingRequestId": "e055adbc-66a3-4ccd-9a9d-726a05bca0cf",
          "createdDate": "2022-01-10T14:32:28.000Z",
          "statusModifiedDate": "2022-01-10T14:32:28.000Z",
          "status": "PENDING_APPROVAL",
          "amount": "3200000000000000000",
          "transactionType": "delegate",
          "delegationId": "e0225adbc-66a3-4ccd-9a9d-726a05bca0cf",
          "buildParams": {
            "recipients": {
              "amount": "3200000000000000000",
              "address": "0xff50ed3d0ec03aC01D4C79aAd74928BFF48a7b2b",
              "data": "fds0934rnnio390nw"
            },
            "stakingParams": {
              "requestId": "e055adbc-66a3-4ccd-9a9d-726a05bca0cf",
              "amount": "3200000000000000000",
              "validator": "0x5a6406c9710f588ca733360bfa8033d0ef9ecdy5",
              "actionType": "delegate"
            },
            "gasPrice": "1000000000000000",
            "gasLimit": "3000000000000000"
          }
        }
      ],
      "amount": "6400000000000000000",
      "gasPrice": "1000000000000000"
    }
  ]
}

3. Approve Request (Optional)

If you have a policy that requires approval, you must approve the staking request before signing and broadcasting.

Note

If you configure an approval requirement for staking requests, you can't approve your own transactions - another admin must approve them.

Endpoint: Update Pending Approval

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"'"
  }'

Step Result

{
  "id": "e055adbc-66a3-4ccd-9a9d-726a05bca0cf",
  "coin": "hteth",
  "wallet": "2032e75g451052000636831abd797bd3",
  "enterprise": "1032e75c451052000436831deb797af1",
  "creator": "62ab90e06dfda30007974f0a52a12995",
  "createDate": "2022-01-10T14:32:28Z",
  "info": {
    "type": "transactionRequest",
    "transactionRequest": {
      "requestedAmount": "3200000000000000000",
      "fee": 20451,
      "sourceWallet": "2032e75g451052000636831abd797bd3",
      "policyUniqueId": "654ec786c07fe8dc0dcfe03f",
      "recipients": [
        {
          "address": "0x5a6406c9710f588ca733360bfa8033d0ef9ecdy5",
          "amount": "3200000000000000000",
          "_id": "65529448bd87efe59c3b0158"
        }
      ],
      "coinSpecific": {}
    }
  },
  "state": "approved",
  "scope": "wallet",
  "userIds": [
    "62ab90e06dfda30007974f0a52a12995",
    "621d08a634ad8a0007fcddffd7c429cc"
  ],
  "approvalsRequired": 1
}

Next

BitGo signs the transaction and broadcasts it to the blockchain. You can view the completed staking request in BitGo or on a blockchain explorer.

See Also