# Lab Guide: Ethereum Interactive Lecture

Duration: 30 minutes (workshop portion of the 90-minute lecture)
Network: Remix VM (in-browser chain) for the primary path; Sepolia testnet for the optional level-up
Tools: a normal browser tab; that is the entire toolchain
Reference: ../prd.json story D4

This guide is the student-facing companion to the lecture. The primary path produces a deployed `HelloWorld` smart contract on the Remix VM (an in-browser Ethereum-compatible chain). It needs no MetaMask, no test ETH, no Python, no account anywhere.

If you arrived with the items in `pre_class/checklist.md`, the optional level-up at the end deploys the same contract on the public Sepolia testnet, viewable on Etherscan.

## Note on screenshots

The screenshot annotations in this guide (e.g. `lab_guide_assets/step3_compile.png`) are placeholders. The instructor captures the actual screenshots during the dry-run on the same browser version that students will use; see `instructor_kit/dryrun_signoff.md`. The lab is fully usable without the screenshots, since the steps are described in text.

## Before you start

Read this paragraph from `instructor_kit/security_brief.md`:

> TEST WALLET ONLY, NEVER REUSE THIS SEED. The wallet you create or use in class is for learning only. It has zero monetary value, was set up on classroom infrastructure, and may be exposed. Never fund this wallet with real ETH. Never import this seed phrase into a real-money wallet. Never use the same seed phrase for testnet and mainnet. When the workshop ends, write the seed phrase down and store it offline, OR delete the wallet entirely.

If anything in the workshop confuses you, raise your hand and ask the TA. There are no stupid questions.

## Primary path

The primary path is what every student does. It runs entirely in your browser. Internet is required only to load the Remix tab; once loaded, no further network call is needed.

### Step 1: Open Remix

1. Open a new browser tab and go to https://remix.ethereum.org
2. Wait for the page to fully load. Remix is a complete Solidity IDE, all in JavaScript.
3. If a "Welcome" panel pops up, close it.

If Remix does not load (blank page, console errors, plugins fail to register):

- **Brave**: click the Brave Shields icon in the address bar and set "Shields" to "DOWN" for this site.
- **Strict tracker blockers (uBlock, NoScript)**: temporarily allow `remix.ethereum.org` and reload.
- **Corporate browser policy blocking the site**: switch to a personal browser, OR follow the instructor-projected fallback in `instructor_kit/fallback_plan.md`.

### Step 2: Create the file

1. In the left panel, click the "File explorers" icon (looks like a file).
2. Right-click on the `contracts` folder, choose "New File".
3. Name it `HelloWorld.sol`.
4. Paste this code into the editor:

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
contract HelloWorld {
    string public greeting = "Hello, Class";
}
```

That is the entire contract. Three meaningful lines plus the license and pragma.

**Personalize it.** Change the string `"Hello, Class"` to something only you would write, e.g. `"Hello from Anna"` or `"Hello, world. -- Pedro"`. This makes your contract unique on the chain. Save the file (Ctrl+S or Cmd+S).

### Step 3: Compile

1. Click the "Solidity Compiler" icon in the left panel (looks like a stack of papers).
2. Click `Compile HelloWorld.sol`.
3. Status indicator: a green checkmark plus the text "compiled successfully" appears. If you see a red error, raise your hand.

(Screenshot: `lab_guide_assets/step3_compile.png`. The screenshot shows the Solidity Compiler panel with a green status badge and the file `HelloWorld.sol` listed under "Contracts".)

### Step 4: Deploy on the in-browser chain

1. Click the "Deploy & run transactions" icon (looks like an Ethereum diamond with a play arrow).
2. In the "Environment" dropdown at the top, select `Remix VM (Cancun)` or whichever Remix VM the page offers. THIS IS A PRIVATE IN-BROWSER CHAIN. Only your tab can see it.
3. Click `Deploy`.
4. Wait for the green checkmark in the terminal at the bottom of the page.

(Screenshot: `lab_guide_assets/step4_deploy.png`. The screenshot shows the Deploy panel with a deployed contract appearing in the "Deployed Contracts" section.)

### Step 5: Read the greeting

1. In the "Deployed Contracts" panel (lower part of the same tab), expand the deployed `HelloWorld` contract.
2. Click the blue `greeting` button.
3. The output is `string: greeting Hello, Class`.

(Screenshot: `lab_guide_assets/step5_read.png`. The screenshot shows the deployed contract expanded with the greeting button clicked and the returned value displayed below it.)

You have just deployed and read your first smart contract. The artifact is real on the in-browser chain. The chain is private to your tab.

### Why your chain is private

Remix VM is a fully featured Ethereum-compatible chain that runs ENTIRELY inside your browser tab. Every transaction is real, every block is real, but only your tab can see them. Close the tab and the chain is gone.

The chain you watched the instructor deploy on (during the anchor demo at minutes 35 to 38 of the lecture) was Sepolia. That chain is shared across the entire world. Same code, different chain. The shared property is what makes Ethereum Ethereum; see `instructor_kit/security_brief.md` for the honesty pattern.

## Level-up (optional)

This section is for students who completed `pre_class/checklist.md`. If you skipped it, that is fine: the primary path is your full success state.

### Step 6: Switch Remix to Injected Provider

1. In Remix's "Deploy & run transactions" panel, change "Environment" from `Remix VM (Cancun)` to `Injected Provider - MetaMask`.
2. MetaMask pops up and asks to connect; approve.
3. Confirm MetaMask is on Sepolia (top-left dropdown of MetaMask).

### Step 7: Deploy on Sepolia

1. Click `Deploy`. MetaMask shows a transaction confirmation.
2. Approve. The transaction broadcasts to Sepolia.
3. Wait 15 to 30 seconds for confirmation.

### Step 8: View on Etherscan

1. In Remix's "Deployed Contracts" panel, copy the contract address.
2. Open https://sepolia.etherscan.io in a new tab. Paste the address.
3. The page shows your contract, public to the world.

If anything fails (faucet rate limit, MetaMask refusal, network congestion), stay on the primary path. The level-up is optional and isolated. See `instructor_kit/fallback_plan.md`.

## Take-home

After class, you can open the companion notebook to read your contract from Python. The notebook is take-home only.

> TAKE-HOME LEVEL-UP. Open this AFTER class, not during.

Notebook path: `notebook/ethereum_companion.ipynb`. The notebook can be uploaded to Colab; it pins web3.py to a known-working version and reads (a) your own deployed contract by address and (b) one famous historical mainnet transaction.

For further reading, see `references.md` (vetted starting points sorted easiest-first, plus an explicit "do not read this" list).

## Glossary (English to German)

| English | German |
|---------|--------|
| EVM (Ethereum Virtual Machine) | Ethereum Virtuelle Maschine |
| RPC (Remote Procedure Call) | Entfernter Prozeduraufruf |
| gas | Gas (Transaktionsgebühr) |
| nonce | Nonce (laufende Transaktionsnummer) |
| wallet | Geldbörse (Schlüsselverwaltung) |
| seed phrase | Sicherungsphrase, Wiederherstellungsphrase |
| hash | Streuwert, kryptografische Prüfsumme |
| Solidity | Solidity (Programmiersprache für Smart Contracts) |
| bytecode | Bytecode (kompilierter Maschinencode) |
| transaction | Transaktion |
| smart contract | Smart Contract, intelligenter Vertrag |
| account | Konto |
| testnet | Testnetz |
| mainnet | Hauptnetz |
| faucet | Hahn (Wasserhahn für Test-ETH) |

## Final reminder

Read once more from `instructor_kit/security_brief.md`:

> Never fund this wallet with real ETH. Never import this seed phrase into a real-money wallet. If you want a real-money wallet later, install MetaMask fresh on a clean machine and generate a NEW seed phrase.

The instructor's dry-run sign-off lives at `instructor_kit/dryrun_signoff.md`. Confirm with the instructor that the sign-off shows PASS before committing time to the level-up.
