跳至主要內容

BTC Ordinals 订阅

tokenview大约 5 分钟

BTC Ordinals 订阅

Tokenview Bitcoin Ordinals 订阅追踪比特币链上铭文的铸造、买卖、交易等信息。

支持的订阅方式:

  • 按照 Bitcoin 地址进行订阅
    当Bitcoin地址上发生Inscription交易时,交易信息会以Json形式推送到所设置的Webhook上。
  • 按照 Inscription ID 进行订阅
    当Inscription ID 发生交易变动时,交易信息会以Json形式推送到所设置的Webhook上。

推送的消息格式:
Tokenview 后台系统会把 Json 格式的交易消息 POST 到您设置的 Webhook URL。您的服务器收到通知后,响应码需是200,并且应答body里必须返回非空文本信息,比如 ok。如发送失败,会自动重试 3 次。

推送格式示例如下:
{
    "address": "bc1pcks69jup7te4k8h006sxv6v47qyhpkuy9cznj8avlz3yq8ssszxs5r6aem", // 订阅对象
    "block": 804910,
    "input": "124dc8dd8b013dd29023ab0274b1bad7213d24b11e7319586a5d7489c6b40c3a:0",
    "inputAddr": "bc1p454g0l8c7ahq9qv6dspcefqm2tcm2d2l5a6sfj7m2vxf73cx8rfqwqf6rp",
    "inscriptionId": "ee615327bb32de543805ff3ad0768fb104c7cb995c6430ba2e8f8688d133ef9bi0",
    "inscriptionInfo":
    {
        "content": "{\"p\":\"brc-20\",\"op\":\"mint\",\"tick\":\"text\",\"amt\":\"1000\"}",
        "contentLength": "53 bytes",
        "contentLink": "/content/ee615327bb32de543805ff3ad0768fb104c7cb995c6430ba2e8f8688d133ef9bi0",
        "contentType": "text/plain;charset=utf-8",
        "createdTime": "2023-08-26 09:17:10 UTC",
        "genesisHeight": 804910,   // 创建inscription时所处的块高
        "genesisTransaction": "ee615327bb32de543805ff3ad0768fb104c7cb995c6430ba2e8f8688d133ef9b",
        "inscriptionId": "ee615327bb32de543805ff3ad0768fb104c7cb995c6430ba2e8f8688d133ef9bi0",
        "inscriptionNum": 26621314,
        "location": "ee615327bb32de543805ff3ad0768fb104c7cb995c6430ba2e8f8688d133ef9b:0:0",
        "output": "ee615327bb32de543805ff3ad0768fb104c7cb995c6430ba2e8f8688d133ef9b:0",
        "outputValue": 546,
        "ownerAddress": "bc1pcks69jup7te4k8h006sxv6v47qyhpkuy9cznj8avlz3yq8ssszxs5r6aem"
    },
    "isGenesis": 1, // 1: create, 0: transfer
    "msgType": "address-s",
    "network": "BTC",
    "output": "ee615327bb32de543805ff3ad0768fb104c7cb995c6430ba2e8f8688d133ef9b:0",
    "outputAddr": "bc1pcks69jup7te4k8h006sxv6v47qyhpkuy9cznj8avlz3yq8ssszxs5r6aem",
    "outputValue": 546,
    "satIndex": 0,
    "time": "1693041430000",
    "txHash": "ee615327bb32de543805ff3ad0768fb104c7cb995c6430ba2e8f8688d133ef9b",
    "txType": "Mint"
}

订阅的步骤:

  • 设置webhook url
  • 按照订阅方式添加相应的订阅对象
  • 接收推送的消息

设置 webhook URL

POST https://services.tokenview.io/vipapi/nftmonitor/setwebhookurl?apikey={apikey}'

参数

Request

curl -X POST -H 'content-type:text/plain' -d '{your_webhook_url}'
'https://services.tokenview.io/vipapi/nftmonitor/setwebhookurl?apikey={apikey}'

