Skip to content
MSFTserver edited this page May 12, 2018 · 4 revisions

GET

Charts: mining-revenue, difficulty, block-interval, block-size

  • GET /api/chart/difficulty
{"name":"Difficulty","data":{"x":"height","json":{"height":[206750,206751,....207021],"difficulty":[25348.67328088,25348.67328088,....25348.67328088]},"names":{"height":"Height","difficulty":"Difficulty"}}}
  • GET /api/charts
{"charts":{"block-size":{"name":"Block Size"},"block-interval":{"name":"Block Interval"},"difficulty":{"name":"Difficulty"},"mining-revenue":{"name":"Mining revenue"}}}

Estimate Smartfees

  • GET /api/utils/estimatesmartfee?nbBlocks=2&mode=economical
{"2":0.00001048}

Transactions by block and address

This endpoint returns full transaction data for blocks and Addresses

NOTE: there is an undocumented param to paginate, didn't go digging

{
  "pagesTotal": 39,
  "txs": [ {"transaction_details1"}, {"transaction_details2"}, ... ]
}
{
  "pagesTotal": 1,
  "txs": [ {"transaction_details1"}, {"transaction_details2"} ]
}

Implementation

  • GET /api/txs?address
    • rvnd Method: searchrawtransactions
  • GET /api/txs?block
    • rvnd Method: getblock (rvnd has a verbose tx option)

Get Transaction Details

This endpoint returns the full data for a given transaction

{
  "txid": "dbaf14e1c476e76ea05a8b71921a46d6b06f0a950f17c5f9f1a03b8fae467f10",
  "version": 1,
  "locktime": 0,
  "vin": [
    {
      "coinbase": "03400d0302ef02062f503253482f522cfabe6d6dd90d39663d10f8fd25ec88338295d4c6ce1c90d4aeb368d8bdbadcc1da3b635801000000000000000474073e03",
      "sequence": 4294967295,
      "n": 0
    }
  ],
  "vout": [
    {
      "value": "50.63517500",
      "n": 0,
      "scriptPubKey": {
        "hex": "4104b0bd634234abbb1ba1e986e884185c61cf43e001f9137f23c2c409273eb16e6537a576782eba668a7ef8bd3b3cfb1edb7117ab65129b8a2e681f3c1e0908ef7bac",
        "asm": "04b0bd634234abbb1ba1e986e884185c61cf43e001f9137f23c2c409273eb16e6537a576782eba668a7ef8bd3b3cfb1edb7117ab65129b8a2e681f3c1e0908ef7b OP_CHECKSIG",
        "addresses": [
          "1MdYC22Gmjp2ejVPCxyYjFyWbQCYTGhGq8"
        ],
        "type": "pubkeyhash"
      },
      "spentTxId": "5c76eb4dfb0941856a229833ef05b2f5c669dadc98ed2a34ea11974cacba9dc7",
      "spentIndex": 0,
      "spentHeight": 201417
    }
  ],
  "blockhash": "000000000000034a7dedef4a161fa058a2d67a173a90155f3a2fe6fc132e0ebf",
  "blockheight": 200000,
  "confirmations": 303254,
  "time": 1348310759,
  "blocktime": 1348310759,
  "isCoinBase": true,
  "valueOut": 50.635175,
  "size": 192
}

Implementation

  • GET /api/tx/:txId
    • rvnd Method: getrawtransaction

Address details

Given an address, return the balance and other details, optionally return the list of txid associated

{
  "addrStr": "RQ97Askukb1HH5GUxH6apU4DaTMrQSUaw5",
  "balance": 200005,
  "balanceSat": 20000500000000,
  "totalReceived": 200005,
  "totalReceivedSat": 20000500000000,
  "totalSent": 0,
  "totalSentSat": 0,
  "unconfirmedBalance": 0,
  "unconfirmedBalanceSat": 0,
  "unconfirmedTxApperances": 0,
  "txApperances": 2,
  "transactions": [
    "61c8f556338b44a77a5545db276a221dc1fa37b0b70f8ca3b15cf822699ac6fe",
    "487d4efb7937724ca3dea309a2e0e25bcc419cc408ca7fea34f3402fc743ac5b"
  ]
}

Implementation

  • GET /api/addr/:addrStr/?noTxList=1
    • rvnd Method: searchrawtransactions
    • Note: Endpoint will modify format of responses

UTXO details

Fetch a list of UTXO given an address

[
  {
    "address": "RUiosfoxnA3aMZqS5F65uiAss5xaDejXpV",
    "txid": "0a2adb164356427ed46758a6c0e9e89614fda2faf2d741598c88eb4f05fa0bbb",
    "vout": 2,
    "scriptPubKey": "76a914700f4c9c534270b41ba885ad44c1929652efa83788ac",
    "amount": 0.00493617,
    "satoshis": 493617,
    "height": 492686,
    "confirmations": 10571
  }
]

Implementation

  • GET /api/addrs/:address/utxo
    • rvnd Method: searchrawtransactions
    • Note: Endpoint will modify format of responses

Current Exchange Prices

This endpoint is undocumented in the Insight API Docs

  • GET /api/currency
{
  "status": 200,
  "data": {
    "rate": "0.0493546",
    "short": "RVN"
  }
}

Implementation

  • GET /api/currency
    • Insight only implements one exchange right now. We could easily make this more pluggable

Get block details given block hash

Get block details given the block hash

{
  "hash": "7497c7895b443a75100f3ad43c6077632a07af93eec945b5d22f61645600e513",
  "size": 15844,
  "height": 198940,
  "version": 536870912,
  "merkleroot": "b7357f757580e39c768acf494ea9048192ac5599e5bc502b7c85cd5e0059cd13",
  "tx": [
    "9f37add8e0fac93d20118d0f65e3b3d589e3dbba252f32d883cbd54f7f43d44b"
    "4642464e0e53724c011c6ad1dd110b3b3f7f165b4cae5d3b6200837e2e3150f5"
    ...
  ],
  "time": 1525535072,
  "nonce": 1548786733,
  "bits": "1b02b7cf",
  "difficulty": 24111.45845379,
  "chainwork": "000000000000000000000000000000000000000000000000668ab2156fdb1bd5",
  "confirmations": 105,
  "previousblockhash": 	"000000000002af071c5db60f8e5f345f39556f3d08b9a36bc4616ab5a9fba4e0",
  "nextblockhash": ""000000000000783d68329dbab200190231d1407c6b15cacf21d3d235b2228858"",
  "reward": 5000,
  "isMainChain": true,
  "poolInfo": {}
}

Implementation

  • GET /api/block/:blockHash
    • rvnd Method: getblock

Block Summaries

Fetch the Block summaries by date.

NOTE: There appears to be more to this api. It's not returning all the blocks on a given date

{
  "blocks": [
    {
      "height": 198940,
      "size": 12751,
      "hash": "00000000000182ba43a800f673ebf3aa9a9fe437fe9ed47f8aac37dedd9f3e29",
      "time": 1525535072,
      "txlength": 200,
      "poolInfo": { }
    }
  ],
  "length": 1,
  "pagination": {
    "next": "2018-01-10",
    "prev": "2018-01-08",
    "currentTs": 1515542399,
    "current": "2018-01-09",
    "isToday": true,
    "more": false
  }
}

Implementation

  • GET /api/blocks?limit={{ .limit }}&blockDate={{ .blockDate }}
    • No obvious method, easy to string together a couple

Block Hash

Fetch the block hash by block height

{
  "blockHash": "00000000000182ba43a800f673ebf3aa9a9fe437fe9ed47f8aac37dedd9f3e29"
}

Implementation

  • GET /api/block-index/:blockHeight
    • rvnd Method: getblockindex

Get Diagnostic Info From Node

Get diagnostic info from the RVN node backing this API. Query can be:

  • getInfo
  • getDifficulty
  • getBestBlockHash
  • getLastBlockHash
{
  "info": {
    "version": 120100,
    "protocolversion": 70012,
    "blocks": 3251,
    "timeoffset": 0,
    "connections": 8,
    "proxy": "",
    "difficulty": 19311.716,
    "testnet": false,
    "relayfee": 0.00001,
    "errors": "Warning: unknown new rules activated (versionbit 1)",
    "network": "livenet"
  }
}

Implementation

  • GET /api/status?q={{ .query }}
    • rvnd Method: getinfo, getdifficulty, getbestblockhash

Get Node Sync Staus

{
  "status": "finished",
  "blockChainHeight": 3251,
  "syncPercentage": 100,
  "height": 503251,
  "error": null,
  "type": "ravencore node"
}

Implementation

  • GET /api/sync
    • rvnd Method: getinfo?
    • May need to check against other nodes?

Get Node Peer Status

{
  "connected": true,
  "host": "127.0.0.1",
  "port": null
}
  • GET /api/peer
    • rvnd Method: getpeerinfo

POST

Verify

Unsure what this endpoint does, undocumented

  • POST /api/messages/verify
    • POST Body
{
  "address": "RQ97Askukb1HH5GUxH6apU4DaTMrQSUaw5",
  "signature": "a signature",
  "message": "foobar"
}
  • Return JSON
{
  "nodata": "nodata"
}

Send Transaction

This endpoint broadcasts a formatted ravencoin transaction

{
  "rawtx": "01000000017b1eabe0209b1fe794124575ef807057c77ada2138ae4fa8d6c4de0398a14f3f00000000494830450221008949f0cb400094ad2b5eb399d59d01c14d73d8fe6e96df1a7150deb388ab8935022079656090d7f6bac4c9a94e0aad311a4268e082a725f8aeae0573fb12ff866a5f01ffffffff01f0ca052a010000001976a914cbc20a7664f2f69e5355aa427045bc15e7c6c77288ac00000000"
}
  • Return JSON
{
  "txid": "61c8f556338b44a77a5545db276a221dc1fa37b0b70f8ca3b15cf822699ac6fe"
}

Implementation

  • POST /api/tx/send
    • rvnd Method: sendrawtransaction