0
0
Blockchain / Solidityprogramming~15 mins

Why blockchain exists - See It in Action

Choose your learning style9 modes available
Understanding Why Blockchain Exists
📖 Scenario: Imagine you want to keep a shared list of transactions with your friends, but you don't want anyone to cheat or change the list secretly. You need a way to make sure everyone agrees on the list and no one can change past entries. This is why blockchain was created.
🎯 Goal: Build a simple program that shows how blockchain keeps data safe and agreed upon by everyone. You will create a list of blocks, add new blocks only if they follow the rules, and print the chain to see the result.
📋 What You'll Learn
Create a list called blockchain with one block containing the string 'Genesis Block'
Create a variable called new_data with the string 'Transaction 1'
Add a new block to blockchain only if new_data is not empty
Print the entire blockchain list
💡 Why This Matters
🌍 Real World
Blockchain is used to keep records safe and shared without a central boss. This helps in money transfers, contracts, and more.
💼 Career
Understanding blockchain basics is useful for jobs in finance, software development, and security where trust and data safety matter.
Progress0 / 4 steps
1
Create the initial blockchain list
Create a list called blockchain with one block containing the string 'Genesis Block'.
Blockchain / Solidity
Need a hint?

The first block is called the 'Genesis Block'. Use a list with one string inside.

2
Add new transaction data
Create a variable called new_data and set it to the string 'Transaction 1'.
Blockchain / Solidity
Need a hint?

Just assign the string 'Transaction 1' to the variable new_data.

3
Add new block if data is valid
Add a new block to the blockchain list only if new_data is not an empty string. Use an if statement to check this.
Blockchain / Solidity
Need a hint?

Use if new_data != '' to check if new_data has content before adding it.

4
Print the blockchain
Print the blockchain list to show all blocks.
Blockchain / Solidity
Need a hint?

Use print(blockchain) to show the list.