Ontology Developer Center
DISCOVERCOMMUNITYSUPPORT
  • Introduction
  • Discover Ontology
  • Getting Started
  • Glossary
  • Decentralized Identity and Data
    • ONT ID
      • Decentralized Identifiers
        • Method Specification for Ontology
        • Method Specification for Ethereum
        • Method Specification for BSC
      • Verifiable Credentials
        • Anonymous Credentials
      • ONT Login
        • Scenarios
        • Protocol Specification
        • Front-end JavaScript SDK
          • Integration and Usage
          • API Reference
        • Front-end UI SDK
          • Integration and Usage
          • API Reference
        • Back-end Go SDK
          • Integration and Usage
          • API Reference
        • Back-end Java SDK
          • Integration and Usage
          • API Reference
      • ONT TAG
        • Workflow
        • API Reference
      • Mercury
      • OScore
    • DDXF
      • Components and Interfaces
      • GREP
      • Overall Scheme
      • Solutions
        • Marketplace
          • Deployment
          • Scenarios
          • SaaS Tenant
          • Java SDK
        • Data Storage
          • Deployment
          • Java SDK
        • Resource Auditor
        • Offline Judge
      • Use Cases
        • E-Shops
  • ONTOLOGY ELEMENTS
    • Smart Contracts
      • Types of smart contracts
    • Token Protocols
    • Consensus Mechanism
    • Ontology Oracle
      • Oracle Process Flow
  • GUIDES & TUTORIALS
    • Development Guides
      • dApp Development
        • Using the dAPI
        • Data Synchronization
      • Smart Contract Development
        • EVM Contract
          • Development Environment and Tools
          • Wallet Setup
          • Contract Development
          • How to Deploy a Smart Contract with GetBlock
        • NeoVM Contract
          • Development tools and environment
          • Launching the IDE
          • Writing and editing program logic
          • Deploying and testing on private net
        • WASM Contract
          • Development Environment
          • Project Initiation - Hello World
          • Creating your own project
          • Development using SmartX
          • Runtime API
          • Contract Fundamentals
          • Inter-contract Interaction
          • Developing Contracts in C++
        • Publish Contract Source Code
    • Integration Guides
      • dApp Integration
        • dAPI Integration
          • Chrome Plugin
          • Mobile wallet dApp
          • QR code mechanism
          • Wake call mechanism
        • Cocos 2D-x
        • Unity 3D applications
      • Mobile Wallet Integration
        • SDK integration
        • dAPI Integration
          • In-wallet applications
          • QR code mechanism
          • Wake call mechanism
        • Stake
      • Using ONT ID
      • Exchange Integration
        • Exchange Docking Guide
        • Exchange API
      • Ontology for dApp Stores
    • EVM & Token Decimals Upgrade
  • ONTOLOGY NODE
    • Abstract
    • Node Deployment
      • Standard Node
      • Rosetta Node
    • Interacting with a Public Node
  • DEVELOPER TOOLS
    • dApp Development Framework
      • Punica CLI
      • Punica boxes
      • Solo Chain
    • IDE
    • APIs
      • HTTP API
        • Restful
        • WebSocket
        • Remote Procedure Call (RPC)
      • Explorer v2 API
        • Block
        • Address
        • Contract
        • Token
        • Transactions
        • ONT ID
        • Summary
        • Node
      • Native Token API
        • ONT Contract API
        • ONG Contract API
      • ONT ID Contract API
      • Web3 API
      • OScore Open API
      • Rosetta Node API
        • Data API
        • Construction API
      • DToken Contract API
      • DDXF
        • Marketplace Contract API
        • Storage API
      • Governance API
    • Digital Wallet
      • Chrome Plugin provider
      • Chrome Plugin dAPI
      • Mobile version provider
      • Mobile version dAPI
    • SDKs
    • Signing Server
      • Installation
      • API reference
  • COMMUNITY
    • Ecosystem Programs
    • Community Libraries
    • Community Events
    • Community Channels
    • Core Contributors
  • SUPPORT
    • FAQ
      • Basic blockchain concepts
      • Ontology Nodes
      • Ontology token protocols
      • Smart contracts
      • SDKs and APIs
    • Contact Us
Powered by GitBook
On this page
  • 1. Get latest block list
  • 2. Get block list by page
  • 3. Get block detail by height or hash
  • 4. Get latest blocks

Was this helpful?

  1. DEVELOPER TOOLS
  2. APIs
  3. Explorer v2 API

