This commit is contained in:
Prema 2019-08-14 14:51:14 +05:30
commit 142b4ca714
15 changed files with 828 additions and 577 deletions

View File

@ -149,9 +149,9 @@ connection
});
const io = require("socket.io").listen(server);
io.sockets.on("connection", socket => {
setInterval(function() {
universalGetLatestBlockDetails(socket);
},1000);
// setInterval(function() {
// //universalGetLatestBlockDetails(socket);
// },1000);
});
})
.catch(error => {

View File

@ -707,7 +707,7 @@ export class BlockchainBlockController {
'SecondaryScaling',
'Proof',
],
where: { Height: paramVal },
where: { Height: paramVal },
});
}
if (!BlockchainBlockFetchQuery) {
@ -741,27 +741,64 @@ export class BlockchainBlockController {
// }
BlockchainBlockFetchQuery['TotalCuckoo']=parseInt(BlockchainBlockFetchQuery.TotalDifficultyCuckaroo) +
parseInt(BlockchainBlockFetchQuery.TotalDifficultyCuckatoo);
if (BlockchainBlockFetchQuery.Height <= 1440) {
BlockchainBlockFetchQuery['BlockReward'] = 200;
} else if (BlockchainBlockFetchQuery.Height <= 2880) {
BlockchainBlockFetchQuery['BlockReward'] = 180;
} else if (BlockchainBlockFetchQuery.Height <= 4320) {
BlockchainBlockFetchQuery['BlockReward'] = 160;
} else if (BlockchainBlockFetchQuery.Height <= 5760) {
BlockchainBlockFetchQuery['BlockReward'] = 140;
} else if (BlockchainBlockFetchQuery.Height <= 7200) {
BlockchainBlockFetchQuery['BlockReward'] = 120;
} else if (BlockchainBlockFetchQuery.Height <= 8640) {
BlockchainBlockFetchQuery['BlockReward'] = 100;
} else if (BlockchainBlockFetchQuery.Height <= 10080) {
BlockchainBlockFetchQuery['BlockReward'] = 80;
} else if (BlockchainBlockFetchQuery.Height <= 11520) {
BlockchainBlockFetchQuery['BlockReward'] = 60;
} else if (BlockchainBlockFetchQuery.Height <= 12960) {
BlockchainBlockFetchQuery['BlockReward'] = 50;
} else {
BlockchainBlockFetchQuery['BlockReward'] = 25;
}
var coin_existence;
let DAY_HEIGHT = 1440
/// Height of the first epic block emission era
const BLOCK_ERA_1 = DAY_HEIGHT * 334;
/// Height of the second epic block emission era
const BLOCK_ERA_2 = BLOCK_ERA_1 + (DAY_HEIGHT * 470);
/// Height of the third epic block emission era
const BLOCK_ERA_3 = BLOCK_ERA_2 + (DAY_HEIGHT * 601);
/// Height of the fourth epic block emission era
const BLOCK_ERA_4 = BLOCK_ERA_3 + (DAY_HEIGHT * 800);
/// Height of the fifth epic block emission era
const BLOCK_ERA_5 = BLOCK_ERA_4 + (DAY_HEIGHT * 1019);
/// After the epic block emission era 6, each era will last 4 years (approximately 1460 days)
const BLOCK_ERA_6_ONWARDS = DAY_HEIGHT * 1460;
/// Block Reward that will be assigned after we change from era 5 to era 6.
const BASE_REWARD_ERA_6_ONWARDS = 0.15625;
/// Compute the total reward generated by each block in a given height.
if(BlockchainBlockFetchQuery.Height == 0) {
BlockchainBlockFetchQuery['BlockReward'] = 0;
}else if (BlockchainBlockFetchQuery.Height <= BLOCK_ERA_1) {
BlockchainBlockFetchQuery['BlockReward'] = 16;
} else if (BlockchainBlockFetchQuery.Height <= BLOCK_ERA_2) {
BlockchainBlockFetchQuery['BlockReward'] = 8;
} else if (BlockchainBlockFetchQuery.Height <= BLOCK_ERA_3) {
BlockchainBlockFetchQuery['BlockReward'] = 4;
} else if (BlockchainBlockFetchQuery.Height <= BLOCK_ERA_4) {
BlockchainBlockFetchQuery['BlockReward'] = 2;
} else if (BlockchainBlockFetchQuery.Height <= BLOCK_ERA_5) {
BlockchainBlockFetchQuery['BlockReward'] = 1;
} else {
// After the era 6, we reduce the block rewards by half each 1460 days.
// Minus 1 to include multiples in the same index
// (i.e changes greater than to greater or equals to)
let height_with_offset = BlockchainBlockFetchQuery.Height - (BLOCK_ERA_5 - 1);
let exp = height_with_offset / BLOCK_ERA_6_ONWARDS;
BlockchainBlockFetchQuery['BlockReward'] = BASE_REWARD_ERA_6_ONWARDS / (1 << exp);
}
// if (BlockchainBlockFetchQuery.Height <= 1440) {
// BlockchainBlockFetchQuery['BlockReward'] = 200;
// } else if (BlockchainBlockFetchQuery.Height <= 2880) {
// BlockchainBlockFetchQuery['BlockReward'] = 180;
// } else if (BlockchainBlockFetchQuery.Height <= 4320) {
// BlockchainBlockFetchQuery['BlockReward'] = 160;
// } else if (BlockchainBlockFetchQuery.Height <= 5760) {
// BlockchainBlockFetchQuery['BlockReward'] = 140;
// } else if (BlockchainBlockFetchQuery.Height <= 7200) {
// BlockchainBlockFetchQuery['BlockReward'] = 120;
// } else if (BlockchainBlockFetchQuery.Height <= 8640) {
// BlockchainBlockFetchQuery['BlockReward'] = 100;
// } else if (BlockchainBlockFetchQuery.Height <= 10080) {
// BlockchainBlockFetchQuery['BlockReward'] = 80;
// } else if (BlockchainBlockFetchQuery.Height <= 11520) {
// BlockchainBlockFetchQuery['BlockReward'] = 60;
// } else if (BlockchainBlockFetchQuery.Height <= 12960) {
// BlockchainBlockFetchQuery['BlockReward'] = 50;
// } else {
// BlockchainBlockFetchQuery['BlockReward'] = 25;
// }
if (BlockchainBlockFetchQuery.PreviousId) {
const BlockchainPreviousBlockFetchQuery = await getRepository(
@ -1167,30 +1204,18 @@ export class BlockchainBlockController {
var dateFormat = 'YYYY-MM-DD HH:mm:ss';
var tickFormat = '%H-%M';
}
if(Difftype == "target"){
var TotalDifficultyNBlockQuery = await getConnection()
.query(
"SELECT a.hash, a.tarket_difficulty, a.date FROM(select 1 as hash, (total_difficulty_"+alog_type+" - LAG(total_difficulty_"+alog_type+") OVER (ORDER BY total_difficulty_"+alog_type+")) AS tarket_difficulty, \
DATE_TRUNC('minute', timestamp at time zone '" +
process.env.TIME_ZONE +
"') as date \
from blockchain_block where " +
timeIntervalQry +
" order by height) as a WHERE a.tarket_difficulty IS NOT NULL",
)
.catch(err_msg => {
next(err_msg);
});
}else if(Difftype == "solution"){
if(Difftype == "target"){
var TotalDifficultyNBlockQuery = await getConnection()
.query(
"SELECT a.hash, a.tarket_difficulty, a.date FROM(select 1 as hash, (total_difficulty_"+alog_type+" - LAG(total_difficulty_"+alog_type+") OVER (ORDER BY total_difficulty_"+alog_type+")) AS tarket_difficulty, \
"SELECT a.hash, a.total_difficulty_randomx, a.total_difficulty_cuckatoo,a.total_difficulty_progpow, a.date FROM(select 1 as hash, (total_difficulty_cuckatoo - LAG(total_difficulty_cuckatoo) OVER (ORDER BY total_difficulty_cuckatoo)) AS total_difficulty_cuckatoo, \
(total_difficulty_progpow - LAG(total_difficulty_progpow) OVER (ORDER BY total_difficulty_progpow)) AS total_difficulty_progpow , \
(total_difficulty_randomx - LAG(total_difficulty_randomx) OVER (ORDER BY total_difficulty_randomx)) AS total_difficulty_randomx, \
DATE_TRUNC('minute', timestamp at time zone '" +
process.env.TIME_ZONE +
"') as date \
from blockchain_block where " +
timeIntervalQry +
" order by height) as a WHERE a.tarket_difficulty IS NOT NULL",
" order by height) as a WHERE a.total_difficulty_randomx IS NOT NULL AND a.total_difficulty_progpow IS NOT NULL AND a.total_difficulty_cuckatoo IS NOT NULL AND a.total_difficulty_cuckatoo != '0' AND a.total_difficulty_randomx != '0' AND a.total_difficulty_progpow != '0'",
)
.catch(err_msg => {
next(err_msg);
@ -1198,7 +1223,7 @@ export class BlockchainBlockController {
}else if(Difftype == "total"){
var TotalDifficultyNBlockQuery = await getConnection()
.query(
"select 1 as hash, total_difficulty_"+alog_type+" as tarket_difficulty, \
"select 1 as hash, total_difficulty_cuckatoo,total_difficulty_progpow,total_difficulty_randomx, \
DATE_TRUNC('minute', timestamp at time zone '" +
process.env.TIME_ZONE +
"') as date \
@ -1209,45 +1234,71 @@ export class BlockchainBlockController {
.catch(err_msg => {
next(err_msg);
});
}else{
var TotalDifficultyNBlockQuery = await getConnection()
.query(
"SELECT a.hash, a.tarket_difficulty, a.date FROM(select 1 as hash, (total_difficulty_"+alog_type+" - LAG(total_difficulty_"+alog_type+") OVER (ORDER BY total_difficulty_"+alog_type+")) AS tarket_difficulty, \
DATE_TRUNC('minute', timestamp at time zone '" +
process.env.TIME_ZONE +
"') as date \
from blockchain_block where " +
timeIntervalQry +
" order by height) as a WHERE a.tarket_difficulty IS NOT NULL",
)
.catch(err_msg => {
next(err_msg);
});
}
let date = [],
//DifficultyCuckaroo = [],
//DifficultyCuckatoo = [],
//DifficultyProgpow = [],
//DifficultyRandomx = [];
// let date = [],
// DifficultyCuckatoo = [],
// DifficultyProgpow = [],
// DifficultyRandomx = [];
TargetDifficulty = [];
TotalDifficultyNBlockQuery.forEach(e => {
//date.indexOf(moment(e.date).format('YYYY-MM-DD')) < 0 ?
date.push(moment(e.date).format(dateFormat));
// DifficultyCuckaroo.push(parseInt(e.total_difficulty_cuckaroo));
// DifficultyCuckatoo.push(parseInt(e.total_difficulty_cuckatoo));
// DifficultyProgpow.push(parseInt(e.total_difficulty_progpow));
// DifficultyRandomx.push(parseInt(e.total_difficulty_randomx));
TargetDifficulty.push(parseInt(e.tarket_difficulty));
var DifficultyCuckatoo = TotalDifficultyNBlockQuery.map(function (e) {
return parseInt(e.total_difficulty_cuckatoo);
});
var Maxrange = Math.max.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.tarket_difficulty; }));
var Minrange = Math.min.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.tarket_difficulty; }));
if(Minrange != 0){
Minrange = (Minrange - (Minrange * 0.2));
}
Maxrange = (Maxrange + (Maxrange * 0.2));
var DifficultyProgpow = TotalDifficultyNBlockQuery.map(function (e) {
return parseInt(e.total_difficulty_progpow);
});
var DifficultyRandomx = TotalDifficultyNBlockQuery.map(function (e) {
return parseInt(e.total_difficulty_randomx);
});
var date = TotalDifficultyNBlockQuery.map(function (e) {
return moment(e.date).format(dateFormat);
});
// TotalDifficultyNBlockQuery.forEach(e => {
// date.push(moment(e.date).format(dateFormat));
// DifficultyCuckatoo.push(parseInt(e.total_difficulty_cuckatoo));
// DifficultyProgpow.push(parseInt(e.total_difficulty_progpow));
// DifficultyRandomx.push(parseInt(e.total_difficulty_randomx));
// });
// var Maxrange;
// var Minrange;
// if(alog_type == "cuckatoo"){
// Maxrange = Math.max.apply(Math, DifficultyCuckatoo);
// Minrange = Math.min.apply(Math, DifficultyCuckatoo);
// if(Minrange != 0){
// Minrange = (Minrange - (Minrange * 0.2));
// }
// Maxrange = (Maxrange + (Maxrange * 0.2));
// }else if(alog_type == "progpow"){
// Maxrange = Math.max.apply(Math, DifficultyProgpow);
// Minrange = Math.min.apply(Math, DifficultyProgpow);
// if(Minrange != 0){
// Minrange = (Minrange - (Minrange * 0.2));
// }
// Maxrange = (Maxrange + (Maxrange * 0.2));
// }else if(alog_type == "randomx"){
// Maxrange = Math.max.apply(Math, DifficultyRandomx);
// Minrange = Math.min.apply(Math, DifficultyRandomx);
// if(Minrange != 0){
// Minrange = (Minrange - (Minrange * 0.2));
// }
// Maxrange = (Maxrange + (Maxrange * 0.2));
// }else{
// var Maxrange1 = Math.max.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_cuckatoo; }));
// var Minrange1 = Math.min.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_cuckatoo; }));
// var Maxrange2 = Math.max.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_progpow; }));
// var Minrange2 = Math.min.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_progpow; }));
// var Maxrange3 = Math.max.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_randomx; }));
// var Minrange3 = Math.min.apply(Math, TotalDifficultyNBlockQuery.map(function(o) { return o.total_difficulty_randomx; }));
// Maxrange = Math.max(Maxrange1, Maxrange2, Maxrange3);
// Minrange = Math.min(Minrange1, Minrange2, Minrange3);
// if(Minrange != 0){
// Minrange = (Minrange - (Minrange * 0.2));
// }
// Maxrange = (Maxrange + (Maxrange * 0.2));
// }
// Minrange = parseInt(Minrange);
// var Minrange2 = parseInt(Minrange * 0.3);
@ -1257,12 +1308,11 @@ export class BlockchainBlockController {
message: 'Difficulty and Blocks Data fetched Successfully',
response: {
Date: date,
// DifficultyCuckaroo: DifficultyCuckaroo,
// DifficultyCuckatoo: DifficultyCuckatoo,
// DifficultyProgpow: DifficultyProgpow,
Maxrange: Maxrange,
Minrange: Minrange,
TargetDifficulty: TargetDifficulty,
DifficultyCuckatoo: DifficultyCuckatoo,
DifficultyRandomx: DifficultyRandomx,
DifficultyProgpow: DifficultyProgpow,
//Maxrange: Maxrange,
//Minrange: Minrange,
tickFormat: tickFormat
},
});
@ -1552,83 +1602,128 @@ export class BlockchainBlockController {
});
let height = BlockchainLatestBlockQuery[0].height;
var coin_existence;
// if (height > 12960) {
// var remain_block = height - 12960;
// var coin_existence =
// 1440 * 200 +
// 1440 * 180 +
// 1440 * 160 +
// 1440 * 140 +
// 1440 * 120 +
// 1440 * 100 +
// 1440 * 80 +
// 1440 * 60 +
// 1440 * 50 +
// 25 * remain_block;
// } else if (height > 11520) {
// var remain_block = height - 11520;
// var coin_existence =
// 1440 * 200 +
// 1440 * 180 +
// 1440 * 160 +
// 1440 * 140 +
// 1440 * 120 +
// 1440 * 100 +
// 1440 * 80 +
// 1440 * 60 +
// remain_block * 50;
// } else if (height > 10080) {
// var remain_block = height - 10080;
// var coin_existence =
// 1440 * 200 +
// 1440 * 180 +
// 1440 * 160 +
// 1440 * 140 +
// 1440 * 120 +
// 1440 * 100 +
// 1440 * 80 +
// remain_block * 60;
// } else if (height > 8640) {
// var remain_block = height - 8640;
// var coin_existence =
// 1440 * 200 +
// 1440 * 180 +
// 1440 * 160 +
// 1440 * 140 +
// 1440 * 120 +
// 1440 * 100 +
// remain_block * 80;
// } else if (height > 7200) {
// var remain_block = height - 7200;
// var coin_existence =
// 1440 * 200 +
// 1440 * 180 +
// 1440 * 160 +
// 1440 * 140 +
// 1440 * 120 +
// remain_block * 100;
// } else if (height > 5760) {
// var remain_block = height - 5760;
// var coin_existence =
// 1440 * 200 +
// 1440 * 180 +
// 1440 * 160 +
// 1440 * 140 +
// remain_block * 120;
// } else if (height > 4320) {
// var remain_block = height - 4320;
// var coin_existence =
// 1440 * 200 + 1440 * 180 + 1440 * 160 + remain_block * 140;
// } else if (height > 2880) {
// var remain_block = height - 2880;
// var coin_existence = 1440 * 200 + 1440 * 180 + remain_block * 160;
// } else if (height > 1440) {
// var remain_block = height - 1440;
// var coin_existence = 1440 * 200 + remain_block * 180;
// } else {
// var coin_existence = height * 200;
// }
if (height > 12960) {
var remain_block = height - 12960;
var coin_existence =
1440 * 200 +
1440 * 180 +
1440 * 160 +
1440 * 140 +
1440 * 120 +
1440 * 100 +
1440 * 80 +
1440 * 60 +
1440 * 50 +
25 * remain_block;
} else if (height > 11520) {
var remain_block = height - 11520;
var coin_existence =
1440 * 200 +
1440 * 180 +
1440 * 160 +
1440 * 140 +
1440 * 120 +
1440 * 100 +
1440 * 80 +
1440 * 60 +
remain_block * 50;
} else if (height > 10080) {
var remain_block = height - 10080;
var coin_existence =
1440 * 200 +
1440 * 180 +
1440 * 160 +
1440 * 140 +
1440 * 120 +
1440 * 100 +
1440 * 80 +
remain_block * 60;
} else if (height > 8640) {
var remain_block = height - 8640;
var coin_existence =
1440 * 200 +
1440 * 180 +
1440 * 160 +
1440 * 140 +
1440 * 120 +
1440 * 100 +
remain_block * 80;
} else if (height > 7200) {
var remain_block = height - 7200;
var coin_existence =
1440 * 200 +
1440 * 180 +
1440 * 160 +
1440 * 140 +
1440 * 120 +
remain_block * 100;
} else if (height > 5760) {
var remain_block = height - 5760;
var coin_existence =
1440 * 200 +
1440 * 180 +
1440 * 160 +
1440 * 140 +
remain_block * 120;
} else if (height > 4320) {
var remain_block = height - 4320;
var coin_existence =
1440 * 200 + 1440 * 180 + 1440 * 160 + remain_block * 140;
} else if (height > 2880) {
var remain_block = height - 2880;
var coin_existence = 1440 * 200 + 1440 * 180 + remain_block * 160;
} else if (height > 1440) {
var remain_block = height - 1440;
var coin_existence = 1440 * 200 + remain_block * 180;
} else {
var coin_existence = height * 200;
}
let DAY_HEIGHT = 1440
/// Height of the first epic block emission era
const BLOCK_ERA_1 = DAY_HEIGHT * 334;
/// Height of the second epic block emission era
const BLOCK_ERA_2 = BLOCK_ERA_1 + (DAY_HEIGHT * 470);
/// Height of the third epic block emission era
const BLOCK_ERA_3 = BLOCK_ERA_2 + (DAY_HEIGHT * 601);
/// Height of the fourth epic block emission era
const BLOCK_ERA_4 = BLOCK_ERA_3 + (DAY_HEIGHT * 800);
/// Height of the fifth epic block emission era
const BLOCK_ERA_5 = BLOCK_ERA_4 + (DAY_HEIGHT * 1019);
/// After the epic block emission era 6, each era will last 4 years (approximately 1460 days)
const BLOCK_ERA_6_ONWARDS = DAY_HEIGHT * 1460;
/// Block Reward that will be assigned after we change from era 5 to era 6.
const BASE_REWARD_ERA_6_ONWARDS = 0.15625;
let remaining_height = 0;
/// Compute the total reward generated by each block in a given height.
if (height <= BLOCK_ERA_1) {
coin_existence = height * 16;
} else if (height <= BLOCK_ERA_2) {
remaining_height = height - BLOCK_ERA_1;
coin_existence = (16 * BLOCK_ERA_1) + 8 * remaining_height;
} else if (height <= BLOCK_ERA_3) {
remaining_height = height - BLOCK_ERA_2;
coin_existence = (16 * BLOCK_ERA_1) + (8 * BLOCK_ERA_2) + 4 * remaining_height;
} else if (height <= BLOCK_ERA_4) {
remaining_height = height - BLOCK_ERA_3;
coin_existence = (16 * BLOCK_ERA_1) + (8 * BLOCK_ERA_2) + (4 * BLOCK_ERA_3) + 2 * remaining_height;
} else if (height <= BLOCK_ERA_5) {
remaining_height = height - BLOCK_ERA_4;
coin_existence = (16 * BLOCK_ERA_1) + (8 * BLOCK_ERA_2) + (4 * BLOCK_ERA_3) + (2 * BLOCK_ERA_4) +1 * remaining_height;
} else {
// After the era 6, we reduce the block rewards by half each 1460 days.
// Minus 1 to include multiples in the same index
// (i.e changes greater than to greater or equals to)
let preious_circulation = (16 * BLOCK_ERA_1) + (8 * BLOCK_ERA_2) + (4 * BLOCK_ERA_3) + (2 * BLOCK_ERA_4) + (1 * BLOCK_ERA_5);
let height_with_offset = height - (BLOCK_ERA_5 - 1);
let exp = height_with_offset / BLOCK_ERA_6_ONWARDS;
let reward_emission = BASE_REWARD_ERA_6_ONWARDS / (1 << exp);
coin_existence = preious_circulation + reward_emission ;
}
letest_block = this.dateDiff(BlockchainLatestBlockQuery[0].timestamp,true);
letest_block_num = letest_block; // "72"
@ -1790,23 +1885,34 @@ export class BlockchainBlockController {
} else {
var timeIntervalQry = "timestamp > current_date - interval '30 days'";
}
let DAY_HEIGHT = 1440
/// Height of the first epic block emission era
const BLOCK_ERA_1 = DAY_HEIGHT * 334;
/// Height of the second epic block emission era
const BLOCK_ERA_2 = BLOCK_ERA_1 + (DAY_HEIGHT * 470);
/// Height of the third epic block emission era
const BLOCK_ERA_3 = BLOCK_ERA_2 + (DAY_HEIGHT * 601);
/// Height of the fourth epic block emission era
const BLOCK_ERA_4 = BLOCK_ERA_3 + (DAY_HEIGHT * 800);
/// Height of the fifth epic block emission era
const BLOCK_ERA_5 = BLOCK_ERA_4 + (DAY_HEIGHT * 1019);
/// After the epic block emission era 6, each era will last 4 years (approximately 1460 days)
const BLOCK_ERA_6_ONWARDS = DAY_HEIGHT * 1460;
/// Block Reward that will be assigned after we change from era 5 to era 6.
const BASE_REWARD_ERA_6_ONWARDS = 0.15625;
const BlockchainBlockPerSecondQuery = await getConnection()
.query(
'select x.timestamp, SUM(x.reward) as total_reward_per_day \
from (SELECT hash, height, CAST(timestamp AS DATE), \
from (SELECT DISTINCT height, hash, CAST(timestamp AS DATE), \
CASE \
WHEN height <= 1440 THEN 200 \
WHEN height <= 2880 THEN 180 \
WHEN height <= 4320 THEN 160 \
WHEN height <= 5760 THEN 140 \
WHEN height <= 7200 THEN 120 \
WHEN height <= 8640 THEN 100 \
WHEN height <= 10080 THEN 80 \
WHEN height <= 11520 THEN 60 \
WHEN height <= 12960 THEN 50 \
ELSE 25 \
WHEN height <= '+BLOCK_ERA_1+' THEN 16 \
WHEN height <= '+BLOCK_ERA_2+' THEN 8 \
WHEN height <= '+BLOCK_ERA_3+' THEN 4 \
WHEN height <= '+BLOCK_ERA_4+' THEN 2 \
WHEN height <= '+BLOCK_ERA_5+' THEN 1 \
ELSE '+BASE_REWARD_ERA_6_ONWARDS+' / (1 << ((height - ('+BLOCK_ERA_5+'- 1))/'+BLOCK_ERA_6_ONWARDS+'))\
END AS reward \
FROM blockchain_block where ' +
FROM blockchain_block where height > 0 AND ' +
timeIntervalQry +
') as x group by x.timestamp Order by x.timestamp ASC',
)
@ -1814,6 +1920,28 @@ export class BlockchainBlockController {
next(err_msg);
});
/// Compute the total reward generated by each block in a given height.
// if (BlockchainBlockFetchQuery.Height <= BLOCK_ERA_1) {
// BlockchainBlockFetchQuery['BlockReward'] = 16;
// } else if (BlockchainBlockFetchQuery.Height <= BLOCK_ERA_2) {
// BlockchainBlockFetchQuery['BlockReward'] = 8;
// } else if (BlockchainBlockFetchQuery.Height <= BLOCK_ERA_3) {
// BlockchainBlockFetchQuery['BlockReward'] = 4;
// } else if (BlockchainBlockFetchQuery.Height <= BLOCK_ERA_4) {
// BlockchainBlockFetchQuery['BlockReward'] = 2;
// } else if (BlockchainBlockFetchQuery.Height <= BLOCK_ERA_5) {
// BlockchainBlockFetchQuery['BlockReward'] = 1;
// } else {
// // After the era 6, we reduce the block rewards by half each 1460 days.
// // Minus 1 to include multiples in the same index
// // (i.e changes greater than to greater or equals to)
// let height_with_offset = BlockchainBlockFetchQuery.Height - (BLOCK_ERA_5 - 1);
// let exp = height_with_offset / BLOCK_ERA_6_ONWARDS;
// BlockchainBlockFetchQuery['BlockReward'] = BASE_REWARD_ERA_6_ONWARDS / (1 << exp);
// }
let date = [],
total_reward_per_day = [],
addedreward = [],

View File

@ -516,7 +516,7 @@ export class BlockchainKernelController {
) => {
var self = this;
try {
http.get('http://116.203.152.58:3413/v1/peers/connected',
http.get('http://116.203.152.58:13413/v1/peers/connected',
async (resp) => {
// console.log('resp resp respresp',resp);
let data = '';

View File

@ -17,6 +17,7 @@
"EXPLORE_IT": "Entdecke",
"VIEWALL": "Alle Diagramme anzeigen",
"BLOCKCHAIN_HEIGHT": "Blockchain Höhe",
"LATEST_BLOCKS" : "Letzter Blocks",
"LATEST_BLOCK": "Letzter Block",
"LATEST_BLOCK1": "Aktuelle Zielschwierigkeit",
"LATEST_BLOCK2": "Aktuelle Gesamtschwierigkeit",

View File

@ -17,6 +17,7 @@
"EXPLORE_IT": "Explore",
"VIEWALL": "View All Charts",
"BLOCKCHAIN_HEIGHT": "Blockchain Height",
"LATEST_BLOCKS" : "Latest Blocks",
"LATEST_BLOCK": "Latest Block",
"LATEST_BLOCK1": "Current Target Difficulty",
"LATEST_BLOCK2": "Current Total Difficulty",

View File

@ -3,20 +3,20 @@ import { getConnection } from "typeorm";
var moment = require("moment");
moment.updateLocale('en', {
relativeTime: {
future: "in %s",
past: "%s ago",
s: "seconds",
m: "1 minute",
mm: "%d minutes",
h: "1 hour",
hh: "%d hours",
d: "1 day",
dd: "%d days",
M: "1 month",
MM: "%d months",
y: "1 year",
yy: "%d years"
}
future: "in %s",
past: "%s ago",
s: "seconds",
m: "1 minute",
mm: "%d minutes",
h: "1 hour",
hh: "%d hours",
d: "1 day",
dd: "%d days",
M: "1 month",
MM: "%d months",
y: "1 year",
yy: "%d years"
}
});
function dateDiff(date2, insec = false) {
@ -29,7 +29,7 @@ function dateDiff(date2, insec = false) {
var enddayrnd = Math.round(enddaydif);
// if(enddayrnd < 1) {
var time = convertMinsToHrmin(
Math.abs(date2.getTime() - current_date.getTime()),insec
Math.abs(date2.getTime() - current_date.getTime()), insec
);
return time;
// } else if(enddayrnd == 1) {
@ -40,9 +40,9 @@ function dateDiff(date2, insec = false) {
}
function convertMinsToHrmin(millseconds,insec) {
function convertMinsToHrmin(millseconds, insec) {
var seconds = Math.floor(millseconds / 1000);
if(insec){
if (insec) {
let sec = Math.floor(millseconds / 1000);
return sec;
}
@ -81,84 +81,129 @@ export async function universalGetLatestBlockDetails(socket) {
"SELECT bb.timestamp,bb.proof,bb.height,bb.edge_bits,bb.hash,bb.secondary_scaling, bb.previous_id, bb.total_difficulty_cuckaroo, bb.total_difficulty_cuckatoo, bb.total_difficulty_progpow, bb.total_difficulty_randomx, COUNT(DISTINCT(bi.block_id)) AS input_count, COUNT(DISTINCT(bk.block_id)) AS kernel_count, COUNT(DISTINCT(bo.block_id)) AS output_count FROM blockchain_block bb LEFT JOIN blockchain_input bi ON bi.block_id = bb.hash LEFT JOIN blockchain_kernel bk ON bk.block_id = bb.hash LEFT JOIN blockchain_output bo ON bo.block_id = bb.hash group by bb.hash, bb.timestamp ORDER BY bb.timestamp DESC LIMIT 1");
const BlockchainPreviousBlockQuery = await getConnection().query(
"SELECT total_difficulty_cuckaroo, total_difficulty_cuckatoo, total_difficulty_progpow, total_difficulty_randomx FROM blockchain_block WHERE hash=" +
"'" +
BlockchainLatestBlockQuery[0].previous_id +
"'"
"'" +
BlockchainLatestBlockQuery[0].previous_id +
"'"
);
let height = BlockchainLatestBlockQuery[0].height;
if (height > 12960) {
var remain_block = height - 12960;
var coin_existence =
1440 * 200 +
1440 * 180 +
1440 * 160 +
1440 * 140 +
1440 * 120 +
1440 * 100 +
1440 * 80 +
1440 * 60 +
1440 * 50 +
25 * remain_block;
} else if (height > 11520) {
var remain_block = height - 11520;
var coin_existence =
1440 * 200 +
1440 * 180 +
1440 * 160 +
1440 * 140 +
1440 * 120 +
1440 * 100 +
1440 * 80 +
1440 * 60 +
remain_block * 50;
} else if (height > 10080) {
var remain_block = height - 10080;
var coin_existence =
1440 * 200 +
1440 * 180 +
1440 * 160 +
1440 * 140 +
1440 * 120 +
1440 * 100 +
1440 * 80 +
remain_block * 60;
} else if (height > 8640) {
var remain_block = height - 8640;
var coin_existence =
1440 * 200 +
1440 * 180 +
1440 * 160 +
1440 * 140 +
1440 * 120 +
1440 * 100 +
remain_block * 80;
} else if (height > 7200) {
var remain_block = height - 7200;
var coin_existence =
1440 * 200 +
1440 * 180 +
1440 * 160 +
1440 * 140 +
1440 * 120 +
remain_block * 100;
} else if (height > 5760) {
var remain_block = height - 5760;
var coin_existence =
1440 * 200 + 1440 * 180 + 1440 * 160 + 1440 * 140 + remain_block * 120;
} else if (height > 4320) {
var remain_block = height - 4320;
var coin_existence =
1440 * 200 + 1440 * 180 + 1440 * 160 + remain_block * 140;
} else if (height > 2880) {
var remain_block = height - 2880;
var coin_existence = 1440 * 200 + 1440 * 180 + remain_block * 160;
} else if (height > 1440) {
var remain_block = height - 1440;
var coin_existence = 1440 * 200 + remain_block * 180;
} else {
var coin_existence = height * 200;
}
// if (height > 12960) {
// var remain_block = height - 12960;
// var coin_existence =
// 1440 * 200 +
// 1440 * 180 +
// 1440 * 160 +
// 1440 * 140 +
// 1440 * 120 +
// 1440 * 100 +
// 1440 * 80 +
// 1440 * 60 +
// 1440 * 50 +
// 25 * remain_block;
// } else if (height > 11520) {
// var remain_block = height - 11520;
// var coin_existence =
// 1440 * 200 +
// 1440 * 180 +
// 1440 * 160 +
// 1440 * 140 +
// 1440 * 120 +
// 1440 * 100 +
// 1440 * 80 +
// 1440 * 60 +
// remain_block * 50;
// } else if (height > 10080) {
// var remain_block = height - 10080;
// var coin_existence =
// 1440 * 200 +
// 1440 * 180 +
// 1440 * 160 +
// 1440 * 140 +
// 1440 * 120 +
// 1440 * 100 +
// 1440 * 80 +
// remain_block * 60;
// } else if (height > 8640) {
// var remain_block = height - 8640;
// var coin_existence =
// 1440 * 200 +
// 1440 * 180 +
// 1440 * 160 +
// 1440 * 140 +
// 1440 * 120 +
// 1440 * 100 +
// remain_block * 80;
// } else if (height > 7200) {
// var remain_block = height - 7200;
// var coin_existence =
// 1440 * 200 +
// 1440 * 180 +
// 1440 * 160 +
// 1440 * 140 +
// 1440 * 120 +
// remain_block * 100;
// } else if (height > 5760) {
// var remain_block = height - 5760;
// var coin_existence =
// 1440 * 200 + 1440 * 180 + 1440 * 160 + 1440 * 140 + remain_block * 120;
// } else if (height > 4320) {
// var remain_block = height - 4320;
// var coin_existence =
// 1440 * 200 + 1440 * 180 + 1440 * 160 + remain_block * 140;
// } else if (height > 2880) {
// var remain_block = height - 2880;
// var coin_existence = 1440 * 200 + 1440 * 180 + remain_block * 160;
// } else if (height > 1440) {
// var remain_block = height - 1440;
// var coin_existence = 1440 * 200 + remain_block * 180;
// } else {
// var coin_existence = height * 200;
// }
var coin_existence;
let DAY_HEIGHT = 1440
/// Height of the first epic block emission era
const BLOCK_ERA_1 = DAY_HEIGHT * 334;
/// Height of the second epic block emission era
const BLOCK_ERA_2 = BLOCK_ERA_1 + (DAY_HEIGHT * 470);
/// Height of the third epic block emission era
const BLOCK_ERA_3 = BLOCK_ERA_2 + (DAY_HEIGHT * 601);
/// Height of the fourth epic block emission era
const BLOCK_ERA_4 = BLOCK_ERA_3 + (DAY_HEIGHT * 800);
/// Height of the fifth epic block emission era
const BLOCK_ERA_5 = BLOCK_ERA_4 + (DAY_HEIGHT * 1019);
/// After the epic block emission era 6, each era will last 4 years (approximately 1460 days)
const BLOCK_ERA_6_ONWARDS = DAY_HEIGHT * 1460;
/// Block Reward that will be assigned after we change from era 5 to era 6.
const BASE_REWARD_ERA_6_ONWARDS = 0.15625;
let remaining_height = 0;
/// Compute the total reward generated by each block in a given height.
if (height <= BLOCK_ERA_1) {
coin_existence = height * 16;
} else if (height <= BLOCK_ERA_2) {
remaining_height = height - BLOCK_ERA_1;
coin_existence = (16 * BLOCK_ERA_1) + 8 * remaining_height;
} else if (height <= BLOCK_ERA_3) {
remaining_height = height - BLOCK_ERA_2;
coin_existence = (16 * BLOCK_ERA_1) + (8 * BLOCK_ERA_2) + 4 * remaining_height;
} else if (height <= BLOCK_ERA_4) {
remaining_height = height - BLOCK_ERA_3;
coin_existence = (16 * BLOCK_ERA_1) + (8 * BLOCK_ERA_2) + (4 * BLOCK_ERA_3) + 2 * remaining_height;
} else if (height <= BLOCK_ERA_5) {
remaining_height = height - BLOCK_ERA_4;
coin_existence = (16 * BLOCK_ERA_1) + (8 * BLOCK_ERA_2) + (4 * BLOCK_ERA_3) + (2 * BLOCK_ERA_4) +1 * remaining_height;
} else {
// After the era 6, we reduce the block rewards by half each 1460 days.
// Minus 1 to include multiples in the same index
// (i.e changes greater than to greater or equals to)
let preious_circulation = (16 * BLOCK_ERA_1) + (8 * BLOCK_ERA_2) + (4 * BLOCK_ERA_3) + (2 * BLOCK_ERA_4) + (1 * BLOCK_ERA_5);
let height_with_offset = height - (BLOCK_ERA_5 - 1);
let exp = height_with_offset / BLOCK_ERA_6_ONWARDS;
let reward_emission = BASE_REWARD_ERA_6_ONWARDS / (1 << exp);
coin_existence = preious_circulation + reward_emission ;
}
letest_block = dateDiff(BlockchainLatestBlockQuery[0].timestamp, true);
letest_block_num = letest_block // "72"
@ -200,11 +245,11 @@ export async function universalGetLatestBlockDetails(socket) {
BlockchainPreviousBlockQuery[0].total_difficulty_randomx;
}
if(BlockchainLatestBlockQuery[0].proof == "RandomX"){
var Difficulty = targetdifficultyrandomx;
}else if(BlockchainLatestBlockQuery[0].proof == "ProgPow"){
if (BlockchainLatestBlockQuery[0].proof == "RandomX") {
var Difficulty = targetdifficultyrandomx;
} else if (BlockchainLatestBlockQuery[0].proof == "ProgPow") {
var Difficulty = targetdifficultyprogpow;
}else if(BlockchainLatestBlockQuery[0].proof == "Cuckoo" ){
} else if (BlockchainLatestBlockQuery[0].proof == "Cuckoo") {
var Difficulty = targetdifficultycuckatoo;
}
@ -214,9 +259,9 @@ export async function universalGetLatestBlockDetails(socket) {
var TotalCuckoo =
parseInt(BlockchainLatestBlockQuery[0].total_difficulty_cuckatoo) +
parseInt(BlockchainLatestBlockQuery[0].total_difficulty_cuckaroo);
let balance = BlockchainLatestBlockQuery[0].hash.substring(2, 62);
let arr = balance.match(/.{1,6}/g);
var hasharray = arr.map(i => '#' + i);
let balance = BlockchainLatestBlockQuery[0].hash.substring(2, 62);
let arr = balance.match(/.{1,6}/g);
var hasharray = arr.map(i => '#' + i);
socket.emit("latestblockdetail", {
block_height,
@ -230,7 +275,7 @@ export async function universalGetLatestBlockDetails(socket) {
targetdifficultyprogpow,
targetdifficultyrandomx,
TotalCuckoo,
age : dateTimeDurationString,
age: dateTimeDurationString,
input_count: BlockchainLatestBlockQuery[0].input_count,
kernel_count: BlockchainLatestBlockQuery[0].kernel_count,
output_count: BlockchainLatestBlockQuery[0].output_count,
@ -238,8 +283,8 @@ export async function universalGetLatestBlockDetails(socket) {
proof: BlockchainLatestBlockQuery[0].proof,
hasharray: hasharray,
Difficulty: Difficulty,
hashstart:BlockchainLatestBlockQuery[0].hash.slice(0, 2),
hashend:BlockchainLatestBlockQuery[0].hash.slice(62,64),
hashstart: BlockchainLatestBlockQuery[0].hash.slice(0, 2),
hashend: BlockchainLatestBlockQuery[0].hash.slice(62, 64),
TotalDifficultyCuckaroo:
BlockchainLatestBlockQuery[0].total_difficulty_cuckaroo,
TotalDifficultyCuckatoo:

View File

@ -44,19 +44,20 @@
<ul class="list-unstyled d-inline-block mb-0">
<li class="nav-item dropdown">
<a
class="nav-link dropdown-toggle bg-white"
id="navbarDropdown"
role="button"
data-toggle="dropdown"
aria-haspopup="true"
aria-expanded="false"
>
TestNet
</a>
class="nav-link dropdown-toggle bg-white"
id="navbarDropdown"
role="button"
data-toggle="dropdown"
aria-haspopup="true"
aria-expanded="false"
>
FlooNet
</a>
<div class="dropdown-menu net_dropdwn" aria-labelledby="navbarDropdown">
<a class="dropdown-item p-2 disabled" style="background-color: #00000024;" target = '_blank' href="#">MainNet</a
>
<a class="dropdown-item p-2 disabled" style="background-color: #00000024;" target = '_blank' href="#">TestNet</a
>
</div>
</li>
</ul>

View File

@ -13,10 +13,12 @@
<a class="nav-link dropdown-toggle bg-white" href="#" id="navbarDropdown" role="button"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
TestNet
FlooNet
</a>
<div class="dropdown-menu net_dropdwn" aria-labelledby="navbarDropdown">
<a class="dropdown-item p-2 disabled" href="https://explorer2.epic.tech">MainNet</a>
<a class="dropdown-item p-2 disabled" href="#">TestNet</a>
<a class="dropdown-item p-2 disabled" href="#">MainNet</a>
</div>
</li>
</ul>
@ -64,10 +66,12 @@
<a class="nav-link dropdown-toggle bg-white" href="#" id="navbarDropdown" role="button"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
TestNet
FlooNet
</a>
<div class="dropdown-menu net_dropdwn" aria-labelledby="navbarDropdown">
<a class="dropdown-item p-2 disabled" href="https://explorer2.epic.tech">MainNet</a>
<a class="dropdown-item p-2 disabled" href="#">TestNet</a>
<a class="dropdown-item p-2 disabled" href="#">MainNet</a>
</div>
</li>
</ul>

View File

@ -68,8 +68,8 @@
<img src="assets/img/difficulty.png" height="60" />
</div>
<div class="d-inline-block align-middle ml-2">
<h6 class="">Target Difficulty<span class="view_txt">
{{(hashdata.BlockchainBlockFetchQuery.Proof == 'Cuckoo') ? (hashdata.BlockchainBlockFetchQuery.TargetDifficultyCuckatoo | number) : (hashdata.BlockchainBlockFetchQuery.Proof == 'RandomX') ? (hashdata.BlockchainBlockFetchQuery.TargetDifficultyRandomx | number) : (hashdata.BlockchainBlockFetchQuery.Proof == 'ProgPow') ? (hashdata.BlockchainBlockFetchQuery.TargetDifficultyProgpow | number) : 0}}</span></h6>
<!-- <h6 class="">Target Difficulty<span class="view_txt">
{{(hashdata.BlockchainBlockFetchQuery.Proof == 'Cuckoo') ? (hashdata.BlockchainBlockFetchQuery.TargetDifficultyCuckatoo | number) : (hashdata.BlockchainBlockFetchQuery.Proof == 'RandomX') ? (hashdata.BlockchainBlockFetchQuery.TargetDifficultyRandomx | number) : (hashdata.BlockchainBlockFetchQuery.Proof == 'ProgPow') ? (hashdata.BlockchainBlockFetchQuery.TargetDifficultyProgpow | number) : 0}}</span></h6> -->
<h6 class="">Total Difficulty<span class="view_txt">
{{(hashdata.BlockchainBlockFetchQuery.Proof == 'Cuckoo') ? (hashdata.BlockchainBlockFetchQuery.TotalDifficultyCuckatoo | number) : (hashdata.BlockchainBlockFetchQuery.Proof == 'RandomX') ? (hashdata.BlockchainBlockFetchQuery.TotalDifficultyRandomx | number) : (hashdata.BlockchainBlockFetchQuery.Proof == 'ProgPow') ? (hashdata.BlockchainBlockFetchQuery.TotalDifficultyProgpow | number) : 0}}</span></h6>
</div>

View File

@ -67,7 +67,10 @@
<h2 class="chart_heading text-uppercase d-inline-block">
{{chartType | translate}}</h2>
<div class="day_filter" *ngIf="this.title=='Target Difficulty'">
<!-- <div class="day_filter" *ngIf="this.title=='Target Difficulty'">
<a href="JavaScript:void(0);" (click)="
ChartFromView('', '', comp.difficultyRange,'all'); selectedItem12 = 4
" id="4" #item124 [ngClass]="{ active: selectedItem12 == item124.id, txt_primay: true }">All</a>
<a href="JavaScript:void(0);" (click)="
ChartFromView('', '', comp.difficultyRange,'cuckatoo'); selectedItem12 = 1
" id="1" #item121 [ngClass]="{ active: selectedItem12 == item121.id, txt_primay: true }">Cuckoo</a>
@ -79,7 +82,9 @@
" id="3" #item123 [ngClass]="{ active: selectedItem12 == item123.id, txt_primay: true }">RandomX</a>
</div>
<div class="day_filter" *ngIf="this.title=='Total Difficulty'">
<a href="JavaScript:void(0);" (click)="
<a href="JavaScript:void(0);" (click)="
ChartFromView('', '', comp.TdifficultyRange,'cuckatoo'); selectedItem12 = 4
" id="4" #item124 [ngClass]="{ active: selectedItem12 == item124.id, txt_primay: true }">All</a> <a href="JavaScript:void(0);" (click)="
ChartFromView('', '', comp.TdifficultyRange,'cuckatoo'); selectedItem12 = 1
" id="1" #item121 [ngClass]="{ active: selectedItem12 == item121.id, txt_primay: true }">Cuckoo</a>
<a href="JavaScript:void(0);" (click)="
@ -88,32 +93,32 @@
<a href="JavaScript:void(0);" (click)="
ChartFromView('', '', comp.TdifficultyRange,'randomx'); selectedItem12 = 3
" id="3" #item123 [ngClass]="{ active: selectedItem12 == item123.id, txt_primay: true }">RandomX</a>
</div>
</div> -->
<epic-explorer-plotly *ngIf="hashdata.data" [data]="hashdata.data" [layout]="hashdata.layout">
</epic-explorer-plotly>
<div class="day_filter" *ngIf="this.title!='Transactions over time'">
<a href="JavaScript:void(0);" *ngIf="this.title=='Total Difficulty' || this.title=='Target Difficulty' || this.title == 'Blocks'" (click)="
ChartFromView('', '', '1 day', comp.Type); selectedItem = 6; comp.difficultyRange = '1 day'
ChartFromView('', '', '1 day', comp.Type); selectedItem = 6; comp.difficultyRange = '1 day';comp.TdifficultyRange = '1 day'
" id="6" #item6 [ngClass]="{ active: selectedItem == item6.id, txt_primay: true }">1 Day</a>
<a href="JavaScript:void(0);" (click)="
ChartFromView('', '', '1 week', comp.Type); selectedItem = 1; comp.difficultyRange = '1 week'
ChartFromView('', '', '1 week', comp.Type); selectedItem = 1; comp.difficultyRange = '1 week';comp.TdifficultyRange = '1 week'
" id="1" #item1 [ngClass]="{ active: selectedItem == item1.id, txt_primay: true }">1
{{'home.WEEK' | translate}}</a>
<a href="JavaScript:void(0);" (click)="
ChartFromView('', '', '15 days', comp.Type); selectedItem = 2; comp.difficultyRange = '15 days'
ChartFromView('', '', '15 days', comp.Type); selectedItem = 2; comp.difficultyRange = '15 days';comp.TdifficultyRange = '15 days'
" id="2" #item2 [ngClass]="{ active: selectedItem == item2.id, day15_txt: true }">15
{{'home.DAYS' | translate}}</a>
<a href="JavaScript:void(0);" (click)="
ChartFromView('', '', '30 days', comp.Type); selectedItem = 3; comp.difficultyRange = '30 days'
ChartFromView('', '', '30 days', comp.Type); selectedItem = 3; comp.difficultyRange = '30 days';comp.TdifficultyRange = '30 days'
" id="3" #item3 [ngClass]="{ active: selectedItem == item3.id, day30_txt: true }">30
{{'home.DAYS' | translate}}</a>
<a href="JavaScript:void(0);" (click)="
ChartFromView('', '', '60 days', comp.Type); selectedItem = 4; comp.difficultyRange = '60 days'
ChartFromView('', '', '60 days', comp.Type); selectedItem = 4; comp.difficultyRange = '30 days';comp.TdifficultyRange = '30 days'
" id="4" #item4 [ngClass]="{ active: selectedItem == item4.id, day60_txt: true }">60
{{'home.DAYS' | translate}}</a>
<a href="JavaScript:void(0);" (click)="
ChartFromView('', '', '3 months', comp.Type); selectedItem = 5; comp.difficultyRange = '3 months'
ChartFromView('', '', '3 months', comp.Type); selectedItem = 5; comp.difficultyRange = '3 months';comp.TdifficultyRange = '3 months'
" id="5" #item5 [ngClass]="{ active: selectedItem == item5.id, day3m_txt: true }">3
{{'home.MONTHS' | translate}}</a>
</div>
@ -153,9 +158,7 @@
<h2 class="chart_heading mb-2 d-inline-block">{{'home.EXPLORE' | translate}}</h2>
<ul class="list-unstyled pl-3">
<li class="mb-1" *ngIf="this.title!='Target Difficulty'"><a
routerLink="/chart/target-difficulty">{{'target-difficulty' | translate}}</a></li>
<li class="mb-1" *ngIf="this.title!='Total Difficulty'"><a
routerLink="/chart/total-difficulty">{{'total-difficulty' | translate}}</a></li>
routerLink="/chart/target-difficulty">{{'target-difficulty' | translate}}</a></li>
<li class="mb-1" *ngIf="this.title!='Transactions over time'"><a
routerLink="/chart/transactions-over-time">{{'home.TRANSACTIONS_BY_TIME' | translate}}</a></li>
<li class="mb-1" *ngIf="this.title!='Blocks'"><a
@ -173,6 +176,8 @@
routerLink="/chart/transactions-by-date">{{'home.TRANSACTIONS_VS_DATE' | translate}}</a></li>
<li class="mb-1" *ngIf="this.title!='Stackbar Chart'"><a routerLink="/chart/blocks-by-algorithm">Blocks by Algorithm</a>
</li>
<li class="mb-1" *ngIf="this.title!='Total Difficulty'"><a
routerLink="/chart/total-difficulty">{{'total-difficulty' | translate}}</a></li>
<!-- <li class="mb-1" *ngIf="this.title!='Pie Chart'"><a routerLink="/chart/piechart">Pie Chart</a></li> -->
</ul>
</div>

View File

@ -23,7 +23,7 @@ export class GraphDetailComponent implements OnInit {
public chartType : any = [];
public selectedItem: Number = 3;
public selectedItem8: Number = 2;
public selectedItem12: Number = 1;
public selectedItem12: Number = 4;
public Type: any = '';
public selectedTarget: Number = 3;
public selectedTarget12: Number = 1;
@ -34,7 +34,6 @@ export class GraphDetailComponent implements OnInit {
public GraphtDate: any;
public GraphtHour: any;
public linearTotalGraphData: any = [];
public TdifficultyRange: any = '1 day';
constructor(
private route: ActivatedRoute,
@ -61,6 +60,8 @@ export class GraphDetailComponent implements OnInit {
this.hashdata = this.comp.linearTotalGraphData;
console.log('this.comp.linearTotalGraphData',this.comp.linearTotalGraphData);
this.hashdata.layout.height = 300;
this.hashdata.layout.xaxis.domain = [0.1,0.9];
this.hashdata.layout.yaxis2.position = 2.25;
this.title = 'Total Difficulty';
this.selectedItem = 6;
this.titleService.setTitle(
@ -75,6 +76,8 @@ export class GraphDetailComponent implements OnInit {
this.hashdata = this.comp.linearGraphData;
console.log('this.comp.linearGraphData',this.comp.linearGraphData);
this.hashdata.layout.height = 300;
this.hashdata.layout.xaxis.domain = [0.1,0.9];
this.hashdata.layout.yaxis2.position = 2.25;
this.title = 'Target Difficulty';
this.selectedItem = 6;
this.titleService.setTitle(
@ -223,6 +226,8 @@ export class GraphDetailComponent implements OnInit {
this.comp.Difficultyreq('target',p1, p2, p3, p4).then(res => {
this.hashdata = this.comp.linearGraphData;
this.hashdata.layout.height = 300;
this.hashdata.layout.xaxis.domain = [0.1,0.9];
this.hashdata.layout.yaxis2.position = 2.25;
this.title = 'Target Difficulty';
});
break;
@ -230,6 +235,8 @@ export class GraphDetailComponent implements OnInit {
this.comp.Difficultyreq('total',p1, p2, p3, p4).then(res => {
this.hashdata = this.comp.linearTotalGraphData;
this.hashdata.layout.height = 300;
this.hashdata.layout.xaxis.domain = [0.1,0.9];
this.hashdata.layout.yaxis2.position = 2.25;
this.title = 'Total Difficulty';
});
break;

View File

@ -8,7 +8,10 @@
}}</span> -->
<div class="chart_show">
<div class="difficulty_filter day_filter p-0 bg-transparent mt-2">
<!-- <div class="difficulty_filter day_filter p-0 bg-transparent mt-2">
<a href="JavaScript:void(0);" (click)="
Difficultyreq('target', '', '', difficultyRange,'all'); selectedItem12 = 4
" id="4" #item124 [ngClass]="{ active: selectedItem12 == item124.id, txt_primay: true }">All</a>
<a href="JavaScript:void(0);" (click)="
Difficultyreq('target', '', '', difficultyRange,'cuckatoo'); selectedItem12 = 1
" id="1" #item121 [ngClass]="{ active: selectedItem12 == item121.id, txt_primay: true }">Cuckoo</a>
@ -18,7 +21,7 @@
<a href="JavaScript:void(0);" (click)="
Difficultyreq('target', '', '', difficultyRange,'randomx'); selectedItem12 = 3
" id="3" #item123 [ngClass]="{ active: selectedItem12 == item123.id, txt_primay: true }">RandomX</a>
</div>
</div> -->
<epic-explorer-plotly *ngIf="linearGraphData.data" [data]="linearGraphData.data" [layout]="linearGraphData.layout">
</epic-explorer-plotly>
<div *ngIf="!linearGraphData.data" class="feedback_div news_desc text-center">
@ -35,7 +38,7 @@
</div>
</div>
</div>
<div class="day_filter diff_margin">
<div class="day_filter">
<a href="JavaScript:void(0);" (click)="
Difficultyreq('target', '', '', '1 day',''); selectedItem = 6; difficultyRange = '1 day'
" id="6" #item6 [ngClass]="{ active: selectedItem == item6.id, txt_primay: true }">1 day</a>
@ -63,79 +66,6 @@
</div>
</div>
</div>
<div class="col-md-6 col-lg-4 mb-4">
<div class="box_shadow">
<div class="blocks">
<h2 class="chart_heading d-inline-block">{{'home.TOTAL_DIFFICULTY' | translate}}</h2>
<!-- <span class="txn_count" *ngIf="this.lg_last.length > 0"><span *ngFor="let l of lg_last">{{
this.l | number</span>
}}</span> -->
<div class="chart_show">
<div class="difficulty_filter day_filter p-0 bg-transparent mt-2">
<a href="JavaScript:void(0);" (click)="
Difficultyreq('total', '', '', TdifficultyRange,'cuckatoo'); selectedTarget12 = 1
" id="1" #itemtarget121
[ngClass]="{ active: selectedTarget12 == itemtarget121.id, txt_primay: true }">Cuckoo</a>
<a href="JavaScript:void(0);" (click)="
Difficultyreq('total', '', '', TdifficultyRange,'progpow'); selectedTarget12 = 2
" id="2" #itemtarget122
[ngClass]="{ active: selectedTarget12 == itemtarget122.id, txt_primay: true }">ProgPow</a>
<a href="JavaScript:void(0);" (click)="
Difficultyreq('total', '', '', TdifficultyRange,'randomx'); selectedTarget12 = 3
" id="3" #itemtarget123
[ngClass]="{ active: selectedTarget12 == itemtarget123.id, txt_primay: true }">RandomX</a>
</div>
<epic-explorer-plotly *ngIf="linearTotalGraphData.data" [data]="linearTotalGraphData.data"
[layout]="linearTotalGraphData.layout">
</epic-explorer-plotly>
<div *ngIf="!linearTotalGraphData.data" class="feedback_div news_desc text-center">
<div class="graph_img background_loading mx-auto mb-3"></div>
<div class=" p-3 bg-white">
<p class="mb-2 background_loading para_load"></p>
<p class="mb-2 background_loading para_load"></p>
<p class="mb-2 background_loading para_load"></p>
<p class="mb-2 background_loading para_load"></p>
<p class="mb-2 background_loading para_load"></p>
<p class="mb-2 background_loading para_load"></p>
<p class="mb-2 background_loading para_load"></p>
</div>
</div>
</div>
</div>
<div class="day_filter diff_margin">
<a href="JavaScript:void(0);" (click)="
Difficultyreq('total', '', '', '1 day',''); selectedTarget = 6; TdifficultyRange = '1 day'
" id="6" #itemtarget6 [ngClass]="{ active: selectedTarget == itemtarget6.id, txt_primay: true }">1 day</a>
<a href="JavaScript:void(0);" (click)="
Difficultyreq('total', '', '', '1 week',''); selectedTarget = 1; TdifficultyRange = '1 week'
" id="1" #itemtarget1 [ngClass]="{ active: selectedTarget == itemtarget1.id, txt_primay: true }">1
{{'home.WEEK' | translate}}</a>
<!-- <a href="JavaScript:void(0);" (click)="
Difficultyreq('total', '', '', '15 days',''); selectedTarget = 2; TdifficultyRange = '15 days'
" id="2" #itemtarget2 [ngClass]="{ active: selectedTarget == itemtarget2.id, day15_txt: true }">15
{{'home.DAYS' | translate}}</a> -->
<a href="JavaScript:void(0);" (click)="
Difficultyreq('total', '', '', '30 days',''); selectedTarget = 3; TdifficultyRange = '30 days'
" id="3" #itemtarget3 [ngClass]="{ active: selectedTarget == itemtarget3.id, day30_txt: true }">30
{{'home.DAYS' | translate}}</a>
<a href="JavaScript:void(0);" (click)="
Difficultyreq('total', '', '', '60 days',''); selectedTarget = 4; TdifficultyRange = '60 days'
" id="4" #itemtarget4 [ngClass]="{ active: selectedTarget == itemtarget4.id, day60_txt: true }">60
{{'home.DAYS' | translate}}</a>
<a href="JavaScript:void(0);" (click)="
Difficultyreq('total', '', '', '3 months',''); selectedTarget = 5; TdifficultyRange = '3 months'
" id="5" #itemtarget5 [ngClass]="{ active: selectedTarget == itemtarget5.id, day3m_txt: true }">3
{{'home.MONTHS' | translate}}</a>
</div>
<div class="explore_all text-right">
<a routerLink="/chart/total-difficulty"><span class="text-uppercase">{{'home.EXPLORE_IT' | translate}} <i
class="fa fa-long-arrow-right"></i></span></a>
</div>
</div>
</div>
<div class="col-md-6 col-lg-4 mb-4">
<div class="box_shadow">
<div class="blocks">
@ -308,7 +238,7 @@
</div>
</div>
</div>
<div *ngIf="viewchartvar" class="col-md-6 col-lg-4 mb-4">
<div class="col-md-6 col-lg-4 mb-4">
<div class="box_shadow">
<div class="blocks">
<h2 class="chart_heading d-inline-block">{{'home.BLOCKS_MINED' | translate}}</h2>
@ -581,5 +511,81 @@
</div>
</div>
</div> -->
<div *ngIf="viewchartvar" class="col-md-6 col-lg-4 mb-4">
<div class="box_shadow">
<div class="blocks">
<h2 class="chart_heading d-inline-block">{{'home.TOTAL_DIFFICULTY' | translate}}</h2>
<!-- <span class="txn_count" *ngIf="this.lg_last.length > 0"><span *ngFor="let l of lg_last">{{
this.l | number</span>
}}</span> -->
<div class="chart_show">
<!-- <div class="difficulty_filter day_filter p-0 bg-transparent mt-2">
<a href="JavaScript:void(0);" (click)="
Difficultyreq('total', '', '', TdifficultyRange,'all'); selectedTarget12 = 4
" id="4" #itemtarget124
[ngClass]="{ active: selectedTarget12 == itemtarget124.id, txt_primay: true }">All</a>
<a href="JavaScript:void(0);" (click)="
Difficultyreq('total', '', '', TdifficultyRange,'cuckatoo'); selectedTarget12 = 1
" id="1" #itemtarget121
[ngClass]="{ active: selectedTarget12 == itemtarget121.id, txt_primay: true }">Cuckoo</a>
<a href="JavaScript:void(0);" (click)="
Difficultyreq('total', '', '', TdifficultyRange,'progpow'); selectedTarget12 = 2
" id="2" #itemtarget122
[ngClass]="{ active: selectedTarget12 == itemtarget122.id, txt_primay: true }">ProgPow</a>
<a href="JavaScript:void(0);" (click)="
Difficultyreq('total', '', '', TdifficultyRange,'randomx'); selectedTarget12 = 3
" id="3" #itemtarget123
[ngClass]="{ active: selectedTarget12 == itemtarget123.id, txt_primay: true }">RandomX</a>
</div> -->
<epic-explorer-plotly *ngIf="linearTotalGraphData.data" [data]="linearTotalGraphData.data"
[layout]="linearTotalGraphData.layout">
</epic-explorer-plotly>
<div *ngIf="!linearTotalGraphData.data" class="feedback_div news_desc text-center">
<div class="graph_img background_loading mx-auto mb-3"></div>
<div class=" p-3 bg-white">
<p class="mb-2 background_loading para_load"></p>
<p class="mb-2 background_loading para_load"></p>
<p class="mb-2 background_loading para_load"></p>
<p class="mb-2 background_loading para_load"></p>
<p class="mb-2 background_loading para_load"></p>
<p class="mb-2 background_loading para_load"></p>
<p class="mb-2 background_loading para_load"></p>
</div>
</div>
</div>
</div>
<div class="day_filter">
<a href="JavaScript:void(0);" (click)="
Difficultyreq('total', '', '', '1 day',''); selectedTarget = 6; TdifficultyRange = '1 day'
" id="6" #itemtarget6 [ngClass]="{ active: selectedTarget == itemtarget6.id, txt_primay: true }">1 day</a>
<a href="JavaScript:void(0);" (click)="
Difficultyreq('total', '', '', '1 week',''); selectedTarget = 1; TdifficultyRange = '1 week'
" id="1" #itemtarget1 [ngClass]="{ active: selectedTarget == itemtarget1.id, txt_primay: true }">1
{{'home.WEEK' | translate}}</a>
<!-- <a href="JavaScript:void(0);" (click)="
Difficultyreq('total', '', '', '15 days',''); selectedTarget = 2; TdifficultyRange = '15 days'
" id="2" #itemtarget2 [ngClass]="{ active: selectedTarget == itemtarget2.id, day15_txt: true }">15
{{'home.DAYS' | translate}}</a> -->
<a href="JavaScript:void(0);" (click)="
Difficultyreq('total', '', '', '30 days',''); selectedTarget = 3; TdifficultyRange = '30 days'
" id="3" #itemtarget3 [ngClass]="{ active: selectedTarget == itemtarget3.id, day30_txt: true }">30
{{'home.DAYS' | translate}}</a>
<a href="JavaScript:void(0);" (click)="
Difficultyreq('total', '', '', '60 days',''); selectedTarget = 4; TdifficultyRange = '60 days'
" id="4" #itemtarget4 [ngClass]="{ active: selectedTarget == itemtarget4.id, day60_txt: true }">60
{{'home.DAYS' | translate}}</a>
<a href="JavaScript:void(0);" (click)="
Difficultyreq('total', '', '', '3 months',''); selectedTarget = 5; TdifficultyRange = '3 months'
" id="5" #itemtarget5 [ngClass]="{ active: selectedTarget == itemtarget5.id, day3m_txt: true }">3
{{'home.MONTHS' | translate}}</a>
</div>
<div class="explore_all text-right">
<a routerLink="/chart/total-difficulty"><span class="text-uppercase">{{'home.EXPLORE_IT' | translate}} <i
class="fa fa-long-arrow-right"></i></span></a>
</div>
</div>
</div>
</div>

View File

@ -50,23 +50,23 @@ export class GraphListComponent implements OnInit {
public selectedItem9: Number = 3;
public selectedItem10: Number = 3;
public selectedItem11: Number = 3;
public selectedItem12: Number = 1;
public selectedItem12: Number = 4;
public selectedTarget: Number = 6;
public selectedTarget12: Number = 1;
public selectedTarget12: Number = 4;
public tInput: any;
public tOutput: any;
public tKernal: any;
public tDate: any;
public tHour: any;
public Type: any = '';
public Type: any = 'all';
public difficultyRange: any = '1 day';
public TdifficultyRange: any = '1 day';
viewchartvar: boolean;
constructor(private chartService: ChartService, private http: HttpClient,public translate: TransServiceService, private router: Router,
) {
constructor(private chartService: ChartService, private http: HttpClient, public translate: TransServiceService, private router: Router,
) {
if (this.router.url == '/all') {
this.viewchartvar = true;
} else {
@ -126,16 +126,16 @@ export class GraphListComponent implements OnInit {
if (res['status'] == 200) {
let plabel = res.response.label;
let pvalues = res.response.value;
this.pg_last =
pvalues[pvalues.length - 1];
this.piechartFunc(
plabel,
pvalues,
);
this.pg_last =
pvalues[pvalues.length - 1];
this.piechartFunc(
plabel,
pvalues,
);
resolve();
}
},
error => {},
error => { },
);
});
}
@ -159,18 +159,18 @@ export class GraphListComponent implements OnInit {
let Cuckoo = res.response.Cuckoo;
let ProgPow = res.response.ProgPow;
let RandomX = res.response.RandomX;
this.sg_last =
this.sg_last =
RandomX[RandomX.length - 1];
this.stackchartFunc(
sDate,
Cuckoo,
ProgPow,
RandomX
);
this.stackchartFunc(
sDate,
Cuckoo,
ProgPow,
RandomX
);
resolve();
}
},
error => {},
error => { },
);
});
}
@ -224,7 +224,7 @@ export class GraphListComponent implements OnInit {
resolve();
}
},
error => {},
error => { },
);
});
}
@ -266,7 +266,7 @@ export class GraphListComponent implements OnInit {
resolve();
}
},
error => {},
error => { },
);
});
}
@ -304,7 +304,7 @@ export class GraphListComponent implements OnInit {
resolve();
}
},
error => {},
error => { },
);
});
}
@ -327,7 +327,7 @@ export class GraphListComponent implements OnInit {
resolve();
}
},
error => {},
error => { },
);
});
}
@ -351,7 +351,7 @@ export class GraphListComponent implements OnInit {
resolve();
}
},
error => {},
error => { },
);
});
}
@ -374,7 +374,7 @@ export class GraphListComponent implements OnInit {
resolve();
}
},
error => {},
error => { },
);
});
}
@ -386,7 +386,7 @@ export class GraphListComponent implements OnInit {
interval = '',
type = ''
) {
this.Type = type != '' ? type : this.Type == '' ? 'cuckatoo' : this.Type;
this.Type = type != '' ? type : this.Type == '' ? 'all' : this.Type;
return new Promise((resolve, reject) => {
let params = new HttpParams();
params = params.append('FromDate', fromDate);
@ -400,37 +400,94 @@ export class GraphListComponent implements OnInit {
res => {
if (res['status'] == 200) {
let DifficultychartDate = res.response.Date;
let BlocksChartDate = res.response.blockDate;
let TargetDifficulty = res.response.TargetDifficulty;
let range = [res.response.Minrange, res.response.Maxrange]
let tickformat = res.response.tickFormat;
this.lg_last =
TargetDifficulty[TargetDifficulty.length - 1];
let DifficultyCuckatoo = res.response.DifficultyCuckatoo;
let DifficultyRandomx = res.response.DifficultyRandomx;
let DifficultyProgpow = res.response.DifficultyProgpow;
let data;
switch (this.Type) {
case 'all':
data =
[
{
x: DifficultychartDate,
y: DifficultyCuckatoo,
text: DifficultychartDate,
// mode: 'lines+markers',
type: 'scatter',
name: '',
// line: { color: '#ac3333' },
hovertemplate: '%{text}<br> Cuckoo : %{y:,}',
},
{
x: DifficultychartDate,
y: DifficultyProgpow,
text: DifficultychartDate,
// mode: 'lines+markers',
type: 'scatter',
name: '',
yaxis: 'y2',
// line: { color: '#ac3333' },
hovertemplate: '%{text}<br> Progpow : %{y:,}',
},
{
x: DifficultychartDate,
y: DifficultyRandomx,
text: DifficultychartDate,
// mode: 'lines+markers',
type: 'scatter',
name: '',
yaxis: 'y3',
// line: { color: '#ac3333' },
hovertemplate: '%{text}<br> RandomX : %{y:,}',
},
];
break;
default:
let yvalue = this.Type == 'cuckatoo' ? DifficultyCuckatoo : this.Type == 'progpow' ? DifficultyProgpow : this.Type == 'randomx' ? DifficultyRandomx : []
data =
[
{
x: DifficultychartDate,
y: yvalue,
text: DifficultychartDate,
mode: 'lines+markers',
type: 'scatter',
name: '',
line: { color: '#ac3333' },
hovertemplate: '%{text}<br> Difficulty : %{y:,}',
}];
break;
}
// res.response.Minrange, res.response.Maxrange
let range = [];
let tickformat = res.response.tickFormat;
// this.lg_last =
// TargetDifficulty[TargetDifficulty.length - 1];
switch(difftype){
case 'total':
this.totaldifficultyChartFunc(
DifficultychartDate,
TargetDifficulty,
this.Type,
range,
tickformat
);
break;
case 'target':
this.difficultyChartFunc(
DifficultychartDate,
TargetDifficulty,
this.Type,
range,
tickformat
);
break;
}
switch (difftype) {
case 'total':
this.totaldifficultyChartFunc(
DifficultychartDate,
data,
this.Type,
range,
tickformat
);
break;
case 'target':
this.difficultyChartFunc(
DifficultychartDate,
data,
this.Type,
range,
tickformat
);
break;
}
resolve();
}
},
error => {},
error => { },
);
});
}
@ -452,78 +509,57 @@ export class GraphListComponent implements OnInit {
if (res['status'] == 200) {
let DifficultychartDate = res.response.Date;
let BlocksChartDate = res.response.blockDate;
let Blockval = res.response.Blocks;
this.brg_last = Blockval[Blockval.length - 1];
this.totalBlocksFunc(BlocksChartDate, Blockval);
let Blockval = res.response.Blocks;
this.brg_last = Blockval[Blockval.length - 1];
this.totalBlocksFunc(BlocksChartDate, Blockval);
resolve();
}
},
error => {},
error => { },
);
});
}
difficultyChartFunc(DifficultychartDate, TargetDifficulty, Type, range, tickformat) {
difficultyChartFunc(DifficultychartDate, data, Type, range, tickformat) {
// console.log('range rangerangerange',range);
this.linearGraphData = {
data: [
{
x: DifficultychartDate,
y: TargetDifficulty,
text: DifficultychartDate,
mode: 'lines+markers',
type: 'scatter',
name: '',
line: { color: '#ac3333' },
hovertemplate: '%{text}<br> Difficulty : %{y:,}',
},
// {
// x: DifficultychartDate,
// y: DifficultyCuckatoo,
// text: DifficultyCuckatoo,
// mode: 'lines+markers',
// type: 'scatter',
// name: '',
// line: { color: '#A876C6' },
// hovertemplate: '%{x}<br> Cuckatoo : %{text:,}',
// },
// {
// x: DifficultychartDate,
// y: DifficultyProgpow,
// text: DifficultyProgpow,
// mode: 'lines+markers',
// type: 'scatter',
// name: '',
// line: { color: '#54CFDC' },
// hovertemplate: '%{x}<br> Progpow : %{text:,}',
// },
// {
// x: DifficultychartDate,
// y: DifficultyRandomx,
// text: DifficultyRandomx,
// mode: 'lines+markers',
// type: 'scatter',
// name: '',
// line: { color: '#77817C' },
// hovertemplate: '%{x}<br> Randomx : %{text:,}',
// },
],
data: data,
layout: {
hovermode: 'closest',
// hovermode: 'closest',
height: 250,
autosize: true,
showlegend: false,
xaxis: {
tickangle: -45,
tickformat: tickformat,
showgrid: true,
fixedrange: true
fixedrange: true,
domain: [0.2, 0.8]
// showgrid: true
},
yaxis: {
title: 'Diff',
showgrid: true,
title: 'Cuckoo',
fixedrange: true,
range: range
// showgrid: true,
// range: range
},
yaxis2: {
title: 'Progpow',
fixedrange: true,
// showgrid: true,
// range: range,
overlaying: 'y',
side: 'left',
position: 1.25
},
yaxis3: {
title: 'RandomX',
fixedrange: true,
// showgrid: true,
// range: range,
anchor: 'x',
overlaying: 'y',
side: 'right'
},
margin: {
l: 50,
@ -619,7 +655,7 @@ export class GraphListComponent implements OnInit {
piechartFunc(plabel, pvalues) {
this.pieGraphData = {
this.pieGraphData = {
data: [
{
values: pvalues,
@ -634,7 +670,7 @@ export class GraphListComponent implements OnInit {
height: 250,
autosize: false,
showlegend: false,
xaxis: {
xaxis: {
tickangle: -45,
tickformat: '%m-%d',
showgrid: true,
@ -808,7 +844,7 @@ export class GraphListComponent implements OnInit {
],
layout: {
hovermode: 'closest',
// width: 350,
// width: 350,
height: 250,
autosize: true,
xaxis: {
@ -819,7 +855,7 @@ export class GraphListComponent implements OnInit {
showgrid: true,
},
yaxis: {
title: 'Blocks / sec',
title: 'Seconds / Block',
rangemode: 'nonnegative',
fixedrange: true,
showgrid: true,
@ -835,7 +871,7 @@ export class GraphListComponent implements OnInit {
};
}
blockminedFunc(mDate,ProgPow, Cuckoo, RandomX, ProgPowper, Cuckooper, RandomXper) {
blockminedFunc(mDate, ProgPow, Cuckoo, RandomX, ProgPowper, Cuckooper, RandomXper) {
this.doubleareaGraphData = {
data: [
{
@ -918,64 +954,64 @@ export class GraphListComponent implements OnInit {
transactionheatmapFunc(tDate, tHour, tInput, hovertext) {
return new Promise((resolve, reject) => {
this.heatMapGrowthData = {
data: [
{
x: tHour,
y: tDate,
z: tInput,
name: '',
text: hovertext,
hovertemplate: hovertext + ': %{z:,} ',
colorscale: 'Rainbow',
type: 'heatmap',
visible: true,
colorbar: { thickness: 3 },
xgap: 1,
ygap: 1,
},
],
layout: {
hovermode: 'closest',
height: 250,
//width: 365,
autosize: true,
annotations: [],
font: {
size: 8.5,
},
xaxis: {
ticks: '',
tickangle: screen.width < 767 ? '-90' : 360,
side: 'top',
autotick: false,
showgrid: true,
rangemode: 'nonnegative',
fixedrange: true,
this.heatMapGrowthData = {
data: [
{
x: tHour,
y: tDate,
z: tInput,
name: '',
text: hovertext,
hovertemplate: hovertext + ': %{z:,} ',
colorscale: 'Rainbow',
type: 'heatmap',
visible: true,
colorbar: { thickness: 3 },
xgap: 1,
ygap: 1,
},
],
layout: {
hovermode: 'closest',
height: 250,
//width: 365,
autosize: true,
annotations: [],
font: {
size: 8.5,
},
xaxis: {
ticks: '',
tickangle: screen.width < 767 ? '-90' : 360,
side: 'top',
autotick: false,
showgrid: true,
rangemode: 'nonnegative',
fixedrange: true,
autosize: true,
},
yaxis: {
ticks: '',
ticksuffix: ' ',
tickformat: '%m-%d',
autosize: true,
showgrid: true,
autotick: false,
rangemode: 'nonnegative',
fixedrange: true,
},
margin: {
l: 30,
r: 0,
b: 50,
t: 50,
},
showlegend: false,
},
yaxis: {
ticks: '',
ticksuffix: ' ',
tickformat: '%m-%d',
autosize: true,
showgrid: true,
autotick: false,
rangemode: 'nonnegative',
fixedrange: true,
},
margin: {
l: 30,
r: 0,
b: 50,
t: 50,
},
showlegend: false,
},
options: null,
};
resolve();
});
options: null,
};
resolve();
});
}
transactionlinechartFunc(Tdate, Ttotalinput, Ttotalkernal, Ttotaloutput) {
this.feeGraphData = {
@ -1013,7 +1049,7 @@ export class GraphListComponent implements OnInit {
],
layout: {
autosize: true,
// width: 350,
// width: 350,
height: 250,
xaxis: {
showgrid: true,
@ -1091,22 +1127,11 @@ export class GraphListComponent implements OnInit {
options: null,
};
}
totaldifficultyChartFunc(DifficultychartDate, TargetDifficulty, Type, range, tickformat) {
totaldifficultyChartFunc(DifficultychartDate, data, type, range, tickformat) {
this.linearTotalGraphData = {
data: [
{
x: DifficultychartDate,
y: TargetDifficulty,
text: DifficultychartDate,
mode: 'lines+markers',
type: 'scatter',
name: '',
line: { color: '#ac3333' },
hovertemplate: '%{text}<br> Difficulty : %{y:,}',
},
],
data: data,
layout: {
hovermode: 'closest',
// hovermode: 'closest',
height: 250,
autosize: true,
showlegend: false,
@ -1114,13 +1139,33 @@ export class GraphListComponent implements OnInit {
tickangle: -45,
tickformat: tickformat,
fixedrange: true,
showgrid: true
domain: [0.2, 0.8]
// showgrid: true
},
yaxis: {
title: 'Diff',
title: 'Cuckoo',
fixedrange: true,
showgrid: true,
range: range
// showgrid: true,
// range: range
},
yaxis2: {
title: 'Progpow',
fixedrange: true,
// showgrid: true,
// range: range,
overlaying: 'y',
side: 'left',
position: 1.25
},
yaxis3: {
title: 'RandomX',
fixedrange: true,
// showgrid: true,
// range: range,
anchor: 'x',
overlaying: 'y',
side: 'right'
},
margin: {
l: 50,

View File

@ -1,5 +1,5 @@
<div class="latest_table">
<h2 class="mb-3 chart_heading px-0">{{'home.LATEST_BLOCK' | translate}}</h2>
<h2 class="mb-3 chart_heading px-0">{{'home.LATEST_BLOCKS' | translate}}</h2>
<div class="mobile_table web_hdng">
<div class="row">
@ -46,9 +46,9 @@
</div>
</div>
<div #block></div>
<!-- <ng-container #block></ng-container> -->
<div [ngClass]="{mobile_table : true, hght_40: item.id != clickValue }"
id="hash_{{hashvalue.blockchain_block_height}}" #item *ngFor="let hashvalue of hashvalues">
<ng-container *ngFor="let hashvalue of hashvalues">
<div *ngIf="hashvalue.target_difficulty_cuckatoo != '0'" [ngClass]="{mobile_table : true, hght_40: item.id != clickValue }"
id="hash_{{hashvalue.blockchain_block_height}}" #item >
<div class="row">
<div class="col-6 col-md-3 tble_col">
@ -108,7 +108,7 @@
</div> -->
</div>
</div>
</ng-container>
</div>
@ -163,7 +163,11 @@
</div>
<div class="latest_table mt-3">
<h2 class="mb-3 chart_heading px-0">Peers</h2>
<h2 class="mb-3 chart_heading px-0 d-inline-block">Peers
<span *ngIf="peers && peers.length > 0" class="txn_count" >{{
peers.length | number
}}</span>
</h2>
<div class="mobile_table web_hdng">
<div class="mobile_table peer_table">

View File

@ -99,7 +99,11 @@ export class LatestblocksComponent implements OnInit {
this.chartService.apiGetRequest('','/blockchain_kernel/getpeers').subscribe(
res => {
if (res['status'] == 200) {
this.peers = res.response.dataJson;
let json = res.response.dataJson;
if(json && json.length > 0){
localStorage.setItem('peersJson',JSON.stringify(json));
}
this.peers = JSON.parse(localStorage.getItem('peersJson'));
}
},
error => {},