Información sobre Bitcoin en Español

Bitcoin es una criptomoneda descentralizada, es decir, no está controlada por ninguna entidad financiera, gobierno o empresa. Es una moneda digital que se puede enviar a través de Internet a cualquier parte del mundo, sin intermediarios.

tech_test.js
/**
 * @file tech_test.js
 * @brief Cuboplus Tech Test
 * @version 1.0
 * @date 2024-09-15
 * 
 * @author Cristian Escalante
 */

const totalHalving = 32;
const blocksBetweenHalving = 210000;
const initialBlockReward = 50;
const rewardHalving = 0.5;

function calculateBlockReward(blockHeight) {
    let halving = Math.floor(blockHeight / blocksBetweenHalving);
    return initialBlockReward * Math.pow(rewardHalving, halving);
}

let totalSupply = 0;
let blockHeight = 0;
let blockReward = 0;
let percentage = 0;
for (let i = 0; i <= totalHalving; i++) {
    blockReward = calculateBlockReward(blockHeight);
    totalSupply += blockReward * blocksBetweenHalving;
    percentage = (totalSupply / 21000000) * 100;
    if (i != 0) console.log(`Halving ${i}:`); 
    console.log(`Total Bitcoin supply: ${totalSupply}`);
    console.log(`Block reward: ${blockReward} BTC (${blockReward * 100000000} SATS)`);
    console.log(`Percentage of total 21 million bitcoins mined: ${percentage}%`);
    blockHeight += blocksBetweenHalving;
}

Bitcoin Halving

Block Number

840000

Bitcoin Mined

19687500 BTC

Bitcoin Reward

3.12500000 = 312500000SATS

94%
4 / 32