0
0
Blockchain / Solidityprogramming~30 mins

Why Ethereum enables programmable money in Blockchain / Solidity - See It in Action

Choose your learning style9 modes available
Why Ethereum Enables Programmable Money
📖 Scenario: Imagine you want to create a simple digital wallet that can hold money and send it to others automatically based on rules you set. Ethereum lets you do this by using smart contracts, which are like small programs that run on the blockchain.
🎯 Goal: You will build a simple program that shows how Ethereum can hold money and send it automatically when a condition is met. This is the basic idea behind programmable money.
📋 What You'll Learn
Create a dictionary called wallet with an initial balance of 100
Create a variable called send_amount and set it to 30
Write an if statement that checks if wallet['balance'] is greater than or equal to send_amount
Inside the if, subtract send_amount from wallet['balance'] and print a message showing the new balance
If the balance is not enough, print a message saying 'Insufficient funds'
💡 Why This Matters
🌍 Real World
Ethereum lets people write small programs called smart contracts that can hold and send money automatically based on rules. This is useful for things like automatic payments, loans, or games.
💼 Career
Understanding programmable money is important for jobs in blockchain development, fintech, and software engineering where automation and smart contracts are used.
Progress0 / 4 steps
1
Create the wallet with initial balance
Create a dictionary called wallet with a key 'balance' set to the integer 100.
Blockchain / Solidity
Need a hint?

Use curly braces {} to create a dictionary and set the key 'balance' to 100.

2
Set the amount to send
Create a variable called send_amount and set it to the integer 30.
Blockchain / Solidity
Need a hint?

Just write send_amount = 30 to create the variable.

3
Check if wallet has enough balance
Write an if statement that checks if wallet['balance'] is greater than or equal to send_amount.
Blockchain / Solidity
Need a hint?

Use if wallet['balance'] >= send_amount: to start the condition.

4
Send money if enough balance, else show error
Inside the if, subtract send_amount from wallet['balance'] and print "Sent {send_amount}. New balance: {wallet['balance']}". Use an else to print "Insufficient funds" if balance is not enough.
Blockchain / Solidity
Need a hint?

Use wallet['balance'] -= send_amount to subtract. Use print(f"Sent {send_amount}. New balance: {wallet['balance']}") to show the message.