Web3 Smart Contract Adventure

100 ETH
0x7f...3a4b
Beginner's Journey 25% Complete

Lesson 2: Understanding Smart Contracts

Smart contracts are self-executing contracts with the terms of the agreement directly written into code. They run on blockchain networks like Ethereum.

// Simple Storage Contract Example

pragma solidity ^0.8.0;


contract SimpleStorage {

uint storedData;


function set(uint x) public {

storedData = x;

}


function get() public view returns (uint) {

return storedData;

}

}

Key characteristics of smart contracts:

  • Immutable: Once deployed, the code cannot be changed
  • Transparent: Code is visible to everyone on the blockchain
  • Self-executing: Runs automatically when conditions are met
  • Trustless: No need for intermediaries

Interactive Exercise

Let's interact with a simulated smart contract. This contract stores a number that anyone can update.

Blockchain Simulator

Block #1
Genesis Block
0x000...000
Block #2
Your Wallet Created
0x7f3...a4b
Block #3
Ready for new transactions
Pending...
$ Welcome to Web3 Adventure!
$ Your wallet is connected: 0x7f...3a4b
$ Balance: 100 ETH

Transaction History

Wallet Creation 2 min ago
+100 ETH

Your Achievements

Wallet Setup
First Contract
Solidity Pro