Storage vs Memory Usage in a Simple Blockchain
📖 Scenario: You are building a simple blockchain to understand how data is stored permanently (storage) versus temporarily (memory) during transactions.
🎯 Goal: Create a small blockchain where blocks are stored permanently in a list (storage), and transactions are held temporarily in a memory list before being added to a block.
📋 What You'll Learn
Create a list called
blockchain to store blocks permanently.Create a list called
memory_pool to hold transactions temporarily.Add transactions to
memory_pool.When
memory_pool reaches 2 transactions, create a block and add it to blockchain.Print the
blockchain to show stored blocks.💡 Why This Matters
🌍 Real World
Blockchains store data permanently in blocks (storage), but transactions first live temporarily in memory pools before being added to blocks.
💼 Career
Understanding storage vs memory in blockchain helps in designing efficient decentralized applications and smart contracts.
Progress0 / 4 steps