Staking API Usage
Staking API can be accessed via the CDP SDK, a simple client library for interacting with the Staking API, or through the CDP API, a restful API for direct http requests. For details on getting started with our SDK, see our quickstart.
Authentication
Our REST APIs use JWT tokens for authentication. Find more information on generating a JWT token in the language of your choice here.
Making an API request
-
Click through any API in the reference here to learn more about its parameters and usage.
-
Fill in the parameters. For APIs like BuildStakingOperation and GetStakingContext that require custom options, refer to the staking options section below for available options.
-
Select your preferred language on the right to generate a sample request code. Use this as a reference to make a staking API request.
For example, for the
BuildStakingOperation
API, the generated code for a Partial ETH stake of0.1 ETH
will look like this in some of the common languages: -
Finally, add the JWT token, obtained from the authentication section above, as a Bearer header in your request. The code will look like this:
Staking Options
Some staking APIs such as BuildStakingOperation and GetStakingContext require additional options to be passed in the request body specific to the staking network. See below to find the options available for each staking network.
Once you have identified which options you need, you can add them to the request body under the options
field like so:
Shared ETH Staking
Shared ETH staking supports the following BuildStakingOperation
actions: stake
, unstake
and claim_stake
.
See the tabs below for details on the options that can be used with each one.
Field Name | Description |
---|---|
mode required | The mode of staking. For Shared ETH Staking this should be partial . |
amount required | The amount to stake in wei . |
integrator_contract_address optional | The contract address for the staking operation. Defaults to the integrator contract address associated with the CDP account or a shared integrator contract address for that network. |
Field Name | Description |
---|---|
mode required | The mode of staking. For Shared ETH Staking this should be partial . |
amount required | The amount to stake in wei . |
integrator_contract_address optional | The contract address for the staking operation. Defaults to the integrator contract address associated with the CDP account or a shared integrator contract address for that network. |
Field Name | Description |
---|---|
mode required | The mode of staking. For Shared ETH Staking this should be partial . |
amount required | The amount to unstake in wei . |
integrator_contract_address optional | The contract address for the staking operation. Defaults to the integrator contract address associated with the CDP account or a shared integrator contract address for that network. |
Field Name | Description |
---|---|
mode required | The mode of staking. For Shared ETH Staking this should be partial . |
integrator_contract_address optional | The contract address for the staking operation. Defaults to the integrator contract address associated with the CDP account or a shared integrator contract address for that network. |
Field Name | Description |
---|---|
mode required | The mode of staking. For Shared ETH Staking this should be partial . |
integrator_contract_address optional | The contract address for the staking operation. Defaults to the integrator contract address associated with the CDP account or a shared integrator contract address for that network. |
Dedicated ETH Staking
Dedicated ETH staking supports the following BuildStakingOperation
actions: stake
and unstake
.
See the tabs below for details on the options that can be used with each one.
Field Name | Description |
---|---|
mode required | The mode of staking. For Dedicated ETH Staking this should be native . |
amount required | The amount to stake in wei and in multiples of 32 ETH . |
funding_address optional | Funding address for the stake operation. Defaults to the address initiating the stake operation. |
withdrawal_address optional | Rewards and withdrawal address. Defaults to the address initiating the stake operation. |
fee_recipient_address optional | Tx fee recipient address. Defaults to the address initiating the stake operation. |
withdrawal_credential_type optional | Prefix indicating the type of withdrawal credentials for the validator. Set to 0x02 for provisioning post Pectra validators.Possible values: 0x01 , 0x02 Defaults to pre Pectra validator prefix of 0x01 . |
top_up_validator_pubkey optional | The validator public key to top up. If provided, instead of creating a new validator, the existing validator will be topped up with the specified amount. |
Field Name | Description |
---|---|
mode required | The mode of staking. For Dedicated ETH Staking this should be native . |
amount required | The amount to stake in wei and in multiples of 32 ETH . |
funding_address optional | Funding address for the stake operation. Defaults to the address initiating the stake operation. |
withdrawal_address optional | Rewards and withdrawal address. Defaults to the address initiating the stake operation. |
fee_recipient_address optional | Tx fee recipient address. Defaults to the address initiating the stake operation. |
withdrawal_credential_type optional | Prefix indicating the type of withdrawal credentials for the validator. Set to 0x02 for provisioning post Pectra validators.Possible values: 0x01 , 0x02 Defaults to pre Pectra validator prefix of 0x01 . |
top_up_validator_pubkey optional | The validator public key to top up. If provided, instead of creating a new validator, the existing validator will be topped up with the specified amount. |
Field Name | Description |
---|---|
mode required | The mode of staking. For Dedicated ETH Staking this should be native . |
amount required | The amount to unstake in wei and in multiples of 32 ETH . |
unstake_type optional | The type of unstaking operation to perform. Possible values: consensus , execution Defaults to consensus . |
immediate optional | Set to true for immediate unstake using Coinbase managed unstake process.Defaults to false for User managed unstake process. |
validator_pub_keys optional | Comma-separated list of validator public keys to unstake. Defaults to validators selected based on the unstake amount. |
Field Name | Description |
---|---|
source_validator_pubkey required | The source validator public key to consolidate. This can be either a 0x01 or 0x02 validator. |
target_validator_pubkey required | The target validator public key to which the source validator will be consolidated into. This can be either a 0x01 or 0x02 validator. |
Field Name | Description |
---|---|
mode required | The mode of staking. For Dedicated ETH Staking this should be native . |
validator_pub_keys optional | List of comma separated validator public keys to retrieve unstakeable balance for. Defaults to all validators. |
withdrawal_credential_type optional | Prefix indicating the type of validator for which we want to get the context. Set to 0x02 for post Pectra validators.Possible values: 0x01 , 0x02 Defaults to pre Pectra validator prefix of 0x01 . |
SOL Staking
SOL staking supports the following BuildStakingOperation
actions: stake
, unstake
and claim_stake
.
See the tabs below for details on the options that can be used with each one.
Field Name | Description |
---|---|
amount required | The amount to stake in lamports . |
validator_address optional | The validator address to which you want to stake. Defaults to the Coinbase Solana validator. See here for validator details. |
Field Name | Description |
---|---|
amount required | The amount to stake in lamports . |
validator_address optional | The validator address to which you want to stake. Defaults to the Coinbase Solana validator. See here for validator details. |
Field Name | Description |
---|---|
amount required | The amount to unstake in lamports . |