TheRPC 시작하기
Ethereum/가이드/엉클 블록

Uncle Blocks Guide

Uncle blocks (also known as ommer blocks) are valid blocks that weren't included in the main chain but are still rewarded in Ethereum. Understanding them is important for mining and block validation.

Understanding Uncle Blocks

  • What are uncle blocks
  • Why they exist
  • Reward structure
  • Impact on network security

Implementation Examples

// Get uncle count for a block
const getUncleCount = async (blockNumber) => {
	const block = await web3.eth.getBlock(blockNumber);
	return block.uncles.length;
};

// Get uncle block by index
const getUncleBlock = async (blockNumber, uncleIndex) => {
	return await web3.eth.getUncle(blockNumber, uncleIndex);
};

// Monitor uncle rates
const calculateUncleRate = async (blockRange = 100) => {
	const latestBlock = await web3.eth.getBlockNumber();
	const startBlock = latestBlock - blockRange;

	let totalUncles = 0;
	for (let i = startBlock; i <= latestBlock; i++) {
		const uncleCount = await getUncleCount(i);
		totalUncles += uncleCount;
	}

	return totalUncles / blockRange;
};

Best Practices

  1. Consider uncle blocks in block confirmations
  2. Monitor uncle rates for network health
  3. Account for uncle rewards in mining calculations
  4. Handle uncle references properly

See also

더 나아지도록 도와주세요!
이 페이지를 공유하고 더 나은 제품을 만들 수 있도록 도와주세요.