isValid() does not verify mining reward amount or enforce a single reward transaction per block
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 72/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- java
- 领域
- blockchain
调研方向
阅读 Transaction 中的 Blockchain.isValid() 和 Transaction.NETWORK;issue 指出了缺失的检查,README 定义了 50 coin 的奖励。追踪区块如何提供其交易,然后更新验证逻辑,使每个区块最多包含一笔网络交易,且其金额等于 MINING_REWARD。当金额被篡改或奖励重复时,isValid() 会返回 false,而有效挖出的区块仍能通过验证,即视为完成。
由索引模型根据 Issue 内容生成。
描述
Description
In mini-chain, mining rewards are issued with Transaction.NETWORK ("network") as the sender.
Under Transaction.hasValidSignature():
public boolean hasValidSignature() {
if (NETWORK.equals(from)) return true;
...
Transactions from "network" bypass digital signature checks by design because there is no private key for the network.
However, in Blockchain.isValid(), there is no validation verifying the mining reward amount or the count of reward transactions:
- A block's mining reward can be altered from
MINING_REWARD(50) to an arbitrary amount (e.g.1,000,000coins). - A block can contain multiple
"network"reward transactions.
When a block's reward transaction is tampered with, the Merkle root recalculated, and the block re-mined to meet the difficulty target (as demonstrated in Menu Option 7), isValid() still returns true because:
- The recalculated Merkle root matches
block.getMerkleRoot(). - The re-mined block hash meets the difficulty target.
tx.hasValidSignature()returnstruefor"network"without validating that the amount equalsMINING_REWARD.
Expected Behavior
According to the README:
- "Mining: A mined block holds all waiting payments plus a 50 coin reward for the miner."
- "Validation:
isValid()returns false if anything in any mined block was changed..."
isValid() should verify that in each mined block:
- There is at most one transaction from
Transaction.NETWORK. - Any transaction from
Transaction.NETWORKhastx.amount() == MINING_REWARD.
If either invariant is violated, isValid() should return false.
- 主要语言
- Java
- 星标
- 0
- 派生
- 3
- 平均合并
- 1 天 18 小时
- 30 天内合并 PR
- 14
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
techcsispit/mini-chain 的其他 Issue
-
Blockchain.isValid() does not verify sender balance, allowing blocks with negative balances to pass validation可能已有人在做 @aadiitya2007 于 2 天前认领。 未关闭
难度 4/5 1-2 天 新手友好度 20/100
techcsispit/mini-chain#37 · 1 条评论 ·
维护者通常 2 天内回复
-
README says changing Block or Transaction makes chain.dat stop loading, but adding a field or method still loads it可能已有人在做 @tanujb03 于 14 天前认领。 未关闭documentation good first issue
难度 1/5 1 小时以内 新手友好度 25/100
techcsispit/mini-chain#21 ·
维护者通常 2 天内回复
-
Blockchain: a payment that was already mined can be submitted again, and it is accepted and mined a second time可能已有人在做 @aadiitya2007 于 4 天前认领。 未关闭bug good first issue
难度 3/5 1-2 天 新手友好度 52/100
techcsispit/mini-chain#16 · 1 条评论 · 已指派 1 人 ·
维护者通常 2 天内回复
查看 techcsispit/mini-chain 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 85/100
-
[Bug]: REST API URL starting with "http" but no scheme (e.g. httpbin.org/get) is not given an http:// prefix可能已有人在做 @ItsDeadlyProgrammer 于 1 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 68/100
appsmithorg/appsmith#42471 · 1 条评论 ·
维护者通常 2 天内回复
-
code-maintenance
难度 2/5 1-3 小时 新手友好度 77/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 85/100
-
bug priority: medium Review effort [1-5]: 3 status: needs-triage type: bug
难度 2/5 1-3 小时 新手友好度 82/100
carlos-emr/carlos#5258 ·
维护者通常 1 天内回复