Reasoning about Ethereum's Role
Presented by: Cayman Nava (caymannava@gmail.com)
Naive Eth-mail
if tx.sender == CONTRACTCREATOR: if tx.data[0] == 1: suicide(CONTRACTCREATOR) else: NEXTINDEX = contract.storage[999] contract.storage[1000 + NEXTINDEX] = tx.data[0] contract.storage[999] = NEXTINDEX + 1
https://gist.github.com/WeMeetAgain/10010529
Naive Message Board
// data[0] = topic
// data[1] = message
if tx.data[0]:
NEXTINDEX = contract.storage[sha3(tx.data[0])]
contract.storage[sha3(tx.data[0]) + 1 + NEXTINDEX] = tx.data[1]
contract.storage[sha3(tx.data[0])] = NEXTINDEX + 1
webrtc.org
Connecting to a peer

WHO - Friend list
if tx.sender != CONTRACTCREATOR:stopif tx.data[0] == 0:contract.storage[1000+tx.data[1]] = tx.data[2]elif tx.data[0] == 1:suicide(CONTRACTCREATOR)
WHO - topic-group connection
if tx.data[0] == 0: // update contractif tx.data[1] < 1000: // if the contractAddress isn't valid, stopstopcontract.storage[tx.sender] = tx.data[1]if tx.data[0] == 1: // update topicif tx.data[1] < 1000: // if the topic isn't valid, stopstopif contract.storage[tx.sender + 1]: // if address has an old topicTOPICROOT = sha3(32,contract.storage[tx.sender+1])LEN = contract.storage[TOPICROOT]INDEX = contract.storage[tx.sender + 2]// set swapped address to new index position and set address indexcontract.storage[TOPICROOT+INDEX] = contract.storage[TOPICROOT+LEN]contract.storage[contract.storage[TOPICROOT+INDEX] + 2] = INDEXcontract.storage[LEN] = 0// decrement old topic lengthcontract.storage[sha3(32,contract.storage[tx.sender + 1])] = LEN - 1TOPICROOT = sha3(32,tx.data[1])LEN = contract.storage[TOPICROOT]// add address to topic list and increment lengthcontract.storage[TOPICROOT+LEN+1] = tx.sendercontract.storage[TOPICROOT] = LEN + 1// store topic and index in list for later lookupcontract.storage[tx.sender+1] = tx.data[1]contract.storage[tx.sender+2] = LEN + 1
Questions, comments, corrections?