NAV
shell php javascript java csharp ruby python go

Introduction

Welcome to the BLOCKSDK developer documentation! BLOCKSDK API is an API service to reduce the difficulty of developing cryptocurrency services and reduce the cost of operating node servers. Each blockchain protocol can be developed even by non-professional developers without a separate blockchain node server. More than 500 virtual asset market data inquiry, Bitcoin, Bitcoin Cash, Ethereum, Dash, Monero, ERC20, Litecoin, etc. It supports more than 6 blockchain protocols with API and SDK libraries composed of various programming languages for rapid development. General questions can be found in the BLOCKSDK FAQ

Get an API token for free

Quick Start Guide

Quickstart sample code:

curl -H "X-API-TOKEN: YOU_API_TOKEN" -H "Accept: application/json" -G https://api.blocksdk.com/v2/btc/info
blockSDK = BlockSDK.new('YOU TOKEN')
btcClient = blockSDK.createBitcoin()

blockchain = btcClient.getBlockChain()

puts blockchain
import BlockSDK
blockSDK = BlockSDK("YOU_API_TOKEN")
btcClient = blockSDK.createBitcoin()
blockchain = btcClient.getBlockChain()

print(blockchain)
const BlockSDK = require('blocksdk');

var blockSDK = new BlockSDK("YOU_API_TOKEN");
var btcClient = blockSDK.createBitcoin();
var blockchain = btcClient.getBlockChain();
console.log(blockchain);
import (  
    "fmt"
    "github.com/Block-Chen/blocksdk-go/blocksdk"
)



func main() {
    client := blocksdk.NewBlockSDK("a4iLdJyOCN3tOl5smPXKf9wp0O5Xqgo774mAH9UZ")
    btcClient := client.CreateBitcoin()
    chain := btcClient.GetBlockChain();

    fmt.Println(chain["bestblockhash"].(string))
}

use BlockSDK;

$blockSDK = new BlockSDK("YOU_API_TOKEN");
$btcClient = $blockSDK->createBitcoin();

//or

$btcClient = BlockSDK::createBitcoin("YOU_API_TOKEN");
$blockchain = $btcClient->getBlockChain();
print_r($blockchain);

Response Body

{
    "payload": {
        "network": "mainnet",
        "currency": "BTC",
        "last_block_height": 665097,
        "last_block_hash": "0000000000000000000cee5f64306dedad1abca11f1635e3f3472339c641b502",
        "last_block_datetime": "2021-01-08T09:00:18+00:00",
        "last_block_timestamp": 1610096418,
        "prev_block_height": 665096,
        "prev_block_hash": "00000000000000000007a4153d79932364460ae7ee38eeca933d68cf8ed9bcf8",
        "prev_block_datetime": "2021-01-08T08:51:20+00:00",
        "prev_block_timestamp": 1610095880,
        "unconfirmed_count": 19585,
        "low_fee_per_kb": 0.00016,
        "medium_fee_per_kb": 0.00026,
        "high_fee_per_kb": 0.00053
    },
    "state": {
        "code": 200,
        "success": true
    }
}

For developers looking to get started with the BLOCKSDK API, here are a few simple steps to make the first call to the API.

1.Register as a BLOCKSDK member. You can sign up for free.

2.After logging in or signing up, copy the API token from the box in the'API Token' panel on the dashboard.

3.You can call the API using the copied API token using the code example provided below.

4.Develop and implement the service. Now that you have verified that the API works, read the rest of this developer documentation to get started developing your service!

Authentication

Acquiring an API Key

All HTTP requests to the BLOCKSDK API must be verified with an API token. If you do not have an API token yet, please visit the BLOCKSDK portal to sign up

Using Your API Key

Any server-side programming language capable of making HTTP requests against the BLOCKSDK API can be used. All requests must be directed to the https://api.blocksdk.com domain

You can provide an API token to a REST API call in one of two ways:

Preferred method: X-API-TOKEN via custom header

Convenient way: api_token via query string parameter

Security Warning: It is important to protect your API keys from public access.

API usage count

API usage increases 1:1 for successful (HTTP status 200) data calls.

Endpoint Overview

Blockchain Service API Endpoint

