Complete the code to define a standard message format for blockchain transactions.
transaction = {"sender": "Alice", "receiver": "Bob", "amount": 10, "currency": [1]The currency field should be a string representing the token type, like "BTC" for Bitcoin.
Complete the code to check if a transaction follows the standard by verifying the presence of the 'sender' key.
if [1] in transaction:
To verify the transaction standard, we check if the 'sender' key exists in the transaction dictionary.
Fix the error in the code that validates the transaction amount is positive.
if transaction["amount"] [1] 0:
The amount should be greater than 0 to be valid.
Fill both blanks to create a dictionary comprehension that maps transaction IDs to their amounts only if the amount is greater than 5.
filtered_transactions = {tx_id: transaction[[1]] for tx_id, transaction in transactions.items() if transaction[[2]] > 5}We use 'amount' as the key to get the transaction amount for both mapping and filtering.
Fill all three blanks to create a dictionary comprehension that maps uppercase sender names to their transaction amounts if the currency is 'ETH'.
eth_transactions = { [1]: [2] for tx_id, transaction in transactions.items() if transaction[[3]] == "ETH" }The comprehension maps the sender's uppercase name to the amount, filtering only transactions with currency 'ETH'.