Commit for check average block time generation
This commit is contained in:
parent
2fe95f5e94
commit
59e328bf63
@ -142,6 +142,8 @@ try {
|
||||
result = Number(blockDetails.TotalDifficultyProgpow);
|
||||
else if(option == "totalcoins")
|
||||
result = 21000000 * 100000000;
|
||||
else if(option == "maxcoins")
|
||||
result = 21000000;
|
||||
else if(option == "average-blocktime")
|
||||
{
|
||||
let data = await averageblockdifficulty();
|
||||
|
@ -287,7 +287,7 @@ let currentReward = 16;
|
||||
let cuckoohashrate = await network_hashrate(block_height,31,targetdifficultycuckatoo);
|
||||
let progpowhashrate = await network_hashrate(block_height,16,targetdifficultyprogpow);
|
||||
let randomxhashrate = await network_hashrate(block_height,16,targetdifficultyrandomx);
|
||||
|
||||
let test = await avgBlockTime(block_height)
|
||||
return {
|
||||
block_height,
|
||||
letest_block,
|
||||
@ -371,6 +371,21 @@ const averageblockdifficulty = async() => {
|
||||
|
||||
|
||||
|
||||
async function avgBlockTime(height) {
|
||||
|
||||
const blockaveragetime = await getConnection(Global.network)
|
||||
.query(
|
||||
'SELECT coalesce(avg(bb.alter), 0) as alter, bb.timestamp FROM (SELECT EXTRACT(EPOCH FROM (timestamp - LAG(timestamp) OVER (ORDER BY timestamp))) AS alter FROM blockchain_block where height < 1145 AND height > 2154 ) as bb',
|
||||
)
|
||||
.catch(err_msg => {
|
||||
return(err_msg);
|
||||
});
|
||||
|
||||
console.log("_________________________________");
|
||||
console.log("Block Average time is ",blockaveragetime)
|
||||
}
|
||||
|
||||
|
||||
async function network_hashrate(height, edge_bits, difficulty) {
|
||||
let graph_wight = await graph_weight(height, edge_bits)
|
||||
return (42.0 * (difficulty / graph_wight) / 60.0);
|
||||
|
@ -31,6 +31,6 @@
|
||||
<div class="container">
|
||||
<h4 class="txt_primary">{{'api-view.Note' | translate}}</h4>
|
||||
<span>
|
||||
If you require another API, please request it by sending an email to <a href = {{angerstring}}> {{email}} </a></span>
|
||||
If you require another API, please request it by contacting an admin at <a href ="https://t.me/epiccash" > t.me/epiccash </a></span>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user