跳至主要內容

地址

tokenview大约 3 分钟

地址

Bitcoin三种格式地址:

  • Legacy (P2PKH)格式
    地址以「1」开头,是比特币自最初源用至今的地址格式,也是最常见的地址格式,至于P2PKH是「Pay To PubKey Hash」(付款至公钥哈希值)的缩写。如:1Fh7ajXabJBpZPZw8bjD3QU4CuQ3pRty9u
  • Nested SegWit (P2SH)格式
    地址以「3」开头,从这种格式我们无法区分它们到底是多重签名(MultiSig)地址还是隔离见证兼容地址,P2SH 是 Pay To Script Hash「付款到脚本哈希值」的缩写,它支持比 Legacy 格式更复杂的功能,例如指定多个数字签名来授权事务。如:3KF9nXowQ4asSGxRRzeiTpDjMuwM2nypAN
  • Native SegWit (Bech32)格式
    地址以「bc1」开头,属于本地SegWit地址格式,专为SegWit而开发的地址格式有些交易所可能还未有支持这种格式的地址目前在这种格式的地址上的比特币数量在三种格式中是最少的。如:bc1qf3uwcxaz779nxedw0wry89v9cjh9w2xylnmqc3

地址余额

GET https://services.tokenview.io/vipapi/addr/b/{公链简称小写}/{地址}?apikey={apikey}

参数

Request

curl --location 'https://services.tokenview.io/vipapi/addr/b/btc/183hmJGRuTEi2YDCWy5iozY8rZtFwVgahM?apikey={apikey}'

Response

{
  "code": 1,
  "msg": "成功",
  "data": "0.0006679" //地址余额
}

地址交易列表

GET https://services.tokenview.io/vipapi/address/{公链简称小写}/{地址}/{页码}/{每页交易条数}?apikey={apikey}

参数

  • {公链简称小写}: BTC系列如 btc,ltc,doge 等;
  • {地址}:BTC系列链上地址;
  • {页码}:1,2,3,... 50,最多50页;
  • {每页交易条数}:1,2,3...50,每页交易条数,最多50条。
  • {apikey}: 可在Tokenview API 后台管理系统获取激活状态的 APIKEY: https://services.tokenview.ioopen in new window

Request

curl --location 'https://services.tokenview.io/vipapi/address/btc/1AqSbAsXh3zxE8Z61afpU65u4pxB9BBRcz/1/50?apikey={apikey}'

Response

{
    "code": 1,
    "msg": "成功",
    "data": [
        {
            "type": "address",
            "network": "BTC",
            "hash": "1AqSbAsXh3zxE8Z61afpU65u4pxB9BBRcz",
            "txCount": 2,
            "spend": "-0.07920632",
            "receive": "0.07920632",
            "normalTxCount": 0,
            "txs": [
                {
                    "type": "tx",
                    "network": "BTC",
                    "block_no": 573346,
                    "height": 573346,
                    "index": 808,
                    "time": 1556296856,
                    "txid": "83f86073df488e6f32acce48db40e86c4931ebe2a4f520641b1f12d96b00aa3b",
                    "fee": "0.00010775",
                    "confirmations": 101790,
                    "inputs": [
                        {
                            "input_no": 0,
                            "address": "1AqSbAsXh3zxE8Z61afpU65u4pxB9BBRcz",
                            "value": "0.07920632",
                            "received_from": {
                                "output_no": 0,
                                "txid": "fdc072a98dd017a8f3c0bcb0569f0b0ee33ef16a9dfb0e96e50866463e038142"
                            }
                        }
                    ],
                    "outputs": [
                        {
                            "output_no": 0,
                            "address": "1PuaubWLayAxAF8sAq6r41BAVYhSKAK4Nr",
                            "value": "0.07849857"
                        },
                        {
                            "output_no": 1,
                            "address": "17hLEAaZsaRxeBvpYB3JUjrwtSG8tUQaDG",
                            "value": "0.0006"
                        }
                    ],
                    "inputCnt": 1,
                    "outputCnt": 2
                },
                {
                    "type": "tx",
                    "network": "BTC",
                    "block_no": 573331,
                    "height": 573331,
                    "index": 11,
                    "time": 1556288370,
                    "txid": "fdc072a98dd017a8f3c0bcb0569f0b0ee33ef16a9dfb0e96e50866463e038142",
                    "fee": "0.00170771",
                    "confirmations": 101805,
                    "inputs": [
                        {
                            "input_no": 0,
                            "address": "1HG1kf8JcMCaQgh7d5YH5JFyy8soM4cRyK",
                            "value": "0.08151403",
                            "received_from": {
                                "output_no": 1,
                                "txid": "cd957a317f547ff23f623ba47067cc294297fadef89fb0e3bd229f226c43c498"
                            }
                        }
                    ],
                    "outputs": [
                        {
                            "output_no": 0,
                            "address": "1AqSbAsXh3zxE8Z61afpU65u4pxB9BBRcz",
                            "value": "0.07920632"
                        },
                        {
                            "output_no": 1,
                            "address": "17vuVSWNNRzE7HVRasQSSw5gqNPUH1UNyj",
                            "value": "0.0006"
                        }
                    ],
                    "inputCnt": 1,
                    "outputCnt": 2
                }
            ]
        }
    ]
}

