A10: Blockchain Identity Lab - Answer Key
Document Purpose: Complete solutions for all phases and reflection questions
Phase 1: MetaMask Wallet Setup - Solutions
Expected MetaMask State After Setup
| Setting | Expected Value |
|---|---|
| Network | Sepolia test network |
| Balance | 0.05+ SepoliaETH (varies by faucet) |
| Account address | Visible in MetaMask header (0x... format, 42 characters) |
Teaching note: Students must switch MetaMask from Ethereum Mainnet to the Sepolia test network. If the Sepolia option is not visible, they should enable test networks under Settings > Advanced > Show test networks. Faucet availability varies; if one faucet is down, direct students to an alternative Sepolia faucet.
Phase 2: On-Chain Name Registration - Solutions
1Example Name String
2Hex Conversion Walkthrough
Input: Alice Johnson - Cryptoeconomics 2026
ASCII to Hex (character by character):
A=41 l=6c i=69 c=63 e=65 (space)=20 J=4a o=6f h=68 n=6e s=73 o=6f n=6e (space)=20 -=2d (space)=20 C=43 r=72 y=79 p=70 t=74 o=6f e=65 c=63 o=6f n=6e o=6f m=6d i=69 c=63 s=73 (space)=20 2=32 0=30 2=32 6=36
Full hex string:
416c696365204a6f686e736f6e202d2043727970746f65636f6e6f6d6963732032303236
With 0x prefix:
0x416c696365204a6f686e736f6e202d2043727970746f65636f6e6f6d6963732032303236
Teaching note: Students can use any online ASCII-to-hex converter or a Python one-liner: "Alice Johnson - Cryptoeconomics 2026".encode().hex(). The important concept is that all data on the blockchain is stored as hex-encoded bytes.
3Transaction Parameters
| Parameter | Value |
|---|---|
| To | [Student's own address] (self-transaction) |
| Value | 0 ETH |
| Hex Data | 0x416c696365204a6f686e736f6e202d2043727970746f65636f6e6f6d6963732032303236 |
| Gas | ~21,064 gas (slightly more than 21,000 base due to non-zero calldata bytes) |
Why ~21,064 gas? The base transaction cost is 21,000 gas. Each non-zero byte of calldata costs 16 gas, and each zero byte costs 4 gas. For the example name string (36 bytes, mostly non-zero), the additional gas is approximately 36 x 16 = 576, though the exact amount depends on how many zero bytes appear in the hex encoding. MetaMask estimates this automatically.
4Etherscan Verification
Steps:
1. Copy the transaction hash from MetaMask after confirmation
2. Navigate to https://sepolia.etherscan.io/tx/[TX_HASH]
3. Scroll to "Input Data" section
4. Click "View Input As" > select "UTF-8"
Expected display: Alice Johnson - Cryptoeconomics 2026
Common Errors and Fixes
- Forgetting the "0x" prefix: MetaMask rejects the transaction because it cannot parse the hex data without the standard prefix. Always prepend
0xto the hex string. - Copying hex with spaces: Hex strings must be continuous with no spaces. Remove all whitespace before pasting into MetaMask.
- Hex Data field not visible: Students must enable hex data in MetaMask under Settings > Advanced > Show Hex Data (toggle on).
- Transaction stuck/pending: Sepolia can sometimes be slow. Wait a few minutes or try increasing the gas price slightly.
Phase 3: IPFS Profile Photo Upload - Solutions
1Example IPFS Upload
| Field | Example Value |
|---|---|
| File | alice_photo.jpg (2.1 MB) |
| CID | QmT5NvUtoM5nWFfrQdVrFtvGfKFmG7AHE8P34isapyhCxX (example) |
| Gateway URL | https://your-gateway.mypinata.cloud/ipfs/QmT5NvUtoM5nWFfrQdVrFtvGfKFmG7AHE8P34isapyhCxX |
Note: Replace "your-gateway" with the student's actual dedicated gateway subdomain from Pinata. Each Pinata account receives a unique dedicated gateway. Students should verify the image loads correctly via the gateway URL before proceeding.
2On-Chain CID Storage
Text to convert:
IPFS_CID:QmT5NvUtoM5nWFfrQdVrFtvGfKFmG7AHE8P34isapyhCxX
Hex encoding:
0x495046535f4349443a516d5435...
(Full hex continues for the entire CID string)
Transaction: Same 0 ETH self-transaction pattern as Phase 2
Teaching note: The prefix "IPFS_CID:" is a convention to make the data self-describing when decoded. Without it, someone reading the raw UTF-8 would see a random-looking string. With the prefix, the purpose is immediately clear.
3Verification Chain
Three-step verification:
1 Etherscan tx → decode Input Data as UTF-8 → see CID string
2 Copy CID → paste into dedicated Pinata gateway URL → image loads
3 This proves: the image existed at the time of the transaction, and the content matches the CID hash
Key concept: The blockchain transaction provides a tamper-proof timestamp. The CID provides content-addressable integrity (any change to the image would produce a different CID). Together, they form a verifiable chain of evidence linking an identity to a specific photo at a specific point in time.
Common Errors and Fixes
- 403 error on gateway link: The old public gateway (gateway.pinata.cloud) is deprecated. Students must use their account-specific gateway URL from their Pinata dashboard (format: your-gateway.mypinata.cloud/ipfs/CID).
- CID not resolving on IPFS: The file may still be propagating. Wait 1-2 minutes and retry. Ensure the file was pinned successfully in Pinata.
- Wrong CID format after hex conversion: The CID string must be converted as-is (including the "IPFS_CID:" prefix if used). Verify by decoding the hex back to UTF-8 before sending the transaction.
- Image too large for Pinata free tier: Pinata free tier allows files up to 25MB individually and 1GB total. If students hit limits, suggest resizing the photo to under 5MB.
Phase 4: NFT Identity Badge (Bonus) - Solutions
1thirdweb Deployment
| Parameter | Value |
|---|---|
| Contract type | ERC-721 (NFT Collection) |
| Network | Sepolia |
| Typical cost | 2-3 transactions (deploy + initialize) |
Teaching note: thirdweb provides a no-code deployment interface. Students connect their MetaMask wallet, select "NFT Collection" (ERC-721), fill in a name and description, and deploy. The deployment requires SepoliaETH for gas.
2NFT Metadata
Metadata fields:
- Name, description, and image are stored in the token URI
- thirdweb uploads metadata to IPFS automatically
- Token ID: 0 (first NFT in the collection)
How it works: The ERC-721 standard defines a tokenURI() function that returns a URL pointing to a JSON metadata file. thirdweb handles the IPFS upload of both the image and the JSON metadata, then sets the token URI on-chain. The metadata JSON follows the OpenSea metadata standard with "name", "description", and "image" fields.
3OpenSea Testnet Verification
URL pattern:
https://testnets.opensea.io/assets/sepolia/CONTRACT_ADDRESS/0
Notes:
- May take 5-10 minutes to index after minting
- Use the "Refresh Metadata" button if the image is not showing
- CONTRACT_ADDRESS is the deployed contract address from thirdweb
Common Errors and Fixes
- thirdweb not connecting to MetaMask: Ensure MetaMask is on the Sepolia network. Try disconnecting and reconnecting the wallet in thirdweb.
- Insufficient SepoliaETH for deployment: ERC-721 deployment requires more gas than a simple transaction. Students may need to request additional testnet ETH from a faucet.
- OpenSea not showing NFT image: Click "Refresh Metadata" on the NFT page. OpenSea testnet indexing can take 5-10 minutes. Try pasting the direct URL: testnets.opensea.io/assets/sepolia/CONTRACT_ADDRESS/0
- thirdweb UI has changed: thirdweb updates their dashboard frequently. If the deployment flow differs from the instructions, the core steps remain: Deploy > NFT Collection (ERC-721) > Sepolia > Mint.
Reflection Question Answers
Q1: Privacy Implications of On-Chain Identity
Good answer: Blockchain data is public, permanent, and linked to an address. Unlike social media profiles, you cannot delete or edit information once it is confirmed in a block. However, the address itself is pseudonymous -- it is just a string of hex characters not inherently tied to a real-world identity. This lab deliberately links a real name to an address, removing that pseudonymity. Students should recognize the tension: blockchain provides transparency and tamper-resistance, but at the cost of privacy. In practice, once a name is linked to an address, all past and future transactions from that address become attributable to that person.
Q2: Why Store a CID Instead of the Image Directly?
Good answer: Ethereum charges gas per byte of calldata -- approximately 16 gas per non-zero byte and 4 gas per zero byte. A 5 MB image would require roughly 5,000,000 bytes of calldata, costing approximately 80 million gas. At typical gas prices, this would cost hundreds of dollars even on mainnet. In contrast, an IPFS CID is approximately 46 bytes, costing negligible additional gas beyond the base 21,000. IPFS provides the actual storage layer, while the blockchain provides the tamper-proof timestamp and integrity proof. This separation of concerns -- cheap off-chain storage linked to expensive but immutable on-chain references -- is a fundamental pattern in blockchain architecture.
Q3: What Happens if You Modify the Image After Upload?
Good answer: Yes, the CID would change completely. IPFS uses cryptographic hashing (SHA-256 based) to generate content identifiers. Even a single bit change in the source file produces a completely different hash. This is the "avalanche effect" covered in Lesson 3 (Cryptographic Foundations). The original CID stored on-chain would still point to the original image (if any node still hosts it), while the modified image would have an entirely new CID. This property is what makes the system tamper-evident: you cannot alter the photo without invalidating the on-chain reference.
Q4: How Does Blockchain Immutability Protect This Identity Record?
Good answer: Once the transaction is mined into a block and subsequent blocks are added on top, the data cannot be altered without redoing the proof-of-work or proof-of-stake for all subsequent blocks. On Sepolia (and Ethereum mainnet), this becomes computationally infeasible after just a few block confirmations. The name and CID are permanently embedded in the block history. No single party -- not even the person who created the transaction -- can modify or delete the record. This immutability is what gives the identity registration its credibility: anyone can independently verify the data by querying the blockchain.
Q5: What Happens if Pinata Goes Offline?
Good answer: If Pinata goes offline, the CID still exists on the IPFS network as long as ANY node has pinned the content. Other IPFS gateways (or a local IPFS node) could serve the file using the same CID. However, if NO node pins the content, it will eventually be garbage-collected from the network. The blockchain only stores the CID -- a proof that a specific file existed -- not the file itself. This illustrates the critical difference between on-chain and off-chain storage: the blockchain guarantees the reference is immutable, but it cannot guarantee the off-chain content remains available. In production systems, multiple pinning services or redundant IPFS nodes are used to ensure persistence.
INSTRUCTOR ANSWER KEY - CONFIDENTIAL
© Joerg Osterrieder 2025-2026. All rights reserved.