0
0
Blockchain / Solidityprogramming~10 mins

Accounts (EOA vs contract accounts) in Blockchain / Solidity - Interactive Practice

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

Complete the code to check if an address is an Externally Owned Account (EOA).

Blockchain / Solidity
if len(address.code) == [1]:
    print("This is an EOA.")
Drag options to blanks, or click blank then click option'
A0
BNone
C1
DTrue
Attempts:
3 left
💡 Hint
Common Mistakes
Using 1 instead of 0 for code length.
2fill in blank
medium

Complete the code to send Ether from an EOA to another address.

Blockchain / Solidity
tx = {
    'from': sender,
    'to': receiver,
    'value': [1]
}
Drag options to blanks, or click blank then click option'
Aamount_in_wei
B'amount'
C0
D'0x0'
Attempts:
3 left
💡 Hint
Common Mistakes
Using string literals instead of numeric values.
3fill in blank
hard

Fix the error in the code that tries to call a contract function from an EOA.

Blockchain / Solidity
contract = web3.eth.contract(address=contract_address, abi=contract_abi)
result = contract.functions.[1]().call()
Drag options to blanks, or click blank then click option'
Atransfer
BmyFunction
CsendTransaction
DbalanceOf
Attempts:
3 left
💡 Hint
Common Mistakes
Using generic or incorrect function names.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps EOAs to their balances if balance is greater than 0.

Blockchain / Solidity
balances = {addr: [1] for addr in addresses if [2] > 0}
Drag options to blanks, or click blank then click option'
Aweb3.eth.get_balance(addr)
Baddr
Dbalance
Attempts:
3 left
💡 Hint
Common Mistakes
Using variable names that are not defined.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps contract addresses to their code size if code size is greater than zero.

Blockchain / Solidity
contract_codes = {addr: len([1]) for addr in contract_addresses if len([2]) [3] 0}
Drag options to blanks, or click blank then click option'
Aweb3.eth.get_code(addr)
C>
D==
Attempts:
3 left
💡 Hint
Common Mistakes
Using equality check instead of greater than.