Skip to content

Explorer Module

Ben edited this page Apr 12, 2017 · 19 revisions

Explorer module

API endpoints

Block

  • GET blocks
  • GET blocks/[:block_hash]
  • GET blocks/[:block_height]

Transaction

  • GET transactions/[:tx_hash]
  • GET transactions/color/[:color_id]
  • GET transactions/address/[:address]

Address

  • GET addresses/[:address]/balance
  • GET addresses/[:address]/utxos
  • GET addresses/[:address]/op_return

Block APIs

GET blocks/

Description

Get latest 50 blocks.

Parameter

Field Type Description
starting_after String the transaction hash starting after, optional parameter
since Integer the since timestamp, optinal parameter
until Integer the until timestamp, optinal parameter
page_size Integer the page size (default 50), optinal parameter

Sample Response

{
    "blocks": [
        {
            "hash": "0000075f2770822d4449ed1b713b979d63092cf19a34873f0a1977ec0e369c0b",
            "height": "363",
            "previous_block_hash": "00000b5f7c9faf0e84e6af52663c947a81be1f6c7a635b81de4bf8a83ea1dc35",
            "next_blocks": [],
            "merkle_root": "09596e072f6ea84fdd847226bb691b09a69b71b0f55cb54574165e8c91af656a",
            "time": "1468553829",
            "bits": "504365040",
            "nonce": "314755",
            "version": "3",
            "branch": "main",
            "size": "331",
            "chain_work": "381687488",
            "confirmation": 9487,
            "difficulty": 0.0009765625,
            "transaction_count": "1",
            "transaction_hashes": [
                "09596e072f6ea84fdd847226bb691b09a69b71b0f55cb54574165e8c91af656a"
            ]
        },
        ...
    ]
}

GET blocks/[:block_hash]

Description

Get the block by block hash.

Parameter

None

Sample Response

{
    "block": {
        "hash": "0000075f2770822d4449ed1b713b979d63092cf19a34873f0a1977ec0e369c0b",
        "height": "363",
        "previous_block_hash": "00000b5f7c9faf0e84e6af52663c947a81be1f6c7a635b81de4bf8a83ea1dc35",
        "next_blocks": [],
        "merkle_root": "09596e072f6ea84fdd847226bb691b09a69b71b0f55cb54574165e8c91af656a",
        "time": "1468553829",
        "bits": "504365040",
        "nonce": "314755",
        "version": "3",
        "branch": "main",
        "size": "331",
        "chain_work": "381687488",
        "confirmation": 9487,
        "difficulty": 0.0009765625,
        "transaction_count": "1",
        "transaction_hashes": [
            "09596e072f6ea84fdd847226bb691b09a69b71b0f55cb54574165e8c91af656a"
        ]
    }
}

GET blocks/[:block_height]

Description

Get the block by block height.

Parameter

None

Sample Response

{
    "block": {
        "hash": "000001ea1d09a8dea7ba616e2597fb526b466781683e7d3d84fe5cbfbe9041c3",
        "height": "2",
        "previous_block_hash": "0000035db602164cbe634024e5e2ba062bf66a733d9606d070e710c9c9523e46",
        "next_blocks": [
            "000004e597624741edb882c695789b2c505b563f1df9989b522630e4d32e68f0"
        ],
        "merkle_root": "8837125afdb8bb3ecb6caee229bdb9ef12787d460e5180ffe41745d26ef1da1c",
        "time": "1466747144",
        "bits": "504365040",
        "nonce": "3815650",
        "version": "3",
        "branch": "main",
        "size": "505",
        "chain_work": "3145776",
        "confirmation": 9487,
        "difficulty": 0.0009765625,
        "transaction_count": "2",
        "transaction_hashes": [
            "d69a6c5b9167632344e41be4b5a215678c94a3e0798e2f35ac367b0ff29dfe3b",
            "668b26a613d26be927461e9d5d117e40adc7118ff0201e63366007111f985c30"
        ]
    }
}

Transaction APIs

GET transactions/[:tx_hash]

Description

Get the transaction by transaction hash.

Parameter

None

Sample Response

{
    "tx": {
        "hash": "09596e072f6ea84fdd847226bb691b09a69b71b0f55cb54574165e8c91af656a",
        "block_hash": "0000075f2770822d4449ed1b713b979d63092cf19a34873f0a1977ec0e369c0b",
        "version": "1",
        "locktime": "1468553828",
        "type": "NORMAL",
        "time": "1468553829",
        "confirmation": 9487,
        "vins": [
            {
                "tx_id": "668b26a613d26be927461e9d5d117e40adc7118ff0201e63366007111f985c30",
                "vout": 0,
                "address": "1BqRyqBK1AHQ55EWiqFXqytMc5R1DP2BZV",
                "scriptSig": "47304402200e5ccc1e5ec92e041b15ded0ed1de1a7c273ea10759ba58092b09dc743[...]",
                "sequence": "4294967294"
            }
        ],
        "vouts": [
            {
                "n": "0",
                "address": "1BqRyqBK1AHQ55EWiqFXqytMc5R1DP2BZV",
                "scriptPubKey": "210357adc9e9ea9b1919045fb02101e5fb1aa7adb35977656c1be841d0dbb5f87f4aac",
                "color": "0",
                "amount": "0"
            }
        ]
    }
}

GET transactions/color/[:color_id]

Description

Get transactions related with certain color (50 transactions per page).

Parameter

Field Type Description
starting_after String the transaction hash starting after, optional parameter
since Integer the since timestamp, optinal parameter
until Integer the until timestamp, optinal parameter
page_size Integer the page size (default 50), optinal parameter

Sample Response

{
    "txs": [
        {
            "hash": "d69a6c5b9167632344e41be4b5a215678c94a3e0798e2f35ac367b0ff29dfe3b",
            "block_hash": "0000075f2770822d4449ed1b713b979d63092cf19a34873f0a1977ec0e369c0b",
            "version": "1",
            "locktime": "1468553828",
            "type": "NORMAL",
            "time": "1468553829",
            "confirmation": 9487,
            "vins": [
                {
                    "tx_id": "668b26a613d26be927461e9d5d117e40adc7118ff0201e63366007111f985c30",
                    "vout": 0,
                    "address": "1BqRyqBK1AHQ55EWiqFXqytMc5R1DP2BZV",
                    "scriptSig": "47304402200e5ccc1e5ec92e041b15ded0ed1de1a7c273ea10759ba58092b09dc743[...]",
                    "sequence": "4294967294"
                }
            ],
            "vouts": [
                {
                    "n": "0",
                    "address": "1BqRyqBK1AHQ55EWiqFXqytMc5R1DP2BZV",
                    "scriptPubKey": "210357adc9e9ea9b1919045fb02101e5fb1aa7adb35977656c1be841d0dbb5f87f4aac",
                    "color": "1",
                    "amount": "0"
                }
            ]
        },
        ...
    ],
    "page": {
        "ending_before": "09596e072f6ea84fdd847226bb691b09a69b71b0f55cb54574165e8c91af656a",
        "starting_after": "d69a6c5b9167632344e41be4b5a215678c94a3e0798e2f35ac367b0ff29dfe3b",
        "next_uri": "/explorer/v1/transactions/color/1?starting_after=09596e072f6ea84fdd847226bb691b09a69b71b0f55cb54574165e8c91af656a"
    }
}

GET transactions/address/[:address]

Description

Get transactions related with a certain address (50 transactions per page).

Parameter

Field Type Description
starting_after String the transaction hash starting after, optional parameter
tx_type Integer the transaction type, optional parameter
since Integer the since timestamp, optinal parameter
until Integer the until timestamp, optinal parameter
page_size Integer the page size (default 50), optinal parameter

Sample Response

{
    "txs": [
        {
            "hash": "d69a6c5b9167632344e41be4b5a215678c94a3e0798e2f35ac367b0ff29dfe3b",
            "block_hash": "0000075f2770822d4449ed1b713b979d63092cf19a34873f0a1977ec0e369c0b",
            "version": "1",
            "locktime": "1468553828",
            "type": "NORMAL",
            "time": "1468553829",
            "confirmation": 9487,
            "vins": [
                {
                    "tx_id": "668b26a613d26be927461e9d5d117e40adc7118ff0201e63366007111f985c30",
                    "vout": 0,
                    "address": "1BqRyqBK1AHQ55EWiqFXqytMc5R1DP2BZV",
                    "scriptSig": "47304402200e5ccc1e5ec92e041b15ded0ed1de1a7c273ea10759ba58092b09dc743[...]",
                    "sequence": "4294967294"
                }
            ],
            "vouts": [
                {
                    "n": "0",
                    "address": "1BqRyqBK1AHQ55EWiqFXqytMc5R1DP2BZV",
                    "scriptPubKey": "210357adc9e9ea9b1919045fb02101e5fb1aa7adb35977656c1be841d0dbb5f87f4aac",
                    "color": "0",
                    "amount": "0"
                }
            ]
        },
        ...
    ],
    "page": {
        "ending_before": "09596e072f6ea84fdd847226bb691b09a69b71b0f55cb54574165e8c91af656a",
        "starting_after": "d69a6c5b9167632344e41be4b5a215678c94a3e0798e2f35ac367b0ff29dfe3b",
        "next_uri": "/explorer/v1/transactions/address/1BqRyqBK1AHQ55EWiqFXqytMc5R1DP2BZV?starting_after=09596e072f6ea84fdd847226bb691b09a69b71b0f55cb54574165e8c91af656a"
    }
}

Address API

GET addresses/[:address]/balance

Description

Get a certain address balance

Parameter

None

Sample Response

{
    "1": "2600",
    "2": "3000"
}

GET addresses/[:address]/utxos

Description

Get a certain address unspent transaction outputs

Parameter

None

Sample Response

{
    "utxo": [
        {
            "tx": "d69a6c5b9167632344e41be4b5a215678c94a3e0798e2f35ac367b0ff29dfe3b",
            "n": "0"
            "color": "1",
            "value": "100"
        },
        ...
    ]
}

GET addresses/[:address]/op_return

Description

Get a certain address related op return transaction outputs

Parameter

None

Sample Response

{
    "txout": [
        {
            "tx": "23363f3bfedcbac7fc1897bf45d9f3d7a8477a9554cd67684ba9c84b042ddd2b",
            "n": "3",
            "op_return_data": "坦力"
        },
        ...
    ]
}