Changes
This commit is contained in:
parent
3f04006453
commit
95377bd380
@ -741,27 +741,62 @@ 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 <= 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(
|
||||
@ -1643,24 +1678,33 @@ 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 = 16;
|
||||
coin_existence = height * 16;
|
||||
} else if (height <= BLOCK_ERA_2) {
|
||||
coin_existence = 8;
|
||||
remaining_height = height - BLOCK_ERA_1;
|
||||
coin_existence = (16 * BLOCK_ERA_1) + 8 * remaining_height;
|
||||
} else if (height <= BLOCK_ERA_3) {
|
||||
coin_existence = 4;
|
||||
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) {
|
||||
coin_existence = 2;
|
||||
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) {
|
||||
coin_existence = 1;
|
||||
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;
|
||||
coin_existence = BASE_REWARD_ERA_6_ONWARDS / (1 << exp);
|
||||
let reward_emission = BASE_REWARD_ERA_6_ONWARDS / (1 << exp);
|
||||
coin_existence = preious_circulation + reward_emission ;
|
||||
}
|
||||
|
||||
letest_block = this.dateDiff(BlockchainLatestBlockQuery[0].timestamp,true);
|
||||
|
@ -175,25 +175,35 @@ export async function universalGetLatestBlockDetails(socket) {
|
||||
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 = 16;
|
||||
} else if (height <= BLOCK_ERA_2) {
|
||||
coin_existence = 8;
|
||||
} else if (height <= BLOCK_ERA_3) {
|
||||
coin_existence = 4;
|
||||
} else if (height <= BLOCK_ERA_4) {
|
||||
coin_existence = 2;
|
||||
} else if (height <= BLOCK_ERA_5) {
|
||||
coin_existence = 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 = height - (BLOCK_ERA_5 - 1);
|
||||
let exp = height_with_offset / BLOCK_ERA_6_ONWARDS;
|
||||
coin_existence = BASE_REWARD_ERA_6_ONWARDS / (1 << exp);
|
||||
}
|
||||
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"
|
||||
|
Loading…
Reference in New Issue
Block a user