Skip to content
This repository has been archived by the owner on Nov 20, 2020. It is now read-only.

Latest commit

 

History

History
404 lines (365 loc) · 7.08 KB

API.md

File metadata and controls

404 lines (365 loc) · 7.08 KB

Conflux Scan V2.0 API

Global Contract

Overview

  • All data is sent and received as JSON
  • All timestamps return in 10 digit int: 1558329858
  • All keys are named with Camel-Case

Request

  • Content-Type: application/json; charset=utf-8

Response Format

Name Type Description
code int Error code
message string Error Message
result object Return result data

Authorization

NONE

API Reference

Dashboard Statistics

path: /dashboard/statistics
method: 'get'
params: {}
result: {
  data: {
    'tps': { // tps/difficulty/blockTime/hashRate
      val: num,
      trend: num
  }, ...}
}

Dashboard Line Chart

path: /dashboard/statistics/:name // tps/difficulty/blockTime/hashRate
method: 'get'
params: {
  duration: '' // hour/day/month/all
}
result: {
  data: [{
    time: num, // 10bit
    value: num
  }, ...]
}

Block Detail

path: /block/:blockHash
method: 'get'
params: {}
result: {
  data: {
    epochNumber: num,
    position: num,
    hash: 'hash',
    difficulty: 'num',
    miner: 'hash',
    gasLimit: num,
    timestamp: num, // 10bit
    transactionSize: num, // Tx count
    //
    deferredReceiptsRoot: 'hash',
    deferredStateRoot: 'hash',
    height: num,
    isPivot: bool,
    nonce: 'hash',
    parentHash: 'hash',
    refereeHashes: [],
    size: num,
    transactionsRoot: 'hash'
  }
}

Block Detail Transaction List

path: /block/:blockHash/transactionList
method: 'get'
params: {
  pageNum: 1 // num | 页码
  pageSize: 10 // num | 每页展示数
}
result: {
  total: num, // 总数
  data: [{
    blockHash: 'hash',
    from: 'hash',
    to: 'hash',
    value: '',
    gasPrice: 'num',
    timestamp: num, // 10bit
    contractCreated: ,
    data: '',
    // isPivot: bool, // Tx 无 Pivot 
    epochNumber: num,
    gas: num,
    hash: 'hash',
    nonce: num,
    r: 'hash',
    s: 'hash',
    transactionIndex: num,
    v: num,
  }, ...]
}

Block List

path: /block/list
method: 'get'
params: {
  epochNum: num, // 可选
  pageNum: 1 // num | 页码
  pageSize: 10 // num | 每页展示数
}
result: {
  code: // 0 | 1
  msg:  //
  result: {
    total: num, // 总数
    data: [{
      epochNumber: num,
      position: num,
      hash: 'hash',
      difficulty: 'num',
      miner: 'hash',
      gasLimit: num,
      timestamp: num, // 10bit
      transactionSize: num, // Tx count
      //
      deferredReceiptsRoot: 'hash',
      deferredStateRoot: 'hash',
      height: num,
      isPivot: bool,
      nonce: 'hash',
      parentHash: 'hash',
      refereeHashes: [],
      size: num,
      transactionsRoot: 'hash'
    }, ...]
  }
}

Tx List

path: /transaction/list
method: 'get'
params: {
  pageNum: 1 // num | 页码
  pageSize: 10 // num | 每页展示数
}
result: {
  code: // 0 | 1
  msg:  //
  result: {
    total: num, // 总数
    data: [{
      blockHash: 'hash',
      from: 'hash',
      to: 'hash',
      // value
      // gas price
      timestamp: num, // 10bit
      contractCreated: ,
      data: '',
      // isPivot: bool,
      epochNumber: num,
      gas: num,
      gasPrice: 'num',
      hash: 'hash',
      nonce: num,
      r: 'hash',
      s: 'hash',
      transactionIndex: num,
      v: num,
      value: '',
    }, ...]
  }
}

