zettel

Byzantine Fault Tolerance

Relevant to distributed computing and blockchain Two generals problem: loyal and traitor generals each command an army The only communications they have are through messages that have latency and failure Two choices: Attack or stay put How do you create an algorithm, such that loyal generals follow it, while traitors do not, such that the imperfect group can complete the mission?

Ethereum

ABI: interface functions and definitions known at compile time (strongly statically typed) devp2p network protocol explained

Remote machines

Set up a headless jupyter notebook server on a specific port On the remote machine (helpful to have tmux): jupyter notebook --no-browser --port=8890 On the local machine: ssh -N -f -L localhost:8888:localhost:8890 username@hostip

Zero Knowledge Proofs (ZKPs)

Motivation I first got introduced to ZKPs through the crypto world, through a currency called Monero. I always thought money laundering with Bitcoin was possible, but it’s not really. Bitcoin is pseudo-anonymous, and there are lots of marked and ‘poisoned’ bitcoins out there people know were acquired through hacks or other black market activity.

Bookmaking

Bookmaking is creating a betting market around events and taking a profit home. How do you get the original odds though? There’s true chance, and the odds people believe. You manipulate these, just adjust the proportion, and create your profit.

bZx hack review

clever arbitrage also involving a smart contract bug flashloan 10k eth from dYdX hoard 112 WBTC by compound borrowing with 5500 ETH margin trade sETHwBTC “meta” market. Think of stock short like Apple-USD Drive up wBTC and shit on ETH.

LLVM

From this ELI5 https://www.reddit.com/r/learnprogramming/comments/t6y74/eli5_what_is_llvm_can_it_be_used_for_general/ Normally source code to assembly LLVM is a middleman VM that can make things easier on both ends (source code to LLVM, LLVM to assembly)

Commit and Reveal scheme

Commitment schemes remind me of differential privacy, and the XOR trick learnt in competitive programming (XOR a set of numbers that all have a duplicate except one). Suppose you want to generate a random number that nobody can predict (AKA a random number).

Ethereum Virtual Machine

Virtual Machine - runtime environment “computer running on computer” e.g. JVM allows interoperability (cross-platform) has it’s own bytecode (rather than assembly). An intermediary language specifically for smart contracts has its own instrucation set big endian ordering (most sig byte at smallest memory) ROM not RAM, not Von Neumann stack based architecture (as opposed to register) has memory(volatile) and storage(non-volatile)

Solidity Ref

Language that targets the EVM. Basic template pragma solidity __version__ contract NameOfContract { // state variables // public makes accessible from other contracts (like a global variable on the chain) // event can react from a trigger // error provide info on why fail // functions // fallback function if anything is called } General constructor called at beginning msg is a global variable Can check whether msg.