JSON-RPC 方法构想:列出晚于指定 txid 对应交易的交易

中本聪SN-3752

这样使用 listtransactions 是不安全的。

It's not safe to use listtransactions this way.

我知道我一直因为对 listtransactions 迟迟不肯松口而挨批。让我解释一下我为什么犹豫。

I know I've been criticized for being reluctant about listtransactions. Let me explain my reluctance.

交易是动态的。过去的交易或许会失去确认、消失又回来、失效并彻底消失,或者被另一笔双重支付取代。它们的日期或许会变,顺序也或许会变。

Transactions are dynamic. Past transactions can become unconfirmed, go away and come back, become invalid and disappear, or be replaced by a different double-spend. Their date can change, their order can change.

程序员很自然地会想这样使用 listtransactions:把自上次查询以来的新交易提供给我,我自己记账或保存静态记录。这在一切常规使用中似乎都没问题,但只要你依据这些金额做任何操作,这种做法就很容易被利用:

Programmers are naturally inclined to want to use listtransactions like this: feed me the new transactions since I last asked, and I'll keep my own tally or static record of them. This will seem to work in all regular use, but if you use the amounts for anything, it is highly exploitable:

1) 你怎么知道一笔过去的交易失效并消失了?

1) How do you know if a past transaction becomes invalid and disappears?

2) 发生区块链重组时,交易重新确认后很容易被重复计数。

2) When there's a block-chain reorg, it would be easy to double-count transactions when they get confirmed again.

3) 一笔交易或许被 txid 不同的双重支付取代。你会把两笔支出都算进去。

3) A transaction can be replaced by a double-spend with a different txid. You would count both spends.

「我只需要看新交易、因之前的交易我已经看过了」这个假设模型不成立。旧交易随时可能改变。

The model where you assume you only need to see new transactions because you've already seen previous transactions is not true. Old transactions can change at any time.

每当你基于收到的支付金额采取行动,你都必须重新向比特币查询当前的总余额(或使用 move 或 sendfrom),并做好余额可能下降的准备。

Any time you take an action based on payment amounts received, you always need to go back to bitcoin and ask for a current balance total (or use move or sendfrom), and be ready for the possibility that it can go down.

现在我们有了账户功能,能更容易地按正确方式做事,因此推出 listtransactions 的时机更成熟了。

Now that we have the Accounts feature making it easier to do it the right way, we're better prepared to have listtransactions.

译文校对、修订与纠错

当前版本尚未建立逐条校对状态记录。来源核验、历史审校与当前译文校对是不同事项。

查看历史审校与代表修订 →

译文内容版本:b4148151de6d。用于比对文本,不代表校对等级或更新时间。

准备纠错说明

请填写对应原文、现译文、建议译法和理由。复制后通过你联系本站作者的渠道提交;此处不会自动发送。

来源
英文原标题

JSON-RPC method idea: list transactions newer than a given txid

Bitcointalk · 原始链接 ↗ 记录编号 SN-3752

阅读字号

选择适合你的字号,之后阅读会继续使用。