Total add block
Author: f | 2025-04-24
Total Block Required = (add approx. 5% to the total for waste) Sand amount needed for block count. Block count: Request a Quote. Sand (tons) Required = (add yard to the total amount you will need) Block fill. Block count: Block Size. 6 8 12
How get rid of the annoying add by total add block
Const txGasUseage = await getGasUsage(tx.hash); const totalFee = ethers.utils.formatEther( ethers.BigNumber.from(txGasUseage).mul(tx.gasPrice).toString() ); minerTips.push(Number(totalFee)); }Above, we use the transaction hash to return the gas usage for each transaction. Then we convert our gasUsage variable using bignumber so that we can multiply it by the gasPrice and format the result into an Ether value as it is currently in wei. Finally, we push the total fee value to an array which we can sum to get the total for all transaction fees in our block:JSXif (transactions.length > 0) { sumMinerTips = minerTips.reduce( (prevTip, currentTip) => prevTip + currentTip ); }As long as there is at least one transaction, we will add the items in the minerTips array and set the total equal to sumMinerTips. Otherwise, sumMinerTips will stay equal to zero.Sum the burned fees in a blockNext, we’ll need to get the sum of burned fees in our block so that we can subtract it from the total reward. To do this, we need to multiply the total gasUsed by the baseFeePerGas:JSXconst burnedFee = ethers.utils.formatEther( ethers.BigNumber.from(gasUsed).mul(baseFeePerGas).toString() );Again, we use bignumber to multiply the wei values and format the result in Ether.Uncle and nephew rewardsnephew rewardsLet’s start with the nephew reward. Because the nephew reward is 1/32 of the block reward, the reward should be fixed to 0.0625ETH/uncle block. To calculate this add the following lines of code:JSXconst baseBlockReward = 2;const nephewReward = baseBlockReward / 32;const uncleCount = block.uncles.length;const totalNephewReward = uncleCount * nephewReward;Uncle rewardsIn order to calculate the uncle rewards, we’ll need to iterate over each of the block hashes found in the block.uncles property of our block variable. Then, we’ll pass each hash to our getUncle function to extract both the uncle block number and miner. Finally, we’ll push the block number and miner to an uncle rewards array:JSXlet uncleRewardsArr = []; for (const hash of block.uncles) { const uncle = await getUncle(hash) const uncleNum = parseInt(uncle.number) const uncleMiner = uncle.miner const uncleReward = (uncleNum + 8 - blockNumber) * baseBlockReward / 8; uncleRewardsArr.push({ reward: `${uncleReward}ETH`, miner: uncleMiner }) }Final miner reward calculationNow that we have the sum of transaction fees and sum of burned fees let’s calculate the miner reward in a scenario where there is no uncle block included:JSXconst blockReward = baseBlockReward + (sumMinerTips - Number(burnedFee));This will give us the basic block reward, however let’s also account for nephew and uncle rewards by adding the totalNephewReward when the given block contains at least one uncle hash:JSXif (uncleCount > 0) { console.log("Block reward:", blockReward + totalNephewReward + "ETH"); console.log("miner:", block.miner); console.log("Uncle rewards:"); console.log(uncleRewardsArr); } else { console.log("Block reward:", blockReward + "ETH"); console.log("miner:", block.miner); }Above we are printing the total block reward plus the total nephew reward when the block contains uncles.. Total Block Required = (add approx. 5% to the total for waste) Sand amount needed for block count. Block count: Request a Quote. Sand (tons) Required = (add yard to the total amount you will need) Block fill. Block count: Block Size. 6 8 12 The Concrete Block calculators provide guidance to determine building materials required for construction projects. Block Required: Length (ft) Height (ft) Total Block Required: (add approx. 5% to the total for waste) Mortar bags needed for block count: Block count: Mortar Bags Required: (add approx. 5% to the total for waste) Sand amount Total Adblock Pro, Pricing, Free Tier Trial. Total Adblock’s premium plan is called Total Adblock Pro. It adds the following functionalities: Unlimited Ad Blocking: Total Adblock Pro lets you block an unlimited number of ads on all websites. YouTube Ad Blocking: YouTube ad blocking is only exclusive to the premium plan. Concrete Block Calculator Estimator Concrete Block Calculator Estimator. Use the concrete block calculators below to calculate the amount of materials needed. Block required. Length (ft): Height (ft): Request a Quote. Total Block Required = (add approx. 5% to the total for waste) Concrete Block Calculator Estimator. Use the concrete block calculators below to calculate the amount of materials needed. Block required. Length (ft): Height (ft): Request a Quote. Total Block Required = (add approx. 5% to the total for waste) Sand amount needed for block count. 0) { sumMinerTips = minerTips.reduce( (prevTip, currentTip) => prevTip + currentTip ); }As long as there is at least one transaction, we will add the items in the minerTips array and set the total equal to sumMinerTips. Otherwise, sumMinerTips will stay equal to zero.Next, we’ll need to get the sum of burned fees in our block so that we can subtract it from the total reward. To do this, we need to multiply the total gasUsed by the baseFeePerGas:const burnedFee = ethers.utils.formatEther( ethers.BigNumber.from(gasUsed).mul(baseFeePerGas).toString() );Again, we use bignumber to multiply the wei values and format the result in Ether.Let’s start with the nephew reward. Because the nephew reward is 1/32 of the block reward, the reward should be fixed to 0.0625ETH/uncle block. To calculate this add the following lines of code:const baseBlockReward = 2;const nephewReward = baseBlockReward / 32;const uncleCount = block.uncles.length;const totalNephewReward = uncleCount * nephewReward;In order to calculate the uncle rewards, we’ll need to iterate over each of the block hashes found in the block.uncles property of our block variable. Then, we’ll pass each hash to our getUncle function to extract both the uncle block number and miner. Finally, we’ll push the block number and miner to an uncle rewards array:let uncleRewardsArr = []; for (const hash of block.uncles) { const uncle = await getUncle(hash) const uncleNum = parseInt(uncle.number) const uncleMiner = uncle.miner const uncleReward = (uncleNum + 8 - blockNumber) * baseBlockReward / 8; uncleRewardsArr.push({ reward: `${uncleReward}ETH`, miner: uncleMiner }) }Now that we have the sum of transaction fees and sum of burned fees let’s calculate the miner reward in a scenario where there is no uncle block included:const blockReward = baseBlockReward + (sumMinerTips - Number(burnedFee));This will give us the basic block reward, however let’s also account for nephew and uncle rewards by adding the totalNephewReward when the given block contains at least one uncle hash:if (uncleCount > 0) { console.log("Block reward:", blockReward + totalNephewReward + "ETH"); console.log("miner:", block.miner); console.log("Uncle rewards:"); console.log(uncleRewardsArr); } else { console.log("Block reward:", blockReward + "ETH"); console.log("miner:", block.miner); }Above we are printing the total block reward plus the total nephew reward when the block contains uncles. Otherwise, we simply print the block block reward and miner.Your entire getBlockReward.js file should appear as follows:const { default: axios } = require("axios");const { ethers } = require("ethers");require("dotenv").config();const ALCHEMY_API_URL = process.env.MAINNET_API_URL;const getBlockReward = async blockNum => { const getBlock = async num => { const blockNumHex = ethers.utils.hexlify(num); const blockRes = await axios.post(ALCHEMY_API_URL, { jsonrpc: "2.0", method: "eth_getBlockByNumber", params: [blockNumHex, true], id: 0, }); return blockRes.data.result; }; const getGasUsage = async hash => { const txRes = await axios.post(ALCHEMY_API_URL, { jsonrpc: "2.0", method: "eth_getTransactionReceipt", params: [`${hash}`], id: 0, }); return txRes.data.result.gasUsed; }; const getUncle = async hash =>Comments
Const txGasUseage = await getGasUsage(tx.hash); const totalFee = ethers.utils.formatEther( ethers.BigNumber.from(txGasUseage).mul(tx.gasPrice).toString() ); minerTips.push(Number(totalFee)); }Above, we use the transaction hash to return the gas usage for each transaction. Then we convert our gasUsage variable using bignumber so that we can multiply it by the gasPrice and format the result into an Ether value as it is currently in wei. Finally, we push the total fee value to an array which we can sum to get the total for all transaction fees in our block:JSXif (transactions.length > 0) { sumMinerTips = minerTips.reduce( (prevTip, currentTip) => prevTip + currentTip ); }As long as there is at least one transaction, we will add the items in the minerTips array and set the total equal to sumMinerTips. Otherwise, sumMinerTips will stay equal to zero.Sum the burned fees in a blockNext, we’ll need to get the sum of burned fees in our block so that we can subtract it from the total reward. To do this, we need to multiply the total gasUsed by the baseFeePerGas:JSXconst burnedFee = ethers.utils.formatEther( ethers.BigNumber.from(gasUsed).mul(baseFeePerGas).toString() );Again, we use bignumber to multiply the wei values and format the result in Ether.Uncle and nephew rewardsnephew rewardsLet’s start with the nephew reward. Because the nephew reward is 1/32 of the block reward, the reward should be fixed to 0.0625ETH/uncle block. To calculate this add the following lines of code:JSXconst baseBlockReward = 2;const nephewReward = baseBlockReward / 32;const uncleCount = block.uncles.length;const totalNephewReward = uncleCount * nephewReward;Uncle rewardsIn order to calculate the uncle rewards, we’ll need to iterate over each of the block hashes found in the block.uncles property of our block variable. Then, we’ll pass each hash to our getUncle function to extract both the uncle block number and miner. Finally, we’ll push the block number and miner to an uncle rewards array:JSXlet uncleRewardsArr = []; for (const hash of block.uncles) { const uncle = await getUncle(hash) const uncleNum = parseInt(uncle.number) const uncleMiner = uncle.miner const uncleReward = (uncleNum + 8 - blockNumber) * baseBlockReward / 8; uncleRewardsArr.push({ reward: `${uncleReward}ETH`, miner: uncleMiner }) }Final miner reward calculationNow that we have the sum of transaction fees and sum of burned fees let’s calculate the miner reward in a scenario where there is no uncle block included:JSXconst blockReward = baseBlockReward + (sumMinerTips - Number(burnedFee));This will give us the basic block reward, however let’s also account for nephew and uncle rewards by adding the totalNephewReward when the given block contains at least one uncle hash:JSXif (uncleCount > 0) { console.log("Block reward:", blockReward + totalNephewReward + "ETH"); console.log("miner:", block.miner); console.log("Uncle rewards:"); console.log(uncleRewardsArr); } else { console.log("Block reward:", blockReward + "ETH"); console.log("miner:", block.miner); }Above we are printing the total block reward plus the total nephew reward when the block contains uncles.
2025-04-130) { sumMinerTips = minerTips.reduce( (prevTip, currentTip) => prevTip + currentTip ); }As long as there is at least one transaction, we will add the items in the minerTips array and set the total equal to sumMinerTips. Otherwise, sumMinerTips will stay equal to zero.Next, we’ll need to get the sum of burned fees in our block so that we can subtract it from the total reward. To do this, we need to multiply the total gasUsed by the baseFeePerGas:const burnedFee = ethers.utils.formatEther( ethers.BigNumber.from(gasUsed).mul(baseFeePerGas).toString() );Again, we use bignumber to multiply the wei values and format the result in Ether.Let’s start with the nephew reward. Because the nephew reward is 1/32 of the block reward, the reward should be fixed to 0.0625ETH/uncle block. To calculate this add the following lines of code:const baseBlockReward = 2;const nephewReward = baseBlockReward / 32;const uncleCount = block.uncles.length;const totalNephewReward = uncleCount * nephewReward;In order to calculate the uncle rewards, we’ll need to iterate over each of the block hashes found in the block.uncles property of our block variable. Then, we’ll pass each hash to our getUncle function to extract both the uncle block number and miner. Finally, we’ll push the block number and miner to an uncle rewards array:let uncleRewardsArr = []; for (const hash of block.uncles) { const uncle = await getUncle(hash) const uncleNum = parseInt(uncle.number) const uncleMiner = uncle.miner const uncleReward = (uncleNum + 8 - blockNumber) * baseBlockReward / 8; uncleRewardsArr.push({ reward: `${uncleReward}ETH`, miner: uncleMiner }) }Now that we have the sum of transaction fees and sum of burned fees let’s calculate the miner reward in a scenario where there is no uncle block included:const blockReward = baseBlockReward + (sumMinerTips - Number(burnedFee));This will give us the basic block reward, however let’s also account for nephew and uncle rewards by adding the totalNephewReward when the given block contains at least one uncle hash:if (uncleCount > 0) { console.log("Block reward:", blockReward + totalNephewReward + "ETH"); console.log("miner:", block.miner); console.log("Uncle rewards:"); console.log(uncleRewardsArr); } else { console.log("Block reward:", blockReward + "ETH"); console.log("miner:", block.miner); }Above we are printing the total block reward plus the total nephew reward when the block contains uncles. Otherwise, we simply print the block block reward and miner.Your entire getBlockReward.js file should appear as follows:const { default: axios } = require("axios");const { ethers } = require("ethers");require("dotenv").config();const ALCHEMY_API_URL = process.env.MAINNET_API_URL;const getBlockReward = async blockNum => { const getBlock = async num => { const blockNumHex = ethers.utils.hexlify(num); const blockRes = await axios.post(ALCHEMY_API_URL, { jsonrpc: "2.0", method: "eth_getBlockByNumber", params: [blockNumHex, true], id: 0, }); return blockRes.data.result; }; const getGasUsage = async hash => { const txRes = await axios.post(ALCHEMY_API_URL, { jsonrpc: "2.0", method: "eth_getTransactionReceipt", params: [`${hash}`], id: 0, }); return txRes.data.result.gasUsed; }; const getUncle = async hash =>
2025-04-06Would be to check the miner’s wallet balance via eth_getBalance before and after a given block is mined. The issue with this solution is that it will only be accurate when the miner does not receive ether from a transaction. For example, if a miner receives 1ETH in the block they mined, your reward calculation would be offset. In this tutorial, we will explore a different approach that does require trusting a 3rd party or miner balance. To accurately calculate a block reward, the following parts are needed:Block reward: A fixed inflationary reward that only changes at forks. The block reward is currently set to 2ETH and was last set by EIP-1234 at the Constantinople fork. Consequently, each Ethereum block excluding burned fees adds 2ETH to the total currency supply.Transaction gas fees: Each transaction on Ethereum requires a certain amount of gas units to execute Opcode commands on the EVM which change the state of the network. Although each operation requires a fixed amount of gas, the rate at which a user pays for those gas units changes based on a block’s baseFeePerGas and the user specified maxPriorityFeePerGas (miner tip). The baseFeePerGas is the minimum rate a user can pay to include their transaction in the next block and is determined by the previous block’s total gas usage. If the previous block uses less than 50% of it’s gas capacity (30 million units) the base fee decreases. If the previous block’s gas usage is equal to 50% the base fee stays the same. Otherwise, if the gas usage is above 50% the base fee will increase in the next block. Because, the base fee is burned, adding a miner tip gives some incentive to a miner to include your transaction in the next block. The basic formula is as follows: gas units x (baseFeePerGas + maxPriorityFeePerGas) = transaction fee An example fee could look like this: 21,000 x (15 gwei + 1.5gwei) = 346500gwei or 0.0003465ETHBurned fees: The baseFeePerGas is burned/removed from the Ethereum protocol altogether. In order to calculate the total amount of burned fees in a block you can use the following formula:baseFeePerGas x gasUsed = burned feesOnce you know the total amount burned, you can subtract this from the total block reward.Uncle and nephew block rewards: The final part of our block reward calculation is to add additional rewards for mining an Uncle block (uncle reward) or including it in the latest block (nephew reward). An uncle block occurs when two miners create blocks at almost the same time. While both blocks are valid, the network can only accept one block at a time. Therefore one block is rejected and labeled as an uncle block. Instead of
2025-04-01Have you ever wondered how much a miner earns for mining a block on Ethereum? Maybe you’re curious about what miners are earning or have a practical application (i.e. blockchain explorer, miner profit calculator, etc) for calculating a block reward. You could achieve this by checking Etherscan’s “block reward” field if you believe their calculations are accurate. Another alternative would be to check the miner’s wallet balance via eth_getBalance before and after a given block is mined. The issue with this solution is that it will only be accurate when the miner does not receive ether from a transaction. For example, if a miner receives 1ETH in the block they mined, your reward calculation would be offset. In this tutorial, we will explore a different approach that does require trusting a 3rd party or miner balance. To accurately calculate a block reward, the following parts are needed:Block reward: A fixed inflationary reward that only changes at forks. The block reward is currently set to 2ETH and was last set by EIP-1234 at the Constantinople fork. Consequently, each Ethereum block excluding burned fees adds 2ETH to the total currency supply.Transaction gas fees: Each transaction on Ethereum requires a certain amount of gas units to execute Opcode commands on the EVM which change the state of the network. Although each operation requires a fixed amount of gas, the rate at which a user pays for those gas units changes based on a block’s baseFeePerGas and the user specified maxPriorityFeePerGas (miner tip). The baseFeePerGas is the minimum rate a user can pay to include their transaction in the next block and is determined by the previous block’s total gas usage. If the previous block uses less than 50% of it’s gas capacity (30 million units) the base fee decreases. If the previous block’s gas usage is equal to 50% the base fee stays the same. Otherwise, if the gas usage is above 50% the base fee will increase in the next block. Because, the base fee is burned, adding a miner tip gives some incentive to a miner to include your transaction in the next block. The basic formula is as follows: gas units x (baseFeePerGas + maxPriorityFeePerGas) = transaction fee An example fee could look like this: 21,000 x (15 gwei + 1.5gwei) = 346500gwei or 0.0003465ETHBurned fees: The baseFeePerGas is burned/removed from the Ethereum protocol altogether. In order to calculate the total amount of burned fees in a block you can use the following formula:baseFeePerGas x gasUsed = burned feesOnce you know the total amount burned, you can subtract this from the total block reward.Uncle and nephew block rewards: The final part of our block reward calculation is to add additional
2025-04-23