Tx Detail

path: /transaction/:transactionHash
method: 'get'
params: {}
result: {
  code: // 0 | 1
  msg:  //
  result: {
    data: {
      blockHash: 'hash',
      from: 'hash',
      to: 'hash',
      value: '',
      gasPrice: 'num',
      timestamp: num, // 10bit
      contractCreated: ,
      data: '',
      // isPivot: bool,
      epochNumber: num,
      gas: num,

      hash: 'hash',
      nonce: num,
      r: 'hash',
      s: 'hash',
      transactionIndex: num,
      v: num,
    }
  }
}

Account Detail

path: /account/:address
method: 'get'
params: {}
result: {
  code: // 0 | 1
  msg:  //
  result: {
    data: { 
      balance: "39998263999999999968857000" //39998264 CFX(Max) 10^9  Gdrip  Drip(Min)
      firstSeen: 1557924851
      lastSeen: 1558495563
      minedBlocks: 0
      receivedTransactions: 1
      sentTransactions: 1483
    }
  }
}

Account Tx List (S/R Merge)

path: /account/:address/transactionList
method: 'get'
params: {
  startTime: 'string', // 可选:精确到小时
  endTime: 'string', // 可选:精确到小时
  txnType: 'all', // 可选: 默认all  all | outgoing | incoming
  pageNum: 1 // num | 页码
  pageSize: 10 // num | 每页展示数
}
result: {
  code: // 0 | 1
  msg:  //
  result: {
    total: num, // 总数
    data: [{
      blockHash: 'hash',
      // isPivot: bool,
      from: 'hash',
      isIn: bool,
      to: 'hash',
      isOut: bool,
      value: '',
      gas: num,
      gasPrice: 'num',
      timestamp: num, // 10bit
      contractCreated: ,
      data: '',
      epochNumber: num,
      hash: 'hash',
      nonce: num,
      r: 'hash',
      s: 'hash',
      transactionIndex: num,
      v: num,
    }, ...]
  }
}

Account Block List

path: /account/:address/minedBlockList
method: 'get'
params: {
  pageNum: 1 // num | 页码
  pageSize: 10 // num | 每页展示数
}
result: {
  code: // 0 | 1
  msg:  //
  result: {
    total: num, // 总数
    data: [{
      epochNumber: num,
      position: num,
      hash: 'hash',
      difficulty: 'num',
      miner: 'hash',
      gasLimit: num,
      timestamp: num, // 10bit
      transactionSize: num, // Tx count
      //
      deferredReceiptsRoot: 'hash',
      deferredStateRoot: 'hash',
      height: num,
      isPivot: bool,
      nonce: 'hash',
      parentHash: 'hash',
      refereeHashes: [],
      size: num,
      transactionsRoot: 'hash'
    }, ...]
  }
}

Referee Block List

path: /block/:blockHash/refereeBlockList
method: 'get'
params: {
  pageNum: 1 // num | 页码
  pageSize: 10 // num | 每页展示数
}
result: {
  code: // 0 | 1
  msg:  // 
  result: {
    total: num, // 总数
    data: [{ 
      epochNumber: num,
      position: num,
      hash: 'hash',
      difficulty: 'num',
      miner: 'hash',
      gasLimit: num,
      timestamp: num, // 10bit
      transactionSize: num, // Tx count
      deferredReceiptsRoot: 'hash',
      deferredStateRoot: 'hash',
      height: num,
      isPivot: bool,
      nonce: 'hash',
      parentHash: 'hash',
      refereeHashes: [],
      size: num,
      transactionsRoot: 'hash'
    }, ...]
  }
}

Get type of given hash

path: /util/type/:hash
method: 'get'
params: {
}
result: {
  code: 
  msg:  
  result: {
    data: 0/1/2, // 0 for block, 1 for transaction, 2 for account
  }
}