Bitcoin

鉴权

请求 blockit 资源都需要进行鉴权。

请求路径:http://blockit.top/api/cloud/auth?auth_key=x

参数说明: auth_key 由三个参数组成:

  1. accessId 用户可在后台管理页面获取
  2. timestmap 时间戳
  3. md5('accessId-accessKey-timestamp') 三个参数的 md5 值

例如:

accessId = 'accessId'
accessKey = 'accessKey'
timestamp = 1540000000
strmd5 = md5('accessId-accessKey-1540000000') // '425164b33963021ad34f40b7a2ff143d'
auth_key = 'accessId-1540000000-425164b33963021ad34f40b7a2ff143d'

返回结果:

{
    "code": 0,
    "data": {
        "auth": "b5753b811cab571cdda9583651643238"
    },
    "msg": ""
}

auth字段需填写在所有访问资源 HTTP 请求头部的Authorization中。

查询 Bitcoin 地址 UTXO

请求路径:http://btc.blockit.top/api/address/utxo/{addr0,addr1}

请求例子:http://btc.blockit.top/api/address/utxo/3Nxwenay9Z8Lc9JBiywExpnEFiLp6Afp8v

返回结果:

{
    "code": 0,
    "data": {
        "has_next": true,
        "has_prev": false,
        "page": 1,
        "pages": 31,
        "per_page": 5,
        "total": 155,
        "utxos": [
            {
                "address": "3Nxwenay9Z8Lc9JBiywExpnEFiLp6Afp8v",
                "height": 383872,
                "outputIndex": 0,
                "satoshis": 100000,
                "script": "a914e95dbb25283cc35d4a6aefa76c0382e63ce0fa3687",
                "txid": "dfe6291b13bd236257dab7baef90b160da085717fc04807b4cbb4ca60ea62f2c"
            }
        ]
    }
}

查询 Bitcoin 地址余额

请求路径:http://btc.blockit.top/api/address/balance/{addr0,addr1}

请求例子:http://btc.blockit.top/api/address/balance/3Nxwenay9Z8Lc9JBiywExpnEFiLp6Afp8v

返回结果:

{
    "code": 0,
    "data": {
        "balance": 10784828504252,
        "received": 78428890504252
    },
    "msg": ""
}

查询 Bitcoin 地址交易记录

请求路径:http://btc.blockit.top/api/address/utxo/{addr0,addr1}

请求例子:http://btc.blockit.top/api/address/tx/18cBEMRxXHqzWWCxZNtU91F5sbUNKhL5PX?sh=500010&eh=500030

返回结果:

{
    "code": 0,
    "data": [
        "9d62709a039579c04d5c1a81a5b60792e0024a85bf02fd0e5c261953a07c39c5",
        "a96c872a13f4b20b756154742709d5cead2a3dbd9686cff28e75046376c00167",
        "6d8663eb22c3c5355d3de73081df1ad7fb0f4b5e79ed158f1d3ea3eaeb0f6453",
        "0dfbb7644d58b13a2921bfa658acd82a77ecc8c51457a0018dab4801c8691cf1",
        "f34b702245c0aac8f3c15c4ac4f3d7a2bf70324872ee8b14cab10e6f767edeb3"
    ],
    "msg": ""
}

通用错误码

错误码 含义
10000 鉴权失败
50000 服务过载

Bitcoin-sv(BSV)

您只需要将域名btc.blockit.top修改为bsv.blockit.top即可访问 bsv 相关接口。

即将支持更多公链 API

链接
联系我们