Blocks Mined data changed
This commit is contained in:
parent
eddb90cf25
commit
3174184928
@ -1351,52 +1351,60 @@ export class BlockchainBlockController {
|
|||||||
"' > current_date - interval '30 days'";
|
"' > current_date - interval '30 days'";
|
||||||
}
|
}
|
||||||
const BlockMineChartQuery = await getConnection()
|
const BlockMineChartQuery = await getConnection()
|
||||||
.query(
|
.query(
|
||||||
"SELECT hash, date , total_edge_bits, cuckARoo29, cuckAToo31, ROUND(cuckARoo29 * 100.0 / total_edge_bits,2) as cuckARoo29per, ROUND(cuckAToo31 * 100.0 / total_edge_bits,2) as cuckAToo31per \
|
"SELECT hash, date , total_edge_bits, RandomX, Cuckoo, ProgPow, Round(RandomX * 100.0 / total_edge_bits,2) AS RandomXper, Round(Cuckoo * 100.0 / total_edge_bits,2) AS Cuckooper,Round(ProgPow * 100.0 / total_edge_bits,2) AS ProgPowper \
|
||||||
FROM (SELECT 1 as hash, \
|
FROM (SELECT 1 as hash, \
|
||||||
date(DATE_TRUNC('day', timestamp at time zone '" +
|
date(DATE_TRUNC('day', timestamp at time zone '" +
|
||||||
process.env.TIME_ZONE +
|
process.env.TIME_ZONE +
|
||||||
"')) as date, \
|
"')) as date, \
|
||||||
COUNT(edge_bits) AS total_edge_bits, \
|
COUNT(edge_bits) AS total_edge_bits, \
|
||||||
COUNT(CASE WHEN edge_bits = 29 THEN 1 ELSE NULL END) AS cuckARoo29, \
|
Count( CASE WHEN proof = 'RandomX' THEN 1 ELSE NULL END) AS RandomX, \
|
||||||
COUNT(CASE WHEN edge_bits = 31 THEN 1 ELSE NULL END) AS cuckAToo31 \
|
Count( CASE WHEN proof = 'Cuckoo' THEN 1 ELSE NULL END) AS Cuckoo,\
|
||||||
FROM blockchain_block \
|
Count( CASE WHEN proof = 'ProgPow' THEN 1 ELSE NULL END) AS ProgPow \
|
||||||
where " +
|
FROM blockchain_block \
|
||||||
timeIntervalQry +
|
where " +
|
||||||
"GROUP BY DATE_TRUNC('day', timestamp at time zone '" +
|
timeIntervalQry +
|
||||||
process.env.TIME_ZONE +
|
"GROUP BY DATE_TRUNC('day', timestamp at time zone '" +
|
||||||
"')) t order by date",
|
process.env.TIME_ZONE +
|
||||||
)
|
"')) t order by date",
|
||||||
.catch(err_msg => {
|
)
|
||||||
next(err_msg);
|
.catch(err_msg => {
|
||||||
});
|
next(err_msg);
|
||||||
let date = [],
|
});
|
||||||
cuckARoo29per = [],
|
let date = [],
|
||||||
cuckAToo31per = [],
|
RandomXper = [],
|
||||||
cuckARoo29Val = [],
|
Cuckooper = [],
|
||||||
cuckAToo31Val = [];
|
ProgPowper = [],
|
||||||
|
RandomX = [],
|
||||||
|
Cuckoo = [],
|
||||||
|
ProgPow = [];
|
||||||
|
|
||||||
BlockMineChartQuery.forEach(e => {
|
BlockMineChartQuery.forEach(e => {
|
||||||
date.push(moment(e.date).format('YYYY-MM-DD'));
|
console.log('e', e);
|
||||||
cuckARoo29per.push(parseFloat(e.cuckaroo29per));
|
date.push(moment(e.date).format('YYYY-MM-DD'));
|
||||||
cuckAToo31per.push(parseFloat(e.cuckatoo31per));
|
RandomXper.push(parseFloat(e.randomxper));
|
||||||
cuckARoo29Val.push(parseInt(e.cuckaroo29));
|
Cuckooper.push(parseFloat(e.cuckooper));
|
||||||
cuckAToo31Val.push(parseInt(e.cuckatoo31));
|
ProgPowper.push(parseFloat(e.progpowper));
|
||||||
});
|
RandomX.push(parseInt(e.randomx));
|
||||||
response.status(200).json({
|
Cuckoo.push(parseInt(e.cuckoo));
|
||||||
status: 200,
|
ProgPow.push(parseInt(e.progpow));
|
||||||
timestamp: Date.now(),
|
});
|
||||||
message: 'period of blocks generation per second fetched Successfully',
|
|
||||||
response: {
|
response.status(200).json({
|
||||||
date,
|
status: 200,
|
||||||
cuckARoo29per,
|
timestamp: Date.now(),
|
||||||
cuckAToo31per,
|
message: 'period of blocks generation per second fetched Successfully',
|
||||||
cuckARoo29Val,
|
response: {
|
||||||
cuckAToo31Val,
|
date,
|
||||||
},
|
RandomXper,
|
||||||
});
|
ProgPowper,
|
||||||
} catch (error) {
|
RandomX,
|
||||||
next(new InternalServerErrorException(error));
|
Cuckoo,
|
||||||
}
|
ProgPow,
|
||||||
};
|
},
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
next(new InternalServerErrorException(error));
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
@ -85,6 +85,13 @@ export class BlockchainBlock {
|
|||||||
})
|
})
|
||||||
EdgeBits: number;
|
EdgeBits: number;
|
||||||
|
|
||||||
|
@Column('character varying', {
|
||||||
|
nullable: false,
|
||||||
|
length: 64,
|
||||||
|
name: 'proof',
|
||||||
|
})
|
||||||
|
Proof: string;
|
||||||
|
|
||||||
@Column('int4', {
|
@Column('int4', {
|
||||||
nullable: false,
|
nullable: false,
|
||||||
array: true,
|
array: true,
|
||||||
|
@ -186,17 +186,23 @@ export class GraphListComponent implements OnInit {
|
|||||||
res => {
|
res => {
|
||||||
if (res['status'] == 200) {
|
if (res['status'] == 200) {
|
||||||
let mDate = res.response.date;
|
let mDate = res.response.date;
|
||||||
let mcuck29 = res.response.cuckARoo29per;
|
let ProgPow = res.response.ProgPow;
|
||||||
let mcuck31 = res.response.cuckAToo31per;
|
let Cuckoo = res.response.Cuckoo;
|
||||||
let mcuck29val = res.response.cuckARoo29Val;
|
let RandomX = res.response.RandomX;
|
||||||
let mcuck31val = res.response.cuckAToo31Val;
|
|
||||||
this.dg_last = mcuck29val[mcuck29val.length - 1];
|
let ProgPowper = res.response.ProgPowper;
|
||||||
|
let Cuckooper = res.response.Cuckooper;
|
||||||
|
let RandomXper = res.response.RandomXper;
|
||||||
|
|
||||||
|
this.dg_last = RandomXper[RandomXper.length - 1];
|
||||||
this.blockminedFunc(
|
this.blockminedFunc(
|
||||||
mDate,
|
mDate,
|
||||||
mcuck29,
|
ProgPow,
|
||||||
mcuck31,
|
Cuckoo,
|
||||||
mcuck29val,
|
RandomX,
|
||||||
mcuck31val,
|
ProgPowper,
|
||||||
|
Cuckooper,
|
||||||
|
RandomXper,
|
||||||
);
|
);
|
||||||
resolve();
|
resolve();
|
||||||
}
|
}
|
||||||
@ -506,14 +512,14 @@ export class GraphListComponent implements OnInit {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
blockminedFunc(mDate, mcuck29, mcuck31, mcuck29val, mcuck31val) {
|
blockminedFunc(mDate,ProgPow, Cuckoo, RandomX, ProgPowper, Cuckooper, RandomXper) {
|
||||||
this.doubleareaGraphData = {
|
this.doubleareaGraphData = {
|
||||||
data: [
|
data: [
|
||||||
{
|
{
|
||||||
x: mDate,
|
x: mDate,
|
||||||
y: mcuck29,
|
y: Cuckooper,
|
||||||
text: mcuck29val,
|
text: Cuckoo,
|
||||||
hovertemplate: 'cuckARoo29 :%{y} % ( %{text:,} )',
|
hovertemplate: 'Cuckoo :%{y} % ( %{text:,} )',
|
||||||
name: '',
|
name: '',
|
||||||
fill: 'tozeroy',
|
fill: 'tozeroy',
|
||||||
type: 'line',
|
type: 'line',
|
||||||
@ -523,9 +529,9 @@ export class GraphListComponent implements OnInit {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
x: mDate,
|
x: mDate,
|
||||||
y: mcuck31,
|
y: RandomXper,
|
||||||
text: mcuck31val,
|
text: RandomX,
|
||||||
hovertemplate: 'cuckAToo31 :%{y} % ( %{text:,} )',
|
hovertemplate: 'RandomX :%{y} % ( %{text:,} )',
|
||||||
fill: 'tozeroy',
|
fill: 'tozeroy',
|
||||||
type: 'line',
|
type: 'line',
|
||||||
name: '',
|
name: '',
|
||||||
@ -533,6 +539,18 @@ export class GraphListComponent implements OnInit {
|
|||||||
color: '#1ad5e9',
|
color: '#1ad5e9',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
x: mDate,
|
||||||
|
y: ProgPowper,
|
||||||
|
text: ProgPow,
|
||||||
|
hovertemplate: 'ProgPow :%{y} % ( %{text:,} )',
|
||||||
|
fill: 'tozeroy',
|
||||||
|
type: 'line',
|
||||||
|
name: '',
|
||||||
|
line: {
|
||||||
|
color: '#f74f4f',
|
||||||
|
},
|
||||||
|
},
|
||||||
],
|
],
|
||||||
layout: {
|
layout: {
|
||||||
hovermode: 'closest',
|
hovermode: 'closest',
|
||||||
@ -542,9 +560,15 @@ export class GraphListComponent implements OnInit {
|
|||||||
xaxis: {
|
xaxis: {
|
||||||
tickformat: '%m-%d',
|
tickformat: '%m-%d',
|
||||||
tickangle: -45,
|
tickangle: -45,
|
||||||
|
rangemode: 'nonnegative',
|
||||||
|
fixedrange: true,
|
||||||
|
showgrid: true,
|
||||||
},
|
},
|
||||||
yaxis: {
|
yaxis: {
|
||||||
title: 'Percentage(%)',
|
title: 'Percentage(%)',
|
||||||
|
rangemode: 'nonnegative',
|
||||||
|
fixedrange: true,
|
||||||
|
showgrid: true,
|
||||||
},
|
},
|
||||||
margin: {
|
margin: {
|
||||||
l: 50,
|
l: 50,
|
||||||
|
Loading…
Reference in New Issue
Block a user