0
0
Blockchain / Solidityprogramming~10 mins

Why security prevents financial loss in Blockchain / Solidity - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to check if a transaction is valid before processing.

Blockchain / Solidity
if transaction.[1]():
    process(transaction)
Drag options to blanks, or click blank then click option'
Asign
Bis_valid
Csend
Dexecute
Attempts:
3 left
💡 Hint
Common Mistakes
Using methods that perform actions instead of checking validity.
2fill in blank
medium

Complete the code to verify the digital signature of a transaction.

Blockchain / Solidity
if verify_signature(transaction.[1], public_key):
    approve(transaction)
Drag options to blanks, or click blank then click option'
Ahash
Bamount
Ctimestamp
Dsignature
Attempts:
3 left
💡 Hint
Common Mistakes
Trying to verify the hash or amount instead of the signature.
3fill in blank
hard

Fix the error in the code that prevents unauthorized spending.

Blockchain / Solidity
if balance >= transaction.[1]:
    deduct(balance, transaction.amount)
Drag options to blanks, or click blank then click option'
Aamount
Bfee
Csignature
Dtimestamp
Attempts:
3 left
💡 Hint
Common Mistakes
Checking fee or signature instead of the amount.
4fill in blank
hard

Fill both blanks to create a secure transaction record with hash and timestamp.

Blockchain / Solidity
transaction_record = {
    'hash': [1],
    'timestamp': [2]
}
Drag options to blanks, or click blank then click option'
Acompute_hash(transaction)
Bget_time()
Ccurrent_time()
Dtransaction_data
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong functions for hash or timestamp.
5fill in blank
hard

Fill all three blanks to filter and store only secure transactions.

Blockchain / Solidity
secure_transactions = {
    [1]: [2] for [3] in transactions
    if verify_signature([3], public_key)
}
Drag options to blanks, or click blank then click option'
Atx_id
Btx_data
Ctx
Dtransaction
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing variable names or using wrong keys and values.