Validating Scrooge Coin Transactions


Data Structure of Transactions

This section explains the data structure of Scrooge Coin transactions.

Every transaction consists of multiple inputs and outputs. The outputs of a transaction include the amount and the recipient’s address (public key). The inputs of a transaction consist of the hash value of the previous transaction that contains the corresponding output, the index of this output in that transaction (an integer starting from 0), and the owner’s digital signature.

Conditions for Input Validity

For an input to be valid, the signature included in it must be a valid signature for the current transaction. If the owner of the coin does not agree to spend their coins, the transaction is considered invalid.

Fig 1: Scrooge Coin Transaction Data Structure

Special Transactions: CreateCoins and PayCoins

Here, Transaction 1 is a CreateCoins transaction, which creates new coins and, therefore, does not have inputs. It outputs the coins to their first owner. Since this is a transaction for creating new coins, no signature is required. Transactions 2 and 3 are PayCoins transactions, which consist of inputs and outputs.

Conditions for Transaction Validity

Next, let’s examine what needs to be confirmed to ensure that a Scrooge Coin transaction is valid. The following five conditions must be satisfied for a PayCoins transaction to be declared valid:

  1. All outputs requested by the transaction exist in the current UTXO pool.
  2. The signature of each input in the transaction is valid.
  3. No UTXO is requested multiple times within the transaction.
  4. All output amounts of the transaction are non-negative.
  5. The total input amount of the transaction is greater than or equal to the total output amount; otherwise, it is invalid.

UTXO Pool and Transaction Flow

A UTXO (Unspent Transaction Output) refers to coins recorded on the blockchain⛓️ that have not been spent, and the collection of these is called the UTXO pool. In a sequence of transactions, the transaction output can be seen as unspent coins. For the next recipient, these outputs become inputs. Once a transaction consumes these inputs, they are removed from the UTXO pool.

Recording Valid Transactions

By adding valid transactions to a block and connecting it to the blockchain, Scrooge ensures that these transactions are publicly recognized and recorded.

,

Leave a Reply

Your email address will not be published. Required fields are marked *