Block

APIs to obtain block related details

1. Get latest block list

url: /v2/latest-blocks?count=10, 
method: GET, 
params: {
}, 
successResponse: {
    "code":0, 
    "msg":"SUCCESS", 
    "result":[
        {
            "block_hash":"63355f8e80...6c8108e4e56b264d2a", 
            "block_height":112, 
            "txs_root":"472af7d21a83156...75b4c0e0b1b4576531", 
            "bookkeepers":"AMvXn7U9...HyqNr&AL4CDqBikrj...ZAQf2fg1AC", 
            "consensus_data":"12156079575032856115", 
            "block_size":532, 
            "block_time":1522205080, 
            "tx_count":12
        }
    ]
}

Url RequestField

Type

Description

count

int

number of latest blocks. (limited between 1 and 50)

ResponseField

Type

Description

block_hash

String

block hash

block_height

int

block height

txs_root

String

the merkleroot of all transactions in the block

bookkeepers

String

keepers of this block, divided by &

consensus_data

String

consensus data

block_size

int

size of this block, unit:bytes

block_time

int

UNIX time of this block

tx_count

int

the number of transactions in this block

2. Get block list by page

url:/v2/blocks?page_size=1&page_number=10, 
method:GET, 
successResponse:{
    "code":0, 
    "msg":"SUCCESS", 
    "result":{
        "records":[
            {
                "block_hash":"63355f8e80...6c8108e4e56b264d2a", 
                "block_height":112, 
                "txs_root":"472af7d21a83156...75b4c0e0b1b4576531", 
                "bookkeepers":"AMvXn7U9...HyqNr&AL4CDqBikrj...ZAQf2fg1AC", 
                "consensus_data":"12156079575032856115", 
                "block_size":532, 
                "block_time":1522205080, 
                "tx_count":12
            }
        ], 
        "total":23449
    }
}

Url RequestField

Type

Description

page_size

int

number of records in one page (The page size is limited between 1 and 20)

page_number

int

number of the page (At least 1 or greater)

ResponseField

Type

Description

total

int

total blocks

block_hash

String

block hash

block_height

int

block height

txs_root

String

the merkleroot of all transactions in the block

bookkeepers

String

keepers of this block, divided by &

consensus_data

String

consensus data

block_size

int

size of this block, unit:bytes

block_time

int

UNIX time of this block

tx_count

int

the number of transactions in this block

3. Get block detail by height or hash

url:/v2/blocks/{param}
method:GET
successResponse:
{
	"code":0, 
	"msg":"SUCCESS", 
	"result":{
        "block_hash":"63355f8e80...6c8108e4e56b264d2a", 
        "block_height":112, 
        "txs_root":"472af7d21a83156...75b4c0e0b1b4576531", 
        "bookkeepers":"AL4CDqBikr...Qf2fg1AC&AL...g1AC", 
        "consensus_data":"12156079575032856115", 
        "block_size":532, 
        "block_time":1522205080, 
        "tx_count":12, 
        "txs":[
        	{
        		"tx_hash":"000062c6fe4...9a1c33721", 
        		"tx_type":209, 
        		"tx_time":1522205080, 
        		"confirm_flag":1
        	}
        ]
	}
}

Url Field

Type

Description

param

String

block height or block hash

ResponseField

Type

Description

block_hash

String

block hash

block_height

int

block height

txs_root

String

the merkleroot of all transactions in the block

bookkeepers

String

keepers of this block, divided by &

consensus_data

String

consensus data

block_size

int

size of this block, unit:bytes

block_time

int

UNIX time of this block

tx_count

int

the number of transactions in this block

txs.tx_hash

String

transaction hash

txs.tx_type

int

transaction type (208/209/210)

txs.confirm_flag

int

transaction state on the blockchain, 1:succees 0:failure

txs.tx_time

int

UNIX time of the transaction

4. Get latest blocks

url:/v2/blocks/generate-time?count=10, 
method:GET, 
successResponse:{
    "code":0, 
    "msg":"SUCCESS", 
    "result":[
		{
			"block_height":1, 
			"generate_time":6
		}, 
		{
			"block_height":2, 
			"generate_time":1
		}
	]
}

RequestField

Type

Description

count

int

number of the latest blocks

ResponseField

Type

Description

block_height

int

block height

generate_time

int

time of block generation,unit:seconds

PreviousExplorer v2 APINextAddress

Last updated 4 years ago

Was this helpful?