How To Access Oasis API

Learn how to access Oasis API.

Step 1: To access the available Oasis methods, use the following native access endpoint:

  • Network: Oasis Mainnet
  • Request Type: POST
https://svc.blockdaemon.com/oasis/mainnet/native

Step 2: You should authorize your request. Learn more: Authentication Guide

Step 3: Specify an Oasis method at the end of the query:

https://svc.blockdaemon.com/oasis/mainnet/native/YOUR_METHOD

Step 4: Specify the data required by the method in the request body.

Example Requests

Example 1: Here is a cURL example for using POST /network/list to get the network identifier of Oasis Mainnet:

curl -X POST \
https://svc.blockdaemon.com/oasis/mainnet/native/network/list \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"metadata": {}}'

The following is a typical response you will get:

{
    "network_identifiers": [
        {
            "blockchain": "Oasis",
            "network": "b11b369e0da5bb230b220127f5e7b242d385ef8c6f54906243f30af63c815535"
        }
    ]
}

Example 2: Here is a cURL example for using POST /network/status to get the current status of Oasis Mainnet:

curl -X POST \
https://svc.blockdaemon.com/oasis/mainnet/native/network/status \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"metadata": {}, "network_identifier": {"blockchain": "Oasis", "network": "b11b369e0da5bb230b220127f5e7b242d385ef8c6f54906243f30af63c815535"}}'

The following is a typical response you will get:

{
    "current_block_identifier": {
        "index": 9985468,
        "hash": "b74c203aedecfd9f15e7da82cf85bad904a4f51734e2bb0e93ebb449c7ef02bf"
    },
    "current_block_timestamp": 1661160818000,
    "genesis_block_identifier": {
        "index": 8048956,
        "hash": "0000000000000000000000000000000000000000000000000000000000000000"
    },
    "oldest_block_identifier": {
        "index": 9284103,
        "hash": "8bdd726805da09c493e532e5d2a9b6124d5cfc2d1e4209ddd722c7fa0974f2d8"
    },
    "peers": [
        {
            "peer_id": "[email protected]:26656"
        },
        { ...more items... }
    ]
}

Example 3: Here is a cURL example for using POST /block to get a block by index in Oasis Mainnet:

curl -X POST \
https://svc.blockdaemon.com/oasis/mainnet/native/block \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"metadata": {}, "network_identifier": {"blockchain": "Oasis", "network": "b11b369e0da5bb230b220127f5e7b242d385ef8c6f54906243f30af63c815535"}, "block_identifier": {"index": 9985468}}'

The following is a typical response you will get:

{
    "block": {
        "block_identifier": {
            "index": 9985468,
            "hash": "b74c203aedecfd9f15e7da82cf85bad904a4f51734e2bb0e93ebb449c7ef02bf"
        },
        "parent_block_identifier": {
            "index": 9985467,
            "hash": "ca81d8f4e70bee34fd2be0b76713824d0d9bb85975f1d39c8b72564ea3a1c7d9"
        },
        "timestamp": 1661160818000,
        "transactions": [
            {
                "transaction_identifier": {
                    "hash": "5aa588eddf7c862b1d4f6f775f8b0322a67ca07f0d50a71c4948406fd28010f7"
                },
                "operations": []
            },
            { ...more items... }
        ],
        "metadata": {
            "epoch": 16629
        }
    }
}