[OLD]Quick Start - Staking API

👋 Welcome! Get started with our Staking API.

Welcome to our guide to quickly get started with the Staking API! It enables you to use a standardized and trusted API to integrate with your platforms. In this comprehensive guide, we will walk you through the steps to test the API endpoints with cURL, Postman, and our API Reference docs.

Simply follow the steps below, and you'll be up and running with our Staking API in no time!

Test Staking API Endpoints

1. Sign Up for a Blockdaemon Account

If you haven't done so already, you will need to sign up for a Blockdaemon account. You can do this by visiting Blockdaemon's website. Follow the steps enlisted here to create a free Blockdaemon account.

2. Generate a Staking API Key on Blockdaemon App

To use the Blockdaemon Staking API, you need to sign up for an API key. To do this, contact Blockdaemon sales to register for a staking account. and follow the steps here to generate the API key.

🚧

Caution!

Keep the key safe and secure, if someone gains access to your API key, they can potentially access and modify your data.

3. Authorize and Send a Request With the Staking API

Let's learn how to send a request with the Staking API using an example. The example used uses the Staking API to return the details of a stake.

➡️ Using cURL

Follow these steps to run Staking API's endpoints using cURL:

  1. Launch your preferred command-line tool, such as macOS Terminal, Windows Command Prompt, etc. Please note that in some cases, you will also need to install cURL.
  2. Authorize your request before sending it. Set your API key as a bearer token in the authorization header. Paste the following and run your request:
    curl --request GET 'https://svc.blockdaemon.com/boss/v1/stakes/stake_Wgx98Rbi8nQuL9ddn3mTk1' \ 
    -H "Authorization: Bearer YOUR_API_KEY'
    
  3. The API response will be displayed in your command-line tool. The received output contains the details of the stake:
    {
      "id": "stake_Wgx98Rbi8nQuL9ddn3mTk1",
      "stake_intent_id": "stake_intent_Wgx98Rbi8nQuL9ddn3mTk1",
      "protocol": "ethereum",
      "network": "mainnet",
      "status": "active",
      "ethereum": {
        "amount": "32000000000",
        "validator_public_key": "0xa1d1ad0714035353258038e964ae9675dc0252ee22cea896825c01458e1807bfad2f9969338798548d9858a571f7425c",
        "withdrawal_credentials": "0x0092c20062cee70389f1cb4fa566a2be5e2319ff43965db26dbaa3ce90b9df99"
      },
      "polkadot": {
        "amount": "100",
        "validator_public_key": "0xa1d1ad0714035353258038e964ae9675dc0252ee22cea896825c01458e1807bfad2f9969338798548d9858a571f7425c"
      },
      "validator": {
        "id": "a111b9fa-0dd8-11ed-861d-0242ac120002",
        "protocol": "ethereum",
        "network": "mainnet",
        "node_xid": "blr6lovnplt09b862ej0",
        "node_validator_id": "88a1f6b58e05aea38e3e3c776c6e11e6ac959567799dbb849530961e6ddf4078a7985b3cc23f6e11e124fa8ee0298a7a",
        "status": "active"
      }
    }
    

➡️ Using Postman

Follow these steps to run the Staking API's endpoints using Postman:

  1. Install Postman on your computer or use the web version.
  2. Authorize your request:
    • Go to your workspace in Postman.
  • Click on the ‘+’ button on the top to open a new tab.
  • Navigate to the Authorization tab under the URL input field.
  • Select Bearer Token from the Type drop-down menu.
  • Paste your API key into the Token input box.
  1. Send your request:
    • In the URL input field, paste the relevant endpoint's URL, for example:
    https://svc.blockdaemon.com/boss/v1/stakes/{stake_id}
    
    • Select GET from the drop-down menu on the left.
    • Click on the Send button on the right.
  1. The API response will be displayed in your command-line tool. The received output contains the details of the stake ID send in the request:
    {
      "id": "stake_Wgx98Rbi8nQuL9ddn3mTk1",
      "stake_intent_id": "stake_intent_Wgx98Rbi8nQuL9ddn3mTk1",
      "protocol": "ethereum",
      "network": "mainnet",
      "status": "active",
      "ethereum": {
        "amount": "32000000000",
        "validator_public_key": "0xa1d1ad0714035353258038e964ae9675dc0252ee22cea896825c01458e1807bfad2f9969338798548d9858a571f7425c",
        "withdrawal_credentials": "0x0092c20062cee70389f1cb4fa566a2be5e2319ff43965db26dbaa3ce90b9df99"
      },
      "polkadot": {
        "amount": "100",
        "validator_public_key": "0xa1d1ad0714035353258038e964ae9675dc0252ee22cea896825c01458e1807bfad2f9969338798548d9858a571f7425c"
      },
      "validator": {
        "id": "a111b9fa-0dd8-11ed-861d-0242ac120002",
        "protocol": "ethereum",
        "network": "mainnet",
        "node_xid": "blr6lovnplt09b862ej0",
        "node_validator_id": "88a1f6b58e05aea38e3e3c776c6e11e6ac959567799dbb849530961e6ddf4078a7985b3cc23f6e11e124fa8ee0298a7a",
        "status": "active"
      }
    }
    

➡️ Using the API Reference Docs

Follow these steps to run the Staking API's endpoints using our API reference docs:

  1. Navigate to the API Reference > Staking API > the specific endpoint documentation page.
  2. If you have the Staking API key, you can copy the request to the tool of your choice and play around with it.

Integrate the API Into Your Application

Once you have tested the API and are familiar with its endpoints, you can start integrating it into your application and use it to automate staking activities.