XFI Scan API - Testnet

Queries

txs - queries for transactions

GET /api/1.0/txs

Retrieving a list of transactions.

Example of an answer: https://test.xfiscan.com/api/1.0/txs

Queries Parameters:

ParameterTypeDescription

from_height

string

Block number from.

to_height

string

Block number to.

address

string

Account Address.

addresses

array [string]

Account addresses array.

txhash

string

Transaction hash.

txhashes

array [string]

Transaction hash array.

height

string

Block Height.

page

number

Page Number.

limit

number

The number of entities to give away

sort

string

The sort field takes in values with or without the prefix "-" (minus) which indicates the decreasing or increasing of the specified field Example: '-height' is descending, 'height' is ascending.

GET /api/1.0/txs/{hash} Getting the transaction hash.

Example of an answer: https://test.xfiscan.com/api/1.0/txs/D64C8804B101996F92F57603166CF2852C48DDDA959316034280088F1FF99731

ParameterTypeDescription

hash

string

Transaction hash. Mandatory field.

blocks - query for blocks

GET /api/1.0/blocks

Getting a list of blocks.

Example of an answer: https://test.xfiscan.com/api/1.0/blocks

ParameterTypeDescription

height

string

Block Height.

from_height

string

Block number from.

to_height

string

Block number to.

page

number

Page Number.

limit

number

The number of entities to give away.

sort

string

The sort field takes in values with or without the prefix "-" (minus) which indicates the decreasing or increasing of the specified field Example: '-height' is descending, 'height' is ascending.

GET /api/1.0/blocks/latest Receiving the current confirmed block

Example of an answer: https://test.xfiscan.com/api/1.0/blocks/latest

GET /api/1.0/blocks/{height}

Getting a specific block. Example of an answer: https://test.xfiscan.com/api/1.0/blocks/1

ParameterTypeDescription

height

string

Block height. Mandatory field.

addresses - queries for account addresses

GET /api/1.0/addresses

Retrieve a list of account addresses Example of an answer: https://test.xfiscan.com/api/1.0/addresses

ParameterTypeDescription

address

string

Account Address.

validatorAddress

string

Validator Address.

addresses

array [string]

Account addresses array.

blockNumber

string

Block Number.

page

number

Page Number.

limit

number

The number of entities to give away.

sort

string

The sort field takes in values with or without the prefix "-" (minus) which indicates the decreasing or increasing of the specified field Example: '-height' is descending, 'height' is ascending.

GET /api/1.0/addresses/{address}

Get address by hash of account address. Example of an answer: https://test.xfiscan.com/api/1.0/addresses/mx1j3ys0zehrles4y8vxmlxry03vnx4yltyg2alsv

ParameterTypeDescription

address

string

Account Address Mandatory field.

GET /api/1.0/addresses/rich-list/{type}

Getting a list of addresses by the number of tokens purchased.

Example of an answer: https://test.xfiscan.com/api/1.0/addresses/rich-list/mpx

ParameterTypeDescription

type

string

Token type (MPX or XFI). Mandatory field.

validators - queries for validators.

GET /api/1.0/validators

Getting a list of validators.

Example of an answer: https://test.xfiscan.com/api/1.0/validators

ParameterTypeDescription

ninAddresses

array [string]

The passed list ninAddresses of the threat from the search.

address

string

Account Address.

addresses

array [string]

Account addresses array.

page

number

Page number.

limit

number

The number of entities to give away.

sort

string

The sort field takes in values with or without the prefix "-" (minus) which indicates the decreasing or increasing of the specified field Example: '-height' is descending, 'height' is ascending.

GET /api/1.0/validators/{address}

Getting the validator by the address.

Example of an answer: https://test.xfiscan.com/api/1.0/validators/mxvaloper1902re99ggp60q58z4nhcc9jqutp3xmaq6jlx0u

ParameterTypeDescription

address

string

Validator Address. Mandatory field.

ParameterTypeDescription

tokenSymbol

string

Token character

contractAddress

string

Contract address

txHashCreate

string

The hash of the token creation.

creatorAddress

string

The address of the creator of the token.

page

number

Page number.

limit

number

The number of entities to give away.

sort

string

The sort field takes in values with or without the prefix "-" (minus) which indicates the decreasing or increasing of the specified field Example: '-height' is descending, 'height' is ascending.

GET /api/1.0/tokens-erc20/{address}

Receiving a token.

Example of an answer: https://test.xfiscan.com/api/1.0/tokens-erc20/0x739fD25CaeFe272DFf9dbab25f161cE36301BF14

ParameterTypeDescription

address

string

Token address. Mandatory field.

stat - getting statistics

GET /api/1.0/stat

Example of an answer: https://test.xfiscan.com/api/1.0/stat

