Blocksscan APIs
What Blocksscan APIs are, what they are used for, and how to use them for development on the XDC Network.
🧭 Table of contents
📰 Overview
BlockScan is a blockchain explorer and analytics platform for EVM networks.
What you will learn
This article will teach you what Blocksscan APIs are, what Blocksscan APIs are used for, and how to use the features of Blocksscan APIs for development on the XDC Network.
What you will do
Explore BlockScan APIs
Execute BlockScan API methods
📰 About BlockScan API
Blockscan is a blockchain explorer which provides realtime information on blocks, transactions, tokens, balances and more on XDC network. BlockScan API gives developers direct access to BlockScan explorer data via HTTP GET requests.
Why and when to use BlockScan API
BlockScan API is used when you need to get data from blockchain. By using BlockScan API, you don't need to run our own blockchain node and storing hundreds of gigabytes of blockchain data which is very expensive and unreliable. It can be used to fetch data for wide range of applications from blockchain dashboards to decentralized exchanges.
🔍 API Overview
BlockScan API consists of five main methods:
Accounts
: get XDC account data like balance, address, txCount etc.Blocks
: get XDC blockchain block infoContracts
: get contract details and verified contractsTransactions
: get list of transactions, transaction details and logsTokens
: get details on XRC20 and XRC721 tokens
🔍 Interact With BlockScan API
In this introduction we will display two main ways to interact with BlockScan API: Swagger UI and via Node.js.
Swagger UI
Swagger UI is a tool to visualize and interact with API. It is great as a learning tool or documentation.
To open XDC BlockScan API Swagger UI go to xdc.blocksscan.io/docs.
Click on one of the dropdowns, in this example /api/tokens
. Scroll to bottom of page to find it.
You will see input fields and description of parameters for this request. To unlock requests, click Try it out
.
Now fill type
field with xrc721
, because we are going to search for NFT tokens. In page
field type 1 for the first page and set limit to 10
. Once it is done, hit Execute
.
After waiting a bit, you will receive a response with NFT data from XinFin blockchain.
Node.js
Run this to install axios
package.
Then create index.js
, copy and run this Javascript code.
Once completed, you should see account info like this:
For more information about BlockScan, Please Visit BlockScan Website. For more information about XinFin Network, Please Visit XDC Network Documentation on GitBook.
Last updated