Skip to content

API Endpoints

Jonathan Xu edited this page May 17, 2020 · 5 revisions

Web gets information from Emerald via the API provided by Sapphire. As such, Sapphire has endpoints related to the miner and payout services in source/routes/index.js.

Miner Metrics

Get miner info
[post] /v1/getMinerInfo
Params: {id: string}
Return: The miner data of the miner with the corresponding ID, in JSON format.

{
  "id": "4e855d16-4bee-4a3e-8002-a064acdd987a",
  "monero_balance": "0.0012345",
  "createdAt": "2018-06-08T04:00:00.000Z",
  "updatedAt": null,
  "deletedAt": null
}

Get miner credits
[post] /v1/getMinerCredits
Params: {id: string}
Return: The credits associated with the miner

[
  {
    "id": "123456",
    "minerId": "4e855d16-4bee-4a3e-8002-a064acdd987a",
    "time": "2020-01-05T05:00:00.000Z",
    "credit": "5",
    "createdAt": "2020-02-02T05:00:00.000Z",
    "updatedAt": "2020-05-05T04:00:00.000Z",
    "deletedAt": null
  }
]
  • convertShareToHashrate(shares, difficulty, timestamp, minerId)
  • computeAward(miner_hashrate, network_hashrate, block_reward)
  • processData(data)
  • calculateHashrates()
  • calculateRewards(totalReward, poolHashrate)

Payout Service

Clone this wiki locally