{
  "coins": [  // tokens list
    {
      "denom": "string", // token character 
      "amount": "string" // amount of tokens 
    }
  ],
  "staked_coins": [ // staked tokens
    {
      "denom": "string", // token character 
      "amount": "string" // amount of tokens
    }
  ],
  "unbonding_coins": [  // locked tokens
    {
      "denom": "string",// token character 
      "amount": "string"// amount of tokens 
    }
  ],
  "unclaimed_coins": [ // free to use tokens
    {
      "denom": "string",// token character 
      "amount": "string"// amount of tokens 
    }
  ],
  "latest_block_hash": "string", // last block hash
  "latest_block_height": "string", // last block height

  "latest_block_time": "string",// last block date
  "total_txs": "string", // total number of transactions
  "total_addresses": "string" // total number of addresses 
}

event-logs - smart contracts logs

GET /api/1.0/event-logs

Getting smart contracts logs.

Example of an answer: https://test.xfiscan.com/api/1.0/event-logs

ParameterTypeDescription

blockHash

string

Block hash.

originAddress

string

The address that called the smart contract.

transactionHash

string

Transaction hash.

transactionIndex

number

The log index in the transaction.

contractAddress

string

Smart contract address.

page

number

Page number.

limit

number

The number of entities to give away.

sort

string

The sort field takes in values with or without the prefix "-" (minus) which indicates the decreasing or increasing of the specified field Example: '-height' is descending, 'height' is ascending.

contracts - smart contracts queries

GET /api/1.0/contracts

Getting smart contracts. Example of an answer: https://test.xfiscan.com/api/1.0/contracts

tokens-erc20-transfers

GET /api/1.0/token-erc20-transfers

Query for tokenized transfers.

Example of an answer: https://test.xfiscan.com/api/1.0/token-erc20-transfers

ParameterTypeDescription

contractAddress

string

Contract address.

blockNumber

string

Block number.

address

string

Account address.

addressTo

string

Address to.

addressFrom

string

Address from.

tokenSymbol

string

Token character.

tokenName

string

Name of the token.

txHash

string

Contract hash.

page

number

Page number.

limit

number

The number of entities to give away.

sort

string

The sort field takes in values with or without the prefix "-" (minus) which indicates the decreasing or increasing of the specified field Example: '-height' is descending, 'height' is ascending.

tokens-erc20 - list of tokens of ERC-20 standard.

GET /api/1.0/tokens-erc20

Getting a list of tokens.

Example of an answer: https://test.xfiscan.com/api/1.0/tokens-erc20

ParameterTypeDescription

tokenSymbol

string

Token character

contractAddress

string

Contract address

txHashCreate

string

The hash of the token creation.

creatorAddress

string

The address of the creator of the token.

page

number

Page number.

limit

number

The number of entities to give away.

sort

string

The sort field takes in values with or without the prefix "-" (minus) which indicates the decreasing or increasing of the specified field Example: '-height' is descending, 'height' is ascending.

GET /api/1.0/tokens-erc20/{address}

Receiving a token.

Example of an answer: https://test.xfiscan.com/api/1.0/tokens-erc20/0x739fD25CaeFe272DFf9dbab25f161cE36301BF14

ParameterTypeDescription

address

string

Token address. Mandatory field.

tokens-erc20-holders

GET /api/1.0/token-erc20-holders

Getting a list of token holders. Example of an answer: https://test.xfiscan.com/api/1.0/token-erc20-holders

ParameterTypeDescription

tokenSymbol

string

Token character

address

string

Account address.

contractAddress

string

Contract address.

blockNumber

string

Block number.

page

number

Page number.

limit

number

The number of entities to give away.

sort

string

The sort field takes in values with or without the prefix "-" (minus) which indicates the decreasing or increasing of the specified field Example: '-height' is descending, 'height' is ascending.

GET /api/1.0/search

Searching an address, block, transaction, or token based on a passed value.

Example of an answer: https://test.xfiscan.com/api/1.0/search?value=0xf58941E4258320D76BdAb72C5eD8d47c25604e94

ParameterTypeDescription

value

string

Address, block, transaction or token. Mandatory field.

stream

OPTIONS /api/1.0/stream/new-block Getting a data stream of new block data. OPTIONS /api/1.0/stream/new-txs

Getting a data stream of new transactions.

Per socketio protocol.

Example for js:

const socket = io(`https://dev.xfiscan.com/stream`, {path: '/api/1.0/stream'})
 
    socket.on('connect', () => {
      console.log('connect');
    })
    socket.on('disconnect', (data) => console.log(data));
    socket.on('new-block', (data) => console.log(data));
    socket.on('new-txs, (data) => console.log(data));

where

url connection: https://test.xfiscan.com/stream, handshake path /api/1.0/stream, new-block - subscribe to receive new blocks, new-txs - subscribe to receive new transactions.

Last updated