项目作者: thiennc

项目描述 :
Scrooge Coin - Assignment 1 from the Coursera course "Bitcoin and Cryptocurrency Technologies"
高级语言: Java
项目地址: git://github.com/thiennc/Coursera-ScroogeCoin.git
创建时间: 2018-07-01T14:32:44Z
项目社区:https://github.com/thiennc/Coursera-ScroogeCoin

开源协议:

下载


ScroogeCoin

Assignments from the Coursera course “Bitcoin and Cryptocurrency Technologies”

You will be responsible for creating a file called TxHandler.java that implements the following API:

  1. public class TxHandler {
  2. /** Creates a public ledger whose current UTXOPool
  3. * (collection of unspent transaction outputs) is utxoPool.
  4. * This should make a defensive copy of utxoPool by using
  5. * the UTXOPool (UTXOPool uPool) constructor.
  6. */
  7. public TxHandler(UTXOPool utxoPool);
  8. /** Returns true if
  9. * (1) all outputs claimed by tx are in the current UTXO pool
  10. * (2) the signatures on each input of tx are valid
  11. * (3) no UTXO is claimed multiple times by tx
  12. * (4) all of tx’s output values are non-negative
  13. * (5) the sum of tx’s input values is greater than or equal
  14. * to the sum of its output values; and false otherwise.
  15. */
  16. public boolean isValidTx(Transaction tx);
  17. /** Handles each epoch by receiving an unordered array of
  18. * proposed transactions, checking each transaction for
  19. * correctness, returning a mutually valid array of accepted
  20. * transactions, and updating the current UTXO pool as
  21. * appropriate.
  22. */
  23. public Transaction[] handleTxs(Transaction[] possibleTxs);
  24. }