Endpoint Category Description
/btc/* An endpoint that generates or returns bitcoin-related data.
/bch/* An endpoint that generates or returns Bitcoin Cash related data.
/ltc/* An endpoint that generates or returns Litecoin related data.
/dash/* An endpoint that generates or returns dash-related data.
/eth/* An endpoint that generates or returns data related to Ethereum and ERC20.
/xmr/* An endpoint that generates or returns data related to Monero.

Blockchain API common endpoint path

Endpoint path Description
*/info Endpoint that returns blockchain-related data
*/mempool Endpoint that returns memory pool related data
*/block/* Endpoint returning block-related data
*/addresses/* An endpoint that creates an address or returns related data
*/wallets/* An endpoint that creates a wallet or returns relevant data
*/transactions/* Endpoints that send transactions or return related data

Other API endpoints

Endpoint Category Description
/hooks/* An endpoint that generates or returns event webhook related data.
/market/* An endpoint that returns data related to exchange quotes.
/token/* An endpoint that returns API token related data.
/tools/* Utility endpoint.

Standards and Conventions

Each HTTP request must have a header Accept: application/json Also, you need to send a header to receive Accept-Encoding: deflate, gzip data quickly and efficiently.

Endpoint Response Payload Format

All endpoints payload will return JSON-formatted data with query results if the call is successful.

The Status object always includes the presence or absence of success and the HTTP Response Code. If success of Status object returns false, payload does not return but error object is returned.

Cryptocurrency Symbol

Cryptocurrency Symbol
Bitcoin btc
Bitcoin Cash bch
Litecoin ltc
Dash dash
Ethereum eth
Monero xmr
Legal tender Symbol
US dollar USD
Euro EUR
Chinese yuan renminbi CNY
South Korean won KRW
Japanese yen JPY
Pound sterling GBP
Hungarian forint HUF
Polish zloty PLN
Bulgarian lev BGN
Czech koruna CZK
Danish krone DKK
Romanian leu RON
Swedish krona SEK
Swiss franc CHF
Icelandic krona ISK
Norwegian krone NOK
Croatian kuna HRK
Russian rouble RUB
Turkish lira RUB
Australian dollar AUD
Brazilian real BRL
Canadian dollar CAD
Hong Kong dollar HKD
Indonesian rupiah IDR
Israeli shekel ILS
Indian rupee INR
Mexican peso MXN
Malaysian ringgit MYR
New Zealand dollar NZD
Philippine peso PHP
Singapore dollar SGD
Thai baht THB
South African rand ZAR

Date and Time Formats

For all endpoints that require a date/time parameter, a timestamp You can pass it in ISO8601 format (e.g.) 2021-01-08T11:42:51+00:00 or Unix time (e.g.) 1610106171 Timestamps passed in ISO8601 format support basic and extended notation. UTC is the default time value. All timestamps returned in the JSON payload are returned in UTC time using a human-readable ISO 8601 format that follows the following pattern:

Versioning

The BLOCKSDK API is versioned to ensure that new features and updates are not interrupted. The latest version of this API is /v2/

Errors and Rate Limits

API Request Throttling

Use of the BLOCKSDK API is subject to the API call rate limit or “request limit”. API token before receiving HTTP 429 "Too Many Requests" throttling error The number of HTTP calls that can be made simultaneously using or within the same minute. This limit extends according to your usage plan and resets every 60 seconds. Review the best practices for rate limiting and an implementation strategy that works well.

HTTP Status Codes

The API uses standard HTTP status codes to indicate the success or failure of an API call.

Error Response Codes

The status object is always included in the payload of the JSON response for all successful invocations and failures whenever possible. During error scenarios you can refer to the code of the status object and the message property of the error object. If applicable, one of the API error codes below is returned. Otherwise, an HTTP status code for the generic error type is returned.

HTTP Status Error Code Error Message
401 1001 [API_KEY_INVALID] This API Key is invalid.
401 1002 [API_KEY_MISSING] API key missing.
403 1004 [API_KEY_DISABLED] An API Key is required for this call.
429 1005 [API_KEY_PLAN_MINUTE_RATE_LIMIT_REACHED] You've exceeded your API Key's HTTP request rate limit. Rate limits reset every minute.
429 1006 [API_KEY_PLAN_DAILY_RATE_LIMIT_REACHED] You've exceeded your API Key's daily rate limit.