Response

{
    "code": 1,
    "msg": "success",
    "data": null
}

查询 webhook URL

GET https://services.tokenview.io/vipapi/nftmonitor/getwebhookurl?apikey={apikey}

参数

  • {apikey}: 可在Tokenview API 后台管理系统获取激活状态的 APIKEY: https://services.tokenview.io

Request

curl --location https://services.tokenview.io/vipapi/nftmonitor/getwebhookurl?apikey={apikey}

Response

{
    "code": 1,
    "msg": "success",
    "data": "https://9aa90255-9cde-453e-83a6-2916cd2c3725.mock.pstmn.io/webhook"
}

增加一个 Bitcoin 订阅地址

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

参数

Request

curl --location https://services.tokenview.io/vipapi/nftmonitor/address/add/btc/1P8ibjHnyXsQSxV1dtLBQ2RJkhiNfFiRUM?apikey={apikey}

Response

{
    "code": 1,
    "msg": "success",
    "data": null
}

查询已经订阅的 Bitcoin 地址列表

GET https://services.tokenview.io/vipapi/nftmonitor/address/list/{公链简称小写}?page={页码}&apikey={apikey}

参数

备注:

需指定公链简称小写和页码。

Request

curl --location https://services.tokenview.io/vipapi/nftmonitor/address/list/btc?page=1&apikey={apikey}

Response

{
    "code": 1,
    "msg": "success",
    "data": {
        "page": 1,
        "size": 1,
        "total": 1,
        "list": [
            "1P8ibjHnyXsQSxV1dtLBQ2RJkhiNfFiRUM"
        ]
    }
}

删除一个 Bitcoin 订阅地址

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

参数

Request

curl --location https://services.tokenview.io/vipapi/nftmonitor/address/remove/btc/1P8ibjHnyXsQSxV1dtLBQ2RJkhiNfFiRUM?apikey={apikey}

Response

{
    "code": 1,
    "msg": "success",
    "data": null
}

增加 Inscription ID 订阅

GET https://services.tokenview.io/vipapi/nftmonitor/address/add/{公链简称小写}/{Inscription-ID}?apikey={apikey}

参数

Request

curl --location https://services.tokenview.io/vipapi/nftmonitor/address/add/btc/03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1i0?apikey={apikey}

Response

{
    "code": 1,
    "msg": "success",
    "data": null
}

查询已经订阅的 Inscription ID 列表

GET https://services.tokenview.io/vipapi/nftmonitor/address/list/{公链简称小写}?page={页码}&apikey={apikey}

参数

备注:

需指定公链简称小写和页码。

Request

curl --location https://services.tokenview.io/vipapi/nftmonitor/address/list/btc?page=1&apikey={apikey}

Response

{
    "code": 1,
    "msg": "success",
    "data": {
        "page": 1,
        "size": 2,
        "total": 2,
        "list": [
            "03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1i0",
            "fffeb85701d3230af46e86f20c7f498388af4a6a030185d4be29bea118cfbbe4i0"
        ]
    }
}

删除 Inscription ID 订阅

GET https://services.tokenview.io/vipapi/nftmonitor/address/remove/{公链简称小写}/{Collection-TokenID}?apikey={apikey}

参数

Request

curl --location https://services.tokenview.io/vipapi/nftmonitor/address/remove/btc/fffeb85701d3230af46e86f20c7f498388af4a6a030185d4be29bea118cfbbe4i0?apikey={apikey}

Response

{
    "code": 1,
    "msg": "success",
    "data": null
}

查询 webhook 调用历史

GET https://services.tokenview.io/vipapi/nftmonitor/webhookhistory/{公链简称小写}?page={页码}apikey={apikey}

参数

{公链简称小写}:btc
{页码}:页码
{apikey}: 可在Tokenview API 后台管理系统获取激活状态的 APIKEY: https://services.tokenview.ioopen in new window

备注:

  • 需指定公链简称小写和页码。
  • 返回指定公链所有的调用记录,不能指定查询单个地址调用记录。
  • 每页返回固定100条调用记录。

Request

curl --location https://services.tokenview.io/vipapi/nftmonitor/webhookhistory/btc?page=1&apikey={apikey}

Response

{
    "code": 1,
    "msg": "success",
    "data": {
        "page": 1,
        "size": 4,
        "total": 4,
        "list": [
            {
                "coin": "BTC",
                "height": 804861,
                "time": 1693015705000,
                "txid": "03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1",
                "address": "03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1i0",
                "tryTimes": 0,
                "url": "your webhook url",
                "statusCode": 200,
                "request": "{\"address\":\"03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1i0\",\"block\":804861,\"input\":\"ef6fc0136455ee77e36e90e127e9324189cb76341d1ca198ad3145b4cc64dfcb:0\",\"inputAddr\":\"bc1p9zq4yvvnk27cyrxyu704pp4sk26zrfqq0d2jtlhcpyuh65taw29ssdq5t9\",\"inscriptionId\":\"03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1i0\",\"inscriptionInfo\":{\"content\":\"{\\\"p\\\":\\\"brc-20\\\",\\\"op\\\":\\\"mint\\\",\\\"tick\\\":\\\"text\\\",\\\"amt\\\":\\\"1000\\\"}\",\"contentLength\":\"53 bytes\",\"contentLink\":\"/content/03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1i0\",\"contentType\":\"text/plain;charset=utf-8\",\"createdTime\":\"2023-08-26 02:08:25 UTC\",\"genesisHeight\":804861,\"genesisTransaction\":\"03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1\",\"inscriptionId\":\"03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1i0\",\"inscriptionNum\":26478855,\"location\":\"03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1:0:0\",\"output\":\"03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1:0\",\"outputValue\":546,\"ownerAddress\":\"bc1pcks69jup7te4k8h006sxv6v47qyhpkuy9cznj8avlz3yq8ssszxs5r6aem\"},\"isGenesis\":1,\"msgType\":\"token\",\"network\":\"BTC\",\"output\":\"03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1:0\",\"outputAddr\":\"bc1pcks69jup7te4k8h006sxv6v47qyhpkuy9cznj8avlz3yq8ssszxs5r6aem\",\"outputValue\":546,\"satIndex\":0,\"time\":\"1693015705000\",\"txHash\":\"03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1\",\"txType\":\"Mint\"}",
                "response": "OK"
            },
            {
                "coin": "BTC",
                "height": 806459,
                "time": 1693998473000,
                "txid": "fffeb85701d3230af46e86f20c7f498388af4a6a030185d4be29bea118cfbbe4",
                "address": "fffeb85701d3230af46e86f20c7f498388af4a6a030185d4be29bea118cfbbe4i0",
                "tryTimes": 0,
                "url": "your webhook url",
                "statusCode": 200,
                "request": "{\"address\":\"fffeb85701d3230af46e86f20c7f498388af4a6a030185d4be29bea118cfbbe4i0\",\"block\":806459,\"input\":\"e229bf616dcacee9055a320f2afc8cb5b72037c2646e1f27eef43a51617f7109:383\",\"inputAddr\":\"bc1pca730qw2v8k70p84kq4cp43pkxrth526xjjjrgxe28hg6dmea5zqwpps5t\",\"inscriptionId\":\"fffeb85701d3230af46e86f20c7f498388af4a6a030185d4be29bea118cfbbe4i0\",\"inscriptionInfo\":{\"content\":\"{\\\"p\\\":\\\"brc-20\\\",\\\"op\\\":\\\"mint\\\",\\\"tick\\\":\\\"sats\\\",\\\"amt\\\":\\\"99999999\\\"}\",\"contentLength\":\"57 bytes\",\"contentLink\":\"/content/fffeb85701d3230af46e86f20c7f498388af4a6a030185d4be29bea118cfbbe4i0\",\"contentType\":\"text/plain\",\"createdTime\":\"2023-09-06 11:07:53 UTC\",\"genesisHeight\":806459,\"genesisTransaction\":\"fffeb85701d3230af46e86f20c7f498388af4a6a030185d4be29bea118cfbbe4\",\"inscriptionId\":\"fffeb85701d3230af46e86f20c7f498388af4a6a030185d4be29bea118cfbbe4i0\",\"inscriptionNum\":29258991,\"location\":\"fffeb85701d3230af46e86f20c7f498388af4a6a030185d4be29bea118cfbbe4:0:0\",\"output\":\"fffeb85701d3230af46e86f20c7f498388af4a6a030185d4be29bea118cfbbe4:0\",\"outputValue\":294,\"ownerAddress\":\"bc1qzlgrd9pge2tlhh2m2he6cqwsr7uxczrewtml3l\"},\"isGenesis\":1,\"msgType\":\"token\",\"network\":\"BTC\",\"output\":\"fffeb85701d3230af46e86f20c7f498388af4a6a030185d4be29bea118cfbbe4:0\",\"outputAddr\":\"bc1qzlgrd9pge2tlhh2m2he6cqwsr7uxczrewtml3l\",\"outputValue\":294,\"satIndex\":0,\"time\":\"1693998473000\",\"txHash\":\"fffeb85701d3230af46e86f20c7f498388af4a6a030185d4be29bea118cfbbe4\",\"txType\":\"Mint\"}",
                "response": "OK"
            },
            {
                "coin": "BTC",
                "height": 804861,
                "time": 1693015705000,
                "txid": "03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1",
                "address": "03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1i0",
                "tryTimes": 0,
                "url": "your webhook url",
                "statusCode": 200,
                "request": "{\"address\":\"03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1i0\",\"block\":804861,\"input\":\"ef6fc0136455ee77e36e90e127e9324189cb76341d1ca198ad3145b4cc64dfcb:0\",\"inputAddr\":\"bc1p9zq4yvvnk27cyrxyu704pp4sk26zrfqq0d2jtlhcpyuh65taw29ssdq5t9\",\"inscriptionId\":\"03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1i0\",\"inscriptionInfo\":{\"content\":\"{\\\"p\\\":\\\"brc-20\\\",\\\"op\\\":\\\"mint\\\",\\\"tick\\\":\\\"text\\\",\\\"amt\\\":\\\"1000\\\"}\",\"contentLength\":\"53 bytes\",\"contentLink\":\"/content/03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1i0\",\"contentType\":\"text/plain;charset=utf-8\",\"createdTime\":\"2023-08-26 02:08:25 UTC\",\"genesisHeight\":804861,\"genesisTransaction\":\"03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1\",\"inscriptionId\":\"03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1i0\",\"inscriptionNum\":26478855,\"location\":\"03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1:0:0\",\"output\":\"03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1:0\",\"outputValue\":546,\"ownerAddress\":\"bc1pcks69jup7te4k8h006sxv6v47qyhpkuy9cznj8avlz3yq8ssszxs5r6aem\"},\"isGenesis\":1,\"msgType\":\"token\",\"network\":\"BTC\",\"output\":\"03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1:0\",\"outputAddr\":\"bc1pcks69jup7te4k8h006sxv6v47qyhpkuy9cznj8avlz3yq8ssszxs5r6aem\",\"outputValue\":546,\"satIndex\":0,\"time\":\"1693015705000\",\"txHash\":\"03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1\",\"txType\":\"Mint\"}",
                "response": "OK"
            },
            {
                "coin": "BTC",
                "height": 804861,
                "time": 1693015705000,
                "txid": "03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1",
                "address": "03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1i0",
                "tryTimes": 0,
                "url": "your webhook url",
                "statusCode": 200,
                "request": "{\"address\":\"03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1i0\",\"block\":804861,\"input\":\"ef6fc0136455ee77e36e90e127e9324189cb76341d1ca198ad3145b4cc64dfcb:0\",\"inputAddr\":\"bc1p9zq4yvvnk27cyrxyu704pp4sk26zrfqq0d2jtlhcpyuh65taw29ssdq5t9\",\"inscriptionId\":\"03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1i0\",\"inscriptionInfo\":{\"content\":\"{\\\"p\\\":\\\"brc-20\\\",\\\"op\\\":\\\"mint\\\",\\\"tick\\\":\\\"text\\\",\\\"amt\\\":\\\"1000\\\"}\",\"contentLength\":\"53 bytes\",\"contentLink\":\"/content/03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1i0\",\"contentType\":\"text/plain;charset=utf-8\",\"createdTime\":\"2023-08-26 02:08:25 UTC\",\"genesisHeight\":804861,\"genesisTransaction\":\"03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1\",\"inscriptionId\":\"03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1i0\",\"inscriptionNum\":26478855,\"location\":\"03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1:0:0\",\"output\":\"03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1:0\",\"outputValue\":546,\"ownerAddress\":\"bc1pcks69jup7te4k8h006sxv6v47qyhpkuy9cznj8avlz3yq8ssszxs5r6aem\"},\"isGenesis\":1,\"msgType\":\"token\",\"network\":\"BTC\",\"output\":\"03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1:0\",\"outputAddr\":\"bc1pcks69jup7te4k8h006sxv6v47qyhpkuy9cznj8avlz3yq8ssszxs5r6aem\",\"outputValue\":546,\"satIndex\":0,\"time\":\"1693015705000\",\"txHash\":\"03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1\",\"txType\":\"Mint\"}",
                "response": "OK"
            }
        ]
    }
}

应答字段说明

{
    "coin": "BTC",
    "height": 804861, // 块高
    "time": 1693015705000, // 时间
    "txid": "03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1",
    "address": "03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1i0", // 监控对象
    "tryTimes": 0,
    "url": "your webhook url",
    "statusCode": 200, // 状态码
    "request": "{\"address\":\"03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1i0\",\"block\":804861,\"input\":\"ef6fc0136455ee77e36e90e127e9324189cb76341d1ca198ad3145b4cc64dfcb:0\",\"inputAddr\":\"bc1p9zq4yvvnk27cyrxyu704pp4sk26zrfqq0d2jtlhcpyuh65taw29ssdq5t9\",\"inscriptionId\":\"03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1i0\",\"inscriptionInfo\":{\"content\":\"{\\\"p\\\":\\\"brc-20\\\",\\\"op\\\":\\\"mint\\\",\\\"tick\\\":\\\"text\\\",\\\"amt\\\":\\\"1000\\\"}\",\"contentLength\":\"53 bytes\",\"contentLink\":\"/content/03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1i0\",\"contentType\":\"text/plain;charset=utf-8\",\"createdTime\":\"2023-08-26 02:08:25 UTC\",\"genesisHeight\":804861,\"genesisTransaction\":\"03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1\",\"inscriptionId\":\"03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1i0\",\"inscriptionNum\":26478855,\"location\":\"03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1:0:0\",\"output\":\"03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1:0\",\"outputValue\":546,\"ownerAddress\":\"bc1pcks69jup7te4k8h006sxv6v47qyhpkuy9cznj8avlz3yq8ssszxs5r6aem\"},\"isGenesis\":1,\"msgType\":\"token\",\"network\":\"BTC\",\"output\":\"03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1:0\",\"outputAddr\":\"bc1pcks69jup7te4k8h006sxv6v47qyhpkuy9cznj8avlz3yq8ssszxs5r6aem\",\"outputValue\":546,\"satIndex\":0,\"time\":\"1693015705000\",\"txHash\":\"03770a3edd7a899390aefdfd7eab69c20034c4f5619896ccef64732f33b54ce1\",\"txType\":\"Mint\"}", //发给监控对象的内容
    "response": "OK"
}

上次编辑于: