Get Latest Mined Block

Through this endpoint customers can fetch the last mined block in a specific blockchain network, along with its details. These could include the hash of the specific, the previous and the next block, its transactions count, its height, etc.

Blockchain specific data is information such as version, nonce, size, bits, merkleroot, etc.

GET /blockchain-data/{blockchain}/{network}/blocks/last

Path Parameters

  • Required
    blockchain string

    Represents the specific blockchain protocol name, e.g. Ethereum, Bitcoin, etc.

    Example : bitcoin
    Possible Values : bitcoin ethereum ethereum-classic bitcoin-cash litecoin dogecoin dash
  • Required
    network string

    Represents the name of the blockchain network used; blockchain networks are usually identical as technology and software, but they differ in data, e.g. - "mainnet" is the live network with actual data while networks like "testnet", "ropsten", "rinkeby" are test networks.

    Example : testnet
    Possible Values : mainnet testnet ropsten rinkeby mordor

Query parameters

  • Optional
    context string

    In batch situations the user can use the context to correlate responses with requests. This property is present regardless of whether the response was successful or returned as an error. context is specified by the user.

Response schema

200 400 401 402 403 404 409 415 422 429 500
HTTP Status Code: 200
Content-Type: application/json

The request has been successful.

  • Object :

  • Required
    apiVersion string

    Specifies the version of the API that incorporates this endpoint.

    Example : 2.0
  • Required
    requestId string

    Defines the ID of the request. The requestId is generated by Crypto APIs and it's unique for every request.

    Example : 601c1710034ed6d407996b30
  • Optional
    context string

    In batch situations the user can use the context to correlate responses with requests. This property is present regardless of whether the response was successful or returned as an error. context is specified by the user.

    Example : You can add any text here
  • Required
    data object
    • Required
      item object
      • Required
        hash string

        Represents the hash of the block, which is its unique identifier. It represents a cryptographic digital fingerprint made by hashing the block header twice through the SHA256 algorithm.

        Example : 00000000000000000002ad6f9c74faf503bb055c54e0d0746ef34f888f95890f
      • Required
        height integer

        Represents the number of blocks in the blockchain preceding this specific block. Block numbers have no gaps. A blockchain usually starts with block 0 called the "Genesis block".

        Example : 673852
      • Required
        previousBlockHash string

        Represents the hash of the previous block, also known as the parent block.

        Example : 00000000000000000008953625613e60b56194ea31f07aad43c7505fbddce77f
      • Required
        timestamp integer

        Defines the exact date/time when this block was mined in Unix Timestamp.

        Example : 1610365615
      • Required
        transactionsCount integer

        Represents the total number of all transactions as part of this block.

        Example : 2755
      • Required
        blockchainSpecific object One Of
        object
        • Required
          difficulty string

          Represents a mathematical value of how hard it is to find a valid hash for this block.

          Example : 21448277761059.71
        • Required
          nonce integer

          Represents a random value that can be adjusted to satisfy the proof of work

          Example : 2113101077
        • Required
          size integer

          Represents the total size of the block in Bytes.

          Example : 1408113
        • Required
          bits string

          A sub-unit of BTC equal to 0.000001 BTC, or 100 Satoshi, and is the same as microbitcoin (μBTC). Bits have two-decimal precision.

          Example : 170d21b9
        • Required
          chainwork string

          Represents a hexadecimal number of all the hashes necessary to produce the current chain. E.g., when converting 0000000000000000000000000000000000000000000086859f7a841475b236fd to a decimal you get 635262017308958427068157 hashes, or 635262 exahashes.

          Example : 00000000000000000000000000000000000000001932c1bc515b0c0e0dee2040
        • Required
          merkleRoot string

          Defines the single and final (root) node of a Merkle tree. It is the combined hash of all transactions' hashes that are part of a blockchain block.

          Example : 02754414626473fa39a0cfbf8d1960fc17ba932ab586340f61f039114053e851
        • Required
          strippedSize integer

          Defines the numeric representation of the block size excluding the witness data.

          Example : 925958
        • Required
          version integer

          Represents the version of the specific block on the blockchain.

          Example : 536928256
        • Required
          versionHex string

          Is the hexadecimal string representation of the block's version.

          Example : 2000000
        • Required
          weight integer

          Represents a measurement to compare the size of different transactions to each other in proportion to the block size limit.

          Example : 3999412
Try it out

Request Example

GET
https://rest.cryptoapis.io/v2/blockchain-data/bitcoin/testnet/blocks/last
Headers
Host: https://rest.cryptoapis.io/v2
Content-Type: application/json
X-API-Key: my-api-key

Response Example

{
    "apiVersion": "2.0",
    "requestId": "601c1710034ed6d407996b30",
    "context": "You can add any text here",
    "data": {
        "item": {
            "hash": "00000000000000000002ad6f9c74faf503bb055c54e0d0746ef34f888f95890f",
            "height": 673852,
            "previousBlockHash": "00000000000000000008953625613e60b56194ea31f07aad43c7505fbddce77f",
            "timestamp": 1610365615,
            "transactionsCount": 2755,
            "blockchainSpecific": {
                "difficulty": "21448277761059.71",
                "nonce": 2113101077,
                "size": 1408113,
                "bits": "170d21b9",
                "chainwork": "00000000000000000000000000000000000000001932c1bc515b0c0e0dee2040",
                "merkleRoot": "02754414626473fa39a0cfbf8d1960fc17ba932ab586340f61f039114053e851",
                "strippedSize": 925958,
                "version": 536928256,
                "versionHex": "2000000",
                "weight": 3999412
            }
        }
    }
}