应答字段说明

"data":{
    "type": "address",  // 该Json对象是地址Hash详情
    "network": "BTC",   // 该地址是BTC这条链
    "hash": "1AqSbAsXh3zxE8Z61afpU65u4pxB9BBRcz", // 地址hash
    "txCount": 2,   //  该地址的交易条数
    "spend": "-0.07920632",   // 转出的总金额(单位BTC)
    "receive": "0.07920632",  // 收到的总金额(单位BTC)
    "txs": [{
        "type": "tx",  // 该Json对象是交易详情
        "network": "BTC", // 该交易详情是BTC这条链
        "block_no": 573346, // 交易所属区块号
        "height": 573346, // 交易所属区块高度
        "index": 808, // 交易在区块里的位置
        "time": 1556296856, // 交易被打包的UTC时间
        "txid": "83f86073df488e6f32acce48db40e86c4931ebe2a4f520641b1f12d96b00aa3b", // 交易的hash
        "fee": "0.00010775", // 交易手续费(单位BTC)
        "confirmations": 46319, // 交易确认数
        "inputs": [
            {
                "input_no": 0, // 该input项的位置
                "address": "1AqSbAsXh3zxE8Z61afpU65u4pxB9BBRcz", // 地址hash
                "value": "0.07920632", // 此地址的转出金额(单位BTC)
                "received_from": {    // 此笔UTXO是从哪比交易得来的
                    "output_no": 0,  // output的位置
                    "txid": "fdc072a98dd017a8f3c0bcb0569f0b0ee33ef16a9dfb0e96e50866463e038142" // UTXO的交易hash
                }
            }
        ],
        "outputs": [
            {
                "output_no": 0, //该output项的位置
                "address": "1PuaubWLayAxAF8sAq6r41BAVYhSKAK4Nr", // 地址hash
                "value": "0.07849857" // 该地址收到的金额(单位BTC)
            },
            {
                "output_no": 1,
                "address": "17hLEAaZsaRxeBvpYB3JUjrwtSG8tUQaDG",
                "value": "0.0006"
            }
        ]
    }]
}

地址第一笔交易

GET https://services.tokenview.io/vipapi/firsttx/{公链简称小写}/{地址}?apikey={apikey}

参数

Request

curl --location https://services.tokenview.io/vipapi/firsttx/btc/1AqSbAsXh3zxE8Z61afpU65u4pxB9BBRcz?apikey={apikey}

Response

{
    "code": 1,
    "msg": "成功",
    "data": {
        "block": 573331,
        "time": 1556288370
    }
}

应答字段说明

{
    "block": 573331, // 交易所在的块高
    "time": 1556288370 // 交易发生的时间
}

地址未确认交易列表

GET https://services.tokenview.io/vipapi/pending/ntx/{公链简称小写}/{地址}?apikey={apikey}

参数

Request

curl --location https://services.tokenview.io/vipapi/pending/ntx/usdt/39ZEaLMDxWi5EWx9cQ2W3ixDP8rWHhz8GY?apikey={apikey}

Response

{
    "code": 1,
    "msg": "成功",
    "data": [
        {
            "type": "tx",
            "network": "USDT",
            "time": 1670468085,
            "txid": "f0af9582258bbce9e7712142a9150bf232aafcc707783fe81b94e7dd4318fd71",
            "fee": "0.00010000",
            "inputs": [
                {
                    "address": "39ZEaLMDxWi5EWx9cQ2W3ixDP8rWHhz8GY",
                    "value": "5000000.00000000"
                }
            ],
            "outputs": [
                {
                    "address": "37w1zHnZUDBqcR7jnxepXtREKQEHDnLN6Z",
                    "value": "5000000.00000000"
                }
            ],
            "inputCnt": 1,
            "outputCnt": 1,
            "type_int": 0,
            "type_str": "Simple Send"
        }
    ]
}
上次编辑于: