交易和塊數據:區塊鏈數據API

單塊

  • https://blockchain.info/rawblock/$block_hash
  • 您還可以使用?format = hex請求該塊以二進制形式(十六進制編碼)返回
{
    "hash":"0000000000000bae09a7a393a8acded75aa67e46cb81f7acaa5ad94f9eacd103",
    "ver":1,
    "prev_block":"00000000000007d0f98d9edca880a6c124e25095712df8952e0439ac7409738a",
    "mrkl_root":"935aa0ed2e29a4b81e0c995c39e06995ecce7ddbebb26ed32d550a72e8200bf5",
    "time":1322131230,
    "bits":437129626,
    "nonce":2964215930,
    "n_tx":22,
    "size":9195,
    "block_index":818044,
    "main_chain":true,
    "height":154595,
    "received_time":1322131301,
    "relayed_by":"108.60.208.156",
    "tx":[--Array of Transactions--]
{

單筆交易

  • https://blockchain.info/rawtx/$tx_hash
  • 您還可以使用?format = hex請求事務以二進制形式(十六進制編碼)返回
{
    "hash":"b6f6991d03df0e2e04dafffcd6bc418aac66049e2cd74b80f14ac86db1e3f0da",
    "ver":1,
    "vin_sz":1,
    "vout_sz":2,
    "lock_time":"Unavailable",
    "size":258,
    "relayed_by":"64.179.201.80",
    "block_height, 12200,
    "tx_index":"12563028",
    "inputs":[


            {
                "prev_out":{
                    "hash":"a3e2bcc9a5f776112497a32b05f4b9e5b2405ed9",
                    "value":"100000000",
                    "tx_index":"12554260",
                    "n":"2"
                },
                "script":"76a914641ad5051edd97029a003fe9efb29359fcee409d88ac"
            }

        ],
    "out":[

                {
                    "value":"98000000",
                    "hash":"29d6a3540acfa0a950bef2bfdc75cd51c24390fd",
                    "script":"76a914641ad5051edd97029a003fe9efb29359fcee409d88ac"
                },

                {
                    "value":"2000000",
                    "hash":"17b5038a413f5c5ee288caa64cfab35a0c01914e",
                    "script":"76a914641ad5051edd97029a003fe9efb29359fcee409d88ac"
                }

        ]
}

圖表數據

  • https://blockchain.info/charts/$chart-type?format=json
{
    "values" : [
        {
            "x" : 1290602498, //Unix timestamp
            "y" : 1309696.2116000003
        }]
}

塊高

  • https://blockchain.info/block-height/$block_height?format=json
{
    "blocks" :
    [
        --Array Of Blocks at the specified height--
    ]
}
Single A

單一地址

  • https://blockchain.info/rawaddr/$bitcoin_address
  • 地址可以是base58或has​​h160
  • 可選的limit參數以顯示n個事務,例如&limit = 50(默認值:50,最大值:50)
  • 可選的offset參數,用於跳過前n個交易,例如&offset = 100(限制爲50的第2頁)
{
    "hash160":"660d4ef3a743e3e696ad990364e555c271ad504b",
    "address":"1AJbsFZ64EpEfS5UAjAfcUG8pH8Jn3rn1F",
    "n_tx":17,
    "n_unredeemed":2,
    "total_received":1031350000,
    "total_sent":931250000,
    "final_balance":100100000,
    "txs":[--Array of Transactions--]
}

多地址

  • https://blockchain.info/multiaddr?active=addressaddress|address
  • 多個地址除以 |
  • 地址可以是base58或xpub
  • 可選的limit參數以顯示n個事務,例如&n = 50(默認值:50,最大值:100)
  • 可選的offset參數,用於跳過前n個交易,例如&offset = 100(限制爲50的第2頁)
{
    "addresses":[

    {
        "hash160":"641ad5051edd97029a003fe9efb29359fcee409d",
        "address":"1A8JiWcwvpY7tAopUkSnGuEYHmzGYfZPiq",
        "n_tx":4,
        "total_received":1401000000,
        "total_sent":1000000,
        "final_balance":1400000000
    },

    {
        "hash160":"ddbeb8b1a5d54975ee5779cf64573081a89710e5",
        "address":"1MDUoxL1bGvMxhuoDYx6i11ePytECAk9QK",
        "n_tx":0,
        "total_received":0,
        "total_sent":0,
        "final_balance":0
    },

    "txs":[--Latest 50 Transactions--]

未花費的產出

  • https://blockchain.info/unspent?active=$address
  • 允許多個地址,以“ |”分隔
  • 地址可以是base58或xpub
  • 可選的limit參數以顯示n個事務,例如&limit = 50(默認值:250,最大值:1000)
  • 可選的確認參數,用於限制最小確認,例如&confirmations = 6 tx哈希是反向字節順序。這意味着爲了從JSON

tx哈希中獲取以下交易的html交易哈希,您需要對十六進制進行解碼(例如,使用此站點)。這將產生一個二進制輸出,您需要將其反轉(最後8位/1字節移到最前面,第二到最後8位/ 1字節移到第二位,依此類推)。然後,一旦對反轉的字節進行解碼,您將獲得html事務哈希。

{
    "unspent_outputs":[
        {
            "tx_age":"1322659106",
            "tx_hash":"e6452a2cb71aa864aaa959e647e7a4726a22e640560f199f79b56b5502114c37",
            "tx_index":"12790219",
            "tx_output_n":"0",
            "script":"76a914641ad5051edd97029a003fe9efb29359fcee409d88ac", (Hex encoded)
            "value":"5000661330"
        }
    ]
}

平衡

  • https://blockchain.info/balance?active=$address
  • 允許多個地址,以“ |”分隔
  • 地址可以是base58或xpub

列出列出的每個地址的餘額摘要。

{
    "1MDUoxL1bGvMxhuoDYx6i11ePytECAk9QK": {
        "final_balance": 0,
        "n_tx": 0,
        "total_received": 0
    },
    "15EW3AMRm2yP6LEF5YKKLYwvphy3DmMqN6": {
        "final_balance": 0,
        "n_tx": 2,
        "total_received": 310630609
    }
}

最新塊

  • https://blockchain.info/latestblock
{
    "hash":"0000000000000538200a48202ca6340e983646ca088c7618ae82d68e0c76ef5a",
    "time":1325794737,
    "block_index":841841,
    "height":160778,
    "txIndexes":[13950369,13950510,13951472]
 }

未確認交易

  • https://blockchain.info/unconfirmed-transactions?format=json
{
    "txs":[--Array of Transactions--]
}

積木

  • 一天封禁:https://blockchain.info/blocks/$time_in_milliseconds?format =
    json
  • 特定池的塊:https://blockchain.info/blocks/$pool_name?format=json
{
    "blocks" : [
    {
        "height" : 166107,
        "hash" : "00000000000003823fa3667d833a354a437bdecf725f1358b17f949c991bfe0a",
        "time" : 1328830483
    },
    {
        "height" : 166104,
        "hash" : "00000000000008a34f292bfe3098b6eb40d9fd40db65d29dc0ee6fe5fa7d7995",
        "time" : 1328828041
    }]
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章