Lecture 13: Etherum

Code: ROM (Read-only memory) calldata: arguments

There are two types of instructions: Arithmatic including SHA3 and sys operations like create [contract], call [contract], and delegate call etc.

CALL – called code is executed in the context of called contract
CALLLOAD – called code is executed in the context of the current contract, msg.sender is calling contract
DELEGATECALL – similar to callload except msg.sender remains unchanged

Exceptions: leads to execution halting

Applications

  1. DB: NameCoin
  2. Auctions: decentralized eBay but since everything is public, requires commitments to have sealed bid auctions.

How to safely transfer funds?

check-effects-interaction paradigm

Events can be used for getting callbacks and execute a task in response to a change on the chain.

Use selfdestruct(beneficiary) to kill a contract and send the leftover money to beneficiary.