January 2019
Beginner to intermediate
372 pages
11h 17m
English
Whenever a node receives a transaction pool or a new block, all the transactions are validated before they store the transaction data in the local blockchain. The structure of each transaction is tested by checking the data structure of each field. Transaction inputs and outputs are also verified so that no invalid input or output is included:
def validate_transaction(transaction, a_unspent_tx_outs):
if not is_valid_transaction_structure(transaction):
return False
The transaction is rejected if the transaction structure is invalid:
if get_transaction_id(transaction) != transaction.id:
print('invalid tx id: ' + transaction.id)
return False
The transaction ID in this application is calculated using the SHA256 hash ...
Read now
Unlock full access