加密货币:为什么交易输入必须是先前的输出?

时间:2019-05-07 07:35:28

标签: blockchain cryptocurrency

我正在尝试为自己建立一个使用权益证明的原型区块链(加密货币)。

我不了解比特币的概念,交易的每个输入必须是先前的输出。这背后的原因是什么?是否存在不遵循该原则的加密货币? (https://en.bitcoin.it/wiki/Transaction

非常感谢您的帮助!

1 个答案:

答案 0 :(得分:1)

因为比特币基于“账单”模型。大多数传统货币交易都使用“帐户”模式,例如您的网上银行。

您的比特币地址中没有总余额。主网记录您的所有交易流。因此,处理交易是不同的。只有超支的输出。您可以找到一篇文章为您解释比特币UTXO。我们只在这里谈论模型。

“帐户”模型进行交易:

1.input the amount that you want to transfer.
2.check your balance on your account.
3.minus the amount from your current balance.
4.add the amount to target account balance.

“帐单”模型进行交易:

1.check all the unspent part of the output from any transaction( like check balance)
2.use one of the output or some of them to fit your target amount
3.make a transaction to your target address 
4.set a  output to your own address for the rest amount

第二个问题,ETH使用帐户模型。

相关问题