blockchain.lucas.zip

Practicals, starters and solutions

The code each practical starts from, the demo code, and the reference solutions once a session has run. · Updated 14 October 2026

Everything a practical hands out lives here, as a zip archive built from this site’s own repository, so that a practical started in the room can be finished at home from the same files. Unzip, npm install, and read the README inside.

PracticalSessionStarterReference solution
A, wallet, node, first transactionsDay 1None neededNone needed
B, GuestbookDay 1None: the prerequisites projectPublished here after Day 2
C, SimpleEscrowDay 2None: a fresh npx hardhat --initIn day-3-reentrancy.zip, as contracts/SimpleEscrow.sol and test/SimpleEscrow.ts
D, a frontend for SimpleEscrowDay 2escrow-frontend.zip: Vite, React, wagmi, both networks configured, a wallet button, an empty pagePublished here after Day 2
E, deploy and verifyDay 2None: your Practical C and D projectsNone needed
Breaking an escrow, then fixing itDay 3day-3-reentrancy.zip: the vulnerable escrow, the fixed one, the attacker, and the tests that show the differenceIt is its own solution

day-3-reentrancy.zip

A Hardhat 3 project. npm install, then npx hardhat test: seventeen tests, of which two are the demonstration. VulnerableEscrow is SimpleEscrow with the guard removed and the balance zeroed after the transfer; Attacker is a freelancer whose receive calls withdraw again; Rejecter is a freelancer that cannot receive ETH at all, which is what pull payments are for. The escrow is also the reference solution to Practical C, so read it after you have written yours, not before.

escrow-frontend.zip

npm install, copy .env.example to .env.local with your chain and your contract’s address, then npm run abi -- <path to your SimpleEscrow artifact> to give the page your ABI, and npm run dev. The wallet button works; the page is yours to fill in, following Practical D. Switching it to Base Sepolia for Practical E is two lines in .env.local.