Module 1 – The REAL Transaction (Not the Marketing One)
Transaction anatomy, receipts; gas, fees, and real cost with numbers.
1) Technical Objective
The transaction is the only mechanism to change the universe (the blockchain state).
Objective: Understand the Cryptography that authorizes the change, the Anatomy of the data you send, and the Physics of Gas that limits computation.
2) Fundamental Concepts
2.1 The God Function: Hashing (Keccak-256)
Before understanding keys, understand the cement of all this: the Hash.
A Hash function is a one-way mathematical shredder.
– Input: “Hello” -> Output: 0xaa13...
– Input: “HELLO” -> Output: 0xbb92... (Totaly different).
– Key Property (Avalanche Effect): If you change a single bit of the input, the output changes completely.
– Utility: It allows us to verify that a 1TB file has not been modified without reading the whole 1TB. We only compare its “Digital Fingerprint” (Hash).
2.2 The Mailbox Metaphor (Asymmetric Cryptography)
In classic Internet you use passwords (symmetric cryptography: same key locks and unlocks).
In Blockchain you use two mathematically linked keys:
– Public Key: It is the Slot of the Mailbox on the street. Anyone can put letters in (send you money or encrypted messages).
– Private Key: It is the Physical Key of the Mailman. Only the one who has it can open the mailbox and retrieve the content (move money or decrypt messages).
Digital Signature: It is reverse encryption. You encrypt something with your Private Key, and anyone can “decrypt” it with your Public Key to confirm that only you could have written it.
2.3 The 12 Words (BIP-39) & HD Wallets
“Where is my private key in MetaMask?”
Actually, you have infinite keys.
– Seed Phrase: Those 12/24 words are NOT a password. They are the Root of Entropy of a tree.
– HD Wallet (Hierarchical Deterministic): From that seed, Branch 1 (Account 1) is born, Branch 2 (Account 2)…
– Danger: If you lose the seed, you lose access to all derived accounts forever. If you reveal the seed, all your accounts are stolen.
2.4 Why “0x…”? (The Derivation)
Your address 0x1a2b... is not random. It is the final destination of a mathematical journey:
1. Private Key (Random 256-bit number).
2. Public Key (Elliptic Curve Math on private key).
3. Hash of Public Key (Keccak-256).
4. Trim: We keep the last 20 bytes of the Hash.
Conclusion: The network does not “assign” you an account. You discover an account that already existed mathematically.
3) Real Anatomy of a Transaction
A transaction is not a “money movement”. It is a signed message with instructions. Mandatory fields:
1. Nonce: A sequential counter (0, 1, 2…). Prevents “Replay Attack” (me copying your payment from yesterday and resending it to charge you again today).
2. Gas Limit: The maximum gasoline you are willing to spend.
3. Gas Price (or Max Fee): The price per liter you pay the miner.
4. To: The recipient (user or contract).
5. Value: Amount of ETH to transfer.
6. Data: Extra data. If checking plain transfer, it is empty (0x). If calling a contract, function code goes here (0xa905...).
7. v, r, s: The three parts of your digital signature (ECDSA). Without this, the tx is garbage.
4) Gas (The “Physics” of EVM)
Ethereum is a shared computer. If you run an infinite loop, you hang the global network.
To avoid this, every operation costs “Gas”.
– Sum (ADD): 3 gas.
– Multiplication (MUL): 5 gas.
– Read state (SLOAD): 2100 gas (reading disk is slow).
– Write state (SSTORE): 20,000 gas (writing is very expensive because every node in the world must save that datum forever).
Gas Limit: If your transaction runs out of gas halfway, it stops (Out of Gas). The state reverts (as if nothing happened), but the miner keeps your money because the computation work was done.
5) LAB 1 — Forensic Dissection
Objective: Cryptographically verify a transaction and audit its cost.
Procedure
- Pick a Tx on Etherscan.
- Verify Signature (Conceptually):
– Look atFromandInteracted With (To).
– Understand the node verifiedv, r, svariables againstFromaddress before processing it. - Case Study: Uniswap Swap:
– Look atGas Used(~150,000).
– Compare with simple ETH Transfer (21,000 fixed).
– Why the difference? Because Swap executed hundreds of sums, subtractions and writes (SSTORE) to calculate price change and update Pool balances.
Mental Deliverable
- Why is writing on blockchain 10,000 times more expensive than reading?
- Why do I need ETH to send USDT? (Because you need ETH to pay for the gasoline of computation moving the USDT).
6) Reasoning Quiz
- If you lose your Private Key, can Ethereum tech support recover it? (No, there is no tech support. It is math, not a service).
- If you put
Gas Limit: 20,000for a simple transaction (requiring 21,000), what happens? (Fails with “Out of Gas” immediately). - What field of the transaction prevents me from resending your payment from yesterday to charge you again today? (The Nonce).
7) CTA
Your signature is your will. Gas is the price to execute it. Audit both.
