Block API

Block API
Resource Description
GET /api/v1/rawblock Get a certain block by its block hash value

URL http://block.okcoin.cn/api/v1/rawblock.do

Example

# Request
GET http://block.okcoin.cn/api/v1/rawblock.do?block_hash=00000000000000000000000000000000000000000014d5e42e2d9765f8e10084&symbol=BTC
# Response
{
    "bits": 403088579,
    "chainwork": "00000000000000000000000000000000000000000014d5e42e2d9765f8e10084",
    "createTime": 1459163486260,
    "difficulty": 165496835118.22635,
    "fee": 0,
    "hash": "0000000000000000038e2c39bea3b5364f9149db1f418bad4bd8dd70167f9aa6",
    "height": 404643,
    "merkleroot": "55a63d2e93e9f04ef4431aa660f9bbfc579376bbee6af9a045a175e4ef1d6ad5",
    "nextblockhash": "000000000000000000f71b3f2c6530b7c6601f0a3a9cb46b21d2f360701c5d4d",
    "nonce": 3823084887,
    "orphaned": false,
    "previousblockhash": "000000000000000000298d30117d6182580f20a4d0d574533db4e1dc22bed996",
    "received_time": 0,
    "relayed_by": "AntMiner",
    "size": 933692,
    "tempTranNum": 0,
    "time": 1459160216000,
    "totalIn": 1550666528207,
    "totalOut": 1553166528207,
    "tranNum": 1916,
    "tx": [],
    "txcount": 0,
    "txid": [--Array of Transactions--],
    "version": 4
}

Request Parameters

Parameter Name Description

block_hash

block's hash

symbol

btc/ltc

GET /api/v1/rawtx Get a certain transaction by its hash value

URL http://block.okcoin.cn/api/v1/rawtx.do

Example

# Request
GET http://block.okcoin.cn/api/v1/rawtx.do?tx_hash=0139aa6a07c197652e1e5c5cb661afadfb8c8a3ca6de9f22150ea1c85eeabbaa&symbol=BTC
# Response
{
    "blockhash": "00000000000000001a6d32b70d7b80f813d12279fa6df111514ccdd1d16ea608",
    "blocktime": 1419637806000,
    "confirmations": 68535,
    "locktime": 0,
    "size": 102,
    "time": 1419637806000,
    "txid": "0139aa6a07c197652e1e5c5cb661afadfb8c8a3ca6de9f22150ea1c85eeabbaa",
    "version": 1,
    "vin": [
        {
            "coinbase": "03c420050cd5320ecebbc65044df3b0dea",
            "sequence": 4294967295,
            "txid": "0000000000000000000000000000000000000000000000000000000000000000",
            "value": 0,
            "vout": -1
        }
    ],
    "vout": [
        {
            "n": 0,
            "scriptPubKey": {
                "addresses": [
                    "19KFrbohfEbtCTDYCqkuuSNh87NxzyRAsm"
                ],
                "asm": "OP_DUP OP_HASH160 5b34e4e0ee24e4998179611e8c795aaec95c9957 OP_EQUALVERIFY OP_CHECKSIG",
                "hex": "76a9145b34e4e0ee24e4998179611e8c795aaec95c995788ac",
                "reqSigs": 0
            },
            "spent": true,
            "value": 2500632168
        }
    ]
}

Request Parameters

Parameter Name Description

tx_hash

transaction's hash

symbol

btc/ltc

GET /api/v1/address Get certain transactions by address

URL http://block.okcoin.cn/api/v1/address.do

Example

# Request
GET http://block.okcoin.cn/api/v1/address.do?address=1FeDtFhARLxjKUPPkQqEBL78tisenc9znS&symbol=BTC
# Response
[
    {
        "blockhash": "00000000000080b66c911bd5ba14a74260057311eaeb1982802f7010f1a9f090",
        "blockheight": 100001,
        "blocktime": 0,
        "coinbase": false,
        "confirmations": 304602,
        "createTime": 1459134634693,
        "dbVersion": 0,
        "in": 0,
        "locktime": 0,
        "out": 0,
        "received_time": 0,
        "relayed_by": "0.0.0.0",
        "size": 257,
        "status": 1,
        "time": 0,
        "totalIn": 13831000000,
        "totalOut": 13831000000,
        "txid": "05d07bb2de2bda1115409f99bf6b626d23ecb6bed810d8be263352988e4548cb",
        "version": 1,
        "vin": [
            {
                "prev_out": {
                    "n": 1,
                    "scriptPubKey": {
                        "addresses": [
                            "1KXkhm335oR51GfQ8zRtn5EaDZpXtym9wW"
                        ],
                        "asm": "OP_DUP OP_HASH160 cb4339639d59a2682838e51f7ab5ad17dad64f2a OP_EQUALVERIFY OP_CHECKSIG",
                        "hex": "76a914cb4339639d59a2682838e51f7ab5ad17dad64f2a88ac",
                        "reqSigs": 0
                    },
                    "spent": false,
                    "value": 13831000000
                },
                "scriptSig": {
                    "asm": " 3044022042734b25f54845d662e6499b75ff8529ff47f42fd224498a9f752d212326dbfa0220523e4b7b570bbb1f3af02baa2c04ea8eb7b0fccb1522cced130b666ae9a9d01401 04b5a23b922949877e9eaf7512897ed091958e2e8cf05b0d0eb9064e7976043fde6023b4e2c188b7e38ef94eec6845dc4933f5e8635f1f6a3702290956aa9e284b",
                    "hex": "473044022042734b25f54845d662e6499b75ff8529ff47f42fd224498a9f752d212326dbfa0220523e4b7b570bbb1f3af02baa2c04ea8eb7b0fccb1522cced130b666ae9a9d014014104b5a23b922949877e9eaf7512897ed091958e2e8cf05b0d0eb9064e7976043fde6023b4e2c188b7e38ef94eec6845dc4933f5e8635f1f6a3702290956aa9e284b"
                },
                "sequence": 4294967295,
                "txid": "80c6f121c3e9fe0a59177e49874d8c703cbadee0700a782e4002e87d862373c6",
                "value": 13831000000,
                "vout": 1
            }
        ],
        "vout": [
            {
                "n": 0,
                "scriptPubKey": {
                    "addresses": [
                        "161GTYJhuvdLQoTM4KRsqKovZdHLkapUu4"
                    ],
                    "asm": "OP_DUP OP_HASH160 36e5884215f7d3044be5d37bdd8c987d9d942c84 OP_EQUALVERIFY OP_CHECKSIG",
                    "hex": "76a91436e5884215f7d3044be5d37bdd8c987d9d942c8488ac",
                    "reqSigs": 0
                },
                "spent": true,
                "value": 13826000000
            },
            {
                "n": 1,
                "scriptPubKey": {
                    "addresses": [
                        "19kmtcoDHC25WkXrBBLFAjsFGVKgM1SHtp"
                    ],
                    "asm": "OP_DUP OP_HASH160 60085d6838f8a44a21a0de56ff963cfa6242a961 OP_EQUALVERIFY OP_CHECKSIG",
                    "hex": "76a91460085d6838f8a44a21a0de56ff963cfa6242a96188ac",
                    "reqSigs": 0
                },
                "spent": false,
                "value": 5000000
            }
        ]
    }
]

Request Parameters

Parameter Name Description

address

address

symbol

btc/ltc

reversal

0/1

size

transaction number. default:10

GET /api/v1/block_height Get a certain block by its height

URL http://block.okcoin.cn/api/v1/block_height.do

Example

# Request
GET http://block.okcoin.cn/api/v1/block_height.do?block_height=400000&symbol=BTC
# Response
{
    "bits": 403088579,
    "chainwork": "00000000000000000000000000000000000000000014d5e42e2d9765f8e10084",
    "createTime": 1459163486260,
    "difficulty": 165496835118.22635,
    "fee": 0,
    "hash": "0000000000000000038e2c39bea3b5364f9149db1f418bad4bd8dd70167f9aa6",
    "height": 404643,
    "merkleroot": "55a63d2e93e9f04ef4431aa660f9bbfc579376bbee6af9a045a175e4ef1d6ad5",
    "nextblockhash": "000000000000000000f71b3f2c6530b7c6601f0a3a9cb46b21d2f360701c5d4d",
    "nonce": 3823084887,
    "orphaned": false,
    "previousblockhash": "000000000000000000298d30117d6182580f20a4d0d574533db4e1dc22bed996",
    "received_time": 0,
    "relayed_by": "AntMiner",
    "size": 933692,
    "tempTranNum": 0,
    "time": 1459160216000,
    "totalIn": 1550666528207,
    "totalOut": 1553166528207,
    "tranNum": 1916,
    "tx": [],
    "txcount": 0,
    "txid": [--Array of Transactions--],
    "version": 4
}

Request Parameters

Parameter Name Description

block_height

block's height

symbol

btc/ltc

GET /api/v1/latest_block Get the latest block

URL http://block.okcoin.cn/api/v1/latest_block.do

Example

# Request
GET http://block.okcoin.cn/api/v1/latest_block.do?symbol=BTC
# Response
{
    "bits": 403088579,
    "chainwork": "00000000000000000000000000000000000000000014d5e42e2d9765f8e10084",
    "createTime": 1459163486260,
    "difficulty": 165496835118.22635,
    "fee": 0,
    "hash": "0000000000000000038e2c39bea3b5364f9149db1f418bad4bd8dd70167f9aa6",
    "height": 404643,
    "merkleroot": "55a63d2e93e9f04ef4431aa660f9bbfc579376bbee6af9a045a175e4ef1d6ad5",
    "nextblockhash": "000000000000000000f71b3f2c6530b7c6601f0a3a9cb46b21d2f360701c5d4d",
    "nonce": 3823084887,
    "orphaned": false,
    "previousblockhash": "000000000000000000298d30117d6182580f20a4d0d574533db4e1dc22bed996",
    "received_time": 0,
    "relayed_by": "AntMiner",
    "size": 933692,
    "tempTranNum": 0,
    "time": 1459160216000,
    "totalIn": 1550666528207,
    "totalOut": 1553166528207,
    "tranNum": 1916,
    "tx": [],
    "txcount": 0,
    "txid": [--Array of Transactions--],
    "version": 4
}

Request Parameters

Parameter Name Description

symbol

btc/ltc

GET /api/v1/charts/:type Bitcoin Charts

URL http://block.okcoin.cn/api/v1/charts/:type.do

Example

# Request
GET http://block.okcoin.cn/api/v1/charts/total-bitcoins.do
# Response
[
    [1427134505000, 13971975],
    [1427220905000, 13976150]
]
GET /api/v1/:symbol/statsdata Currency Stats

URL http://block.okcoin.cn/api/v1/:symbol/statsdata.do

Example

# Request
GET http://block.okcoin.cn/api/v1/btc/statsdata.do
# Response
{
    "blocks_size": 99811880,
    "difficulty": 165496835118.22635,
    "estimated_btc_sent": 35926197601874,
    "estimated_transaction_volume_usd": 148978756.2154511,
    "hash_rate": 1266941413.672918,
    "market_price_usd": 414.68,
    "miners_revenue_btc": 3886,
    "miners_revenue_usd": 1611446.48,
    "minutes_between_blocks": 9.35064935064935,
    "n_blocks_mined": 154,
    "n_blocks_total": 404198,
    "n_btc_mined": 385000000000,
    "n_tx": 185457,
    "timestamp": 1458896579825,
    "total_btc_sent": 227538681817306,
    "total_fees_btc": 3648617673,
    "trade_volume_btc": 2958.43067025,
    "trade_volume_usd": 1226802.03033927
}

Returned Value Description

blocks_size: Blockchain Size
difficulty: Difficulty
estimated_btc_sent: Estimated Transaction Volume
estimated_transaction_volume_usd: Estimated Transaction Volume (USD)
hash_rate: Hash Rate(GH/s)
market_price_usd: Market Price in USD
miners_revenue_btc: Total Miners Revenue
miners_revenue_usd: Total Miners Revenue(USD)
minutes_between_blocks: Time Between Blocks(minutes)
n_blocks_mined: Blocks Mined
n_blocks_total: Total Blocks
n_btc_mined: Bitcoins Mined
n_tx: No. of Transactions
timestamp: Statistics Updated Timestamp
total_btc_sent: Total Output Volume
total_fees_btc: Total Transaction Fees
trade_volume_btc: Trade Volume
trade_volume_usd: Trade Volume(USD)
GET /api/v1/:symbol/top Bitcoin Address Balance Ranking

URL http://block.okcoin.cn/api/v1/:symbol/top.do

Example

# Request
GET http://block.okcoin.cn/api/v1/ltc/top.do
# Response
{
	"bl_month":"-1.80",
	"bl_today":"2992376.44820333",
	"bl_week":"-2.19",
    "max_balance": [
        {
            "address": "3KBUuGko4H5ke7EVsq9B7PLK1c5Askdd7y",
            "balance": "3888842.76128375",
            "last_tx": {
                "hash": "7a2910783669a02849fea77c2f8d6491518c385be95e412e6401b88b6c5eb0e5",
                "time_utc": "2016-03-03 22:19:04"
            }
        },
        {
            "address": "LgY8ahfHRhvjVQC1zJnBhFMG5pCTMuKRqh",
            "balance": "3500001.01648772",
            "last_tx": {
                "hash": "178915e595cae28ef44ed0e77fecf88876aa40e297a2c9c6f46c617afa6b64ab",
                "time_utc": "2016-03-14 19:02:53"
            }
        }
    ]
}
GET /api/v1/:symbol/popular_addr Most Popular Addresses

URL http://block.okcoin.cn/api/v1/:symbol/popular_addr.do

Example

# Request
GET http://block.okcoin.cn/api/v1/btc/popular_addr.do
# Response
{
    "max_txs": [
        {
            "address": "LajyQBeZaBA1NkZDeY8YT5RYYVRkXMvb2T",
            "tx_nb": "146632"
        },
        {
            "address": "Lchanger9aqdHS5KKFz322FVH74LnzkoYJ",
            "tx_nb": "126905"
        }
    ]
}
GET /api/v1/:symbol/unconfirmed_txs Unconfirmed Transactions

URL http://block.okcoin.cn/api/v1/:symbol/unconfirmed_txs.do

Example

# Request
GET http://block.okcoin.cn/api/v1/btc/unconfirmed_txs.do
# Response
[
    {
        "blockheight": 0,
        "blocktime": 0,
        "coinbase": false,
        "confirmations": 0,
        "createTime": 1459138871320,
        "dbVersion": 0,
        "in": 0,
        "locktime": 0,
        "out": 0,
        "received_time": 1459110066000,
        "relayed_by": "162.222.23.73",
        "size": 189,
        "status": 0,
        "time": 0,
        "totalIn": 2000000,
        "totalOut": 1900000,
        "txid": "2fadf8b48602919b64260987663adf7de7502d0483b30fade47a3a51f34f38b7",
        "version": 1,
        "vin": [
            {
                "prev_out": {
                    "n": 0,
                    "scriptPubKey": {
                        "addresses": [
                            "Lf84YEPg94J1hptjK582s3ESUCr8mJmf37"
                        ],
                        "asm": "OP_DUP OP_HASH160 da45424dcaf1bc18753ed64cb2d3e702a5b00c5a OP_EQUALVERIFY OP_CHECKSIG",
                        "hex": "76a914da45424dcaf1bc18753ed64cb2d3e702a5b00c5a88ac",
                        "reqSigs": 0
                    },
                    "spent": false,
                    "value": 2000000
                },
                "scriptSig": {
                    "asm": " 304402203f6822ac0730968f45864cbf6d7ad41b562e2844f5201743957be9f26393dbab0220223f5d4aca3671e26a33b9bdcbfa70a3df90cf08d20df59cfdbfc4e2af614ece01 03c6931c872c68aa3166b066acde8f4194d77eae4ac268941a7442bdbff2e355c7",
                    "hex": "47304402203f6822ac0730968f45864cbf6d7ad41b562e2844f5201743957be9f26393dbab0220223f5d4aca3671e26a33b9bdcbfa70a3df90cf08d20df59cfdbfc4e2af614ece012103c6931c872c68aa3166b066acde8f4194d77eae4ac268941a7442bdbff2e355c7"
                },
                "sequence": 4294967295,
                "txid": "ae2773037d691a6921b48690415d4c662d2498312c392d3cf612f915dafb4417",
                "value": 2000000,
                "vout": 0
            }
        ],
        "vout": [
            {
                "n": 0,
                "scriptPubKey": {
                    "addresses": [
                        "3F85UcZcccd8dpMZqCmfahLXg9Jq2WjFBo"
                    ],
                    "asm": "OP_HASH160 93570004de29114ef088c9afc408edc568bc288f OP_EQUAL",
                    "hex": "a91493570004de29114ef088c9afc408edc568bc288f87",
                    "reqSigs": 0
                },
                "spent": false,
                "value": 1900000
            }
        ]
    }
]
GET /api/v1/:symbol/largest_recent_txs Largest Transactions

URL http://block.okcoin.cn/api/v1/:symbol/largest_recent_txs.do

Example

# Request
GET http://block.okcoin.cn/api/v1/btc/largest_recent_txs.do
# Response
[
    {
        "blockhash": "00000000000000000407f0dedea32ba6a0acb987fba6d20d8fd9637aa09e2159",
        "blockheight": 404485,
        "blocktime": 0,
        "coinbase": false,
        "confirmations": 127,
        "createTime": 1459139037013,
        "dbVersion": 0,
        "in": 0,
        "locktime": 404465,
        "out": 0,
        "received_time": 1459034575000,
        "relayed_by": "192.241.240.179",
        "size": 498,
        "status": 1,
        "time": 0,
        "totalIn": 9948999992773,
        "totalOut": 9948999905208,
        "txid": "afe5c15fde71d571f5ca00c36e90457ab2c57b9ea40c34a69f48d6e1fc9a0194",
        "version": 1,
        "vin": [
            {
                "prev_out": {
                    "n": 0,
                    "scriptPubKey": {
                        "addresses": [
                            "1JE7vGcseTX6PuAQuyEii82UCNYVrkUwq5"
                        ],
                        "asm": "OP_DUP OP_HASH160 bcf55230224766b666c0fc94690be4e704f8173e OP_EQUALVERIFY OP_CHECKSIG",
                        "hex": "76a914bcf55230224766b666c0fc94690be4e704f8173e88ac",
                        "reqSigs": 0
                    },
                    "spent": false,
                    "value": 5049000000000
                },
                "scriptSig": {
                    "asm": " 30440220455299824768f29bd07b96de0327bbbb5ee302f7231bc983a0cdafa14bb536a902200ca6c3a110a4a1bc23340daba9192f5969ba5144e7572e273e8c486e5af2887b01 02cae7935e430dd79c74a0d9cae54920b815742b89f0592da2fee99da71d6be366",
                    "hex": "4730440220455299824768f29bd07b96de0327bbbb5ee302f7231bc983a0cdafa14bb536a902200ca6c3a110a4a1bc23340daba9192f5969ba5144e7572e273e8c486e5af2887b012102cae7935e430dd79c74a0d9cae54920b815742b89f0592da2fee99da71d6be366"
                },
                "sequence": 4294967294,
                "txid": "7e03b97481d09e22c89c6ad35b46f605b1df2c36d2fe7434ba561ee3bbbe3479",
                "value": 5049000000000,
                "vout": 0
            },
            {
                "prev_out": {
                    "n": 1,
                    "scriptPubKey": {
                        "addresses": [
                            "1KdJF4g8gXAM63Mif5z9tRnN6G8PkaG9CX"
                        ],
                        "asm": "OP_DUP OP_HASH160 cc4fa1cc410aae6653283df136b23ae91c984432 OP_EQUALVERIFY OP_CHECKSIG",
                        "hex": "76a914cc4fa1cc410aae6653283df136b23ae91c98443288ac",
                        "reqSigs": 0
                    },
                    "spent": false,
                    "value": 4899999992773
                },
                "scriptSig": {
                    "asm": " 304402207a3352a833de8f385094eef8239174abffd4d9bc18bdc8d2ee62d6f83e40ba9c02200ec32250bef79c634f9dec55472d4c2a075dbce8c6ec1505541791ccfb7345b401 02b195a63ba06e049f96be28b9bc5d1de3f3ba5c1e48d82f92f7852dd4eb184731",
                    "hex": "47304402207a3352a833de8f385094eef8239174abffd4d9bc18bdc8d2ee62d6f83e40ba9c02200ec32250bef79c634f9dec55472d4c2a075dbce8c6ec1505541791ccfb7345b4012102b195a63ba06e049f96be28b9bc5d1de3f3ba5c1e48d82f92f7852dd4eb184731"
                },
                "sequence": 4294967294,
                "txid": "83ed6898d4c1b9a0bb0497f9742321d4a469f5dd09bd1974d0d8259b2453025c",
                "value": 4899999992773,
                "vout": 1
            }
        ],
        "vout": [
            {
                "n": 0,
                "scriptPubKey": {
                    "addresses": [
                        "1LES6Qsx2DkpC4cU7wuxDw9wQdLFPwwYMt"
                    ],
                    "asm": "OP_DUP OP_HASH160 d2f4be85f0d863ea8506fd39f72a85bcd672b390 OP_EQUALVERIFY OP_CHECKSIG",
                    "hex": "76a914d2f4be85f0d863ea8506fd39f72a85bcd672b39088ac",
                    "reqSigs": 0
                },
                "spent": false,
                "value": 448999905208
            },
            {
                "n": 1,
                "scriptPubKey": {
                    "addresses": [
                        "3CPgFPZvA1kCbYStDoMyHQgdvFeMw63LCG"
                    ],
                    "asm": "OP_HASH160 7561e36b1933815adc1829d0763b6be7cefe6c30 OP_EQUAL",
                    "hex": "a9147561e36b1933815adc1829d0763b6be7cefe6c3087",
                    "reqSigs": 0
                },
                "spent": false,
                "value": 2000000000000
            },
            {
                "n": 2,
                "scriptPubKey": {
                    "addresses": [
                        "34SkbknSLtsScbkGxkHcxqA3JqAt1s1161"
                    ],
                    "asm": "OP_HASH160 1e35c319c77f282dba1f4e9073ecbd3e338e287c OP_EQUAL",
                    "hex": "a9141e35c319c77f282dba1f4e9073ecbd3e338e287c87",
                    "reqSigs": 0
                },
                "spent": false,
                "value": 2000000000000
            },
            {
                "n": 3,
                "scriptPubKey": {
                    "addresses": [
                        "3DuGe9Nh3VVpj7fynDq1nbk3zPxSL1f1oy"
                    ],
                    "asm": "OP_HASH160 85f2c94b16000df69accb9d256e06ad5cae9fc6c OP_EQUAL",
                    "hex": "a91485f2c94b16000df69accb9d256e06ad5cae9fc6c87",
                    "reqSigs": 0
                },
                "spent": false,
                "value": 2000000000000
            },
            {
                "n": 4,
                "scriptPubKey": {
                    "addresses": [
                        "3NtiEzfazexMkKtva9ZZtR9wGzU4W4ALwM"
                    ],
                    "asm": "OP_HASH160 e890df776350270c84a52ddc427c721dab5302f2 OP_EQUAL",
                    "hex": "a914e890df776350270c84a52ddc427c721dab5302f287",
                    "reqSigs": 0
                },
                "spent": false,
                "value": 2000000000000
            },
            {
                "n": 5,
                "scriptPubKey": {
                    "addresses": [
                        "32JbSmtS17QgvfW58oMWWB44YLBo7abGPd"
                    ],
                    "asm": "OP_HASH160 06ba8a6ff74ceebb9a37fbaa030f8cb161419fe2 OP_EQUAL",
                    "hex": "a91406ba8a6ff74ceebb9a37fbaa030f8cb161419fe287",
                    "reqSigs": 0
                },
                "spent": false,
                "value": 1500000000000
            }
        ]
    }
]
提示

请先登录

客服400-888-6636
在线咨询 在线咨询
在线留言 发起提问
聊天室
OKCoin聊天室
请遵守聊天室规则!详情>>
客服400-888-6636
聊天室规则 X