Skip to content

Historian search and summary endpoint #1

@DevonJames

Description

@DevonJames

Index all tx-comments that include "alexandria-historian-v001"

message schema:

"alexandria-historian-v001:$URL_of_node_or_pool:$mrr.last_10:$pool.hashrate:$fbd.networkhashps:$fmd.weighted:$fmd.usd:$signature"

$signature=$URL_of_node_or_pool:$mrr.last_10:$pool.hashrate:$fbd.networkhashps:$fmd.weighted:$fmd.usd

example tx-comment:

"alexandria-historian-v001:pool.alexandria.io:0.000130513000:358920574.29333335:798504117:0.00000499:0.00216:IKDcfh8URcFR8pdl0fp25f2Jtq7br1HMcdZQfXJ3LwngFW1r6E9+7UMxLjj+pOFqjV39E8iCWLwbyJakRwSZUpY="

Variables

mrr.last_10 = miningrigrentals, last 10 scrypt rentals:
= 0.000130513000 (btc per MH/day)

pool.hashrate = alexandria pool hashrate:
= 358920574.29333335 (hashes per second)

fbd.networkhashps = florincoin blockchain data api, hashrate:
= 798504117 (hashes per second)

fmd.weighted = florincoin market data api, volume weighted avg BTC price:
= 0.00000499 (BTC)

fmd.usd = florincoin market data api, 24-hour average USD price:
= 0.00216 (USD)

Calculations

spot flo cost basis:
flo.spotcost_btc = fbd.networkhashps ÷ 1000000 x mrr.last_10 ÷ (24 x 60 x 3 ÷ 2 x 25) =
798504117 ÷ 1000000 x 0.000130513000 ÷ (24 x 60 x 3 ÷ 2 x 25) =
0.00000192991052 BTC per Flo

flo.spotcost_usd = flo.spotcost_btc x fmd.usd ÷ fmd.weighted =
= 0.00083539278557 USD per Flo

Return the following:

Summary from recent 135 blocks:
fmd.weighted_avg = average of fmd.weighted values from most recent 135 blocks
fmd.usd_avg = average of fmd.usd values from most recent 135 blocks
flo.spotcost_btc_avg = average of flo.spotcost_btc values from most recent 135 blocks
flo.spotvalue_usd_avg = average of flo.spotcost_usd values from most recent 135 blocks
individual entries with the following fields for the most recent 135 blocks:
flo.spotcost_btc
flo.spotcost_usd
fmd.weighted
fmd.usd
URL_of_node_or_pool

Note: it might be a good idea to make the number of blocks an input variable rather than a hard coded 135. or perhaps even better, an "hours" variable that calculates the number of blocks in that period?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions