TheRPCを始める
APIリファレンス
イーサリアムAPI
Core API
ガイド
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

より良くするためにご協力ください!
このページを共有して、より良い製品を作るのに協力してください。