Layer What?? Explaining the Architecture of Blockchain

A presentation at THAT Conference in January 2024 in Round Rock, TX, USA by Ben Greenberg

Slide 1

Slide 1

Slide 2

Slide 2

@HummusOnRails

Slide 3

Slide 3

Layer What?? Explaining the Architecture of Blockchain

Slide 4

Slide 4

Hi 👋, I’m Ben Former BBS Sysop and current Head of Developer Relations at Fuel Network and Principal Consultant at Yalla, DevRel LLC. → @HummusOnRails

Slide 5

Slide 5

Our Journey Together ★ ★ ★ ★ ★ ★ Blockchain 101 Network Structure Consensus Mechanisms Smart Contracts dApps Blockchain Layers @HummusOnRails

Slide 6

Slide 6

Blockchain 101 @HummusOnRails

Slide 7

Slide 7

What is a blockchain? It’s a chain of blocks @HummusOnRails

Slide 8

Slide 8

@HummusOnRails

Slide 9

Slide 9

What can be sent? A blockchain can transmit any form of digital data, including but not limited to monetary transactions, smart contracts, images, documents and more. @HummusOnRails

Slide 10

Slide 10

What’s in a block? A block contains a block header (with metadata such as the previous block’s hash, a timestamp, and a nonce), a Merkle tree root hash representing the transactions included in the block, and a set of individual transaction records. @HummusOnRails

Slide 11

Slide 11

What’s in a block? @HummusOnRails

Slide 12

Slide 12

Down the rabbit hole…

Slide 13

Slide 13

Down the rabbit hole… @HummusOnRails

Slide 14

Slide 14

Who validates? Blockchain nodes are individual computers that validate and store a copy of the entire ledger, ensuring the integrity and consistency of the distributed network. @HummusOnRails

Slide 15

Slide 15

How are blocks validated? Blocks are validated through a consensus mechanism, where nodes verify transaction integrity and collectively agree on the block’s legitimacy. @HummusOnRails

Slide 16

Slide 16

What happens next? Once validated, a block is added to the blockchain as a permanent record and then propagated to all network nodes to ensure a consistent and updated ledger across the system. @HummusOnRails

Slide 17

Slide 17

Finally… After a block is added to the blockchain, the transactions within it are executed, updating user accounts and data, and triggering any relevant events or actions defined in smart contracts. @HummusOnRails

Slide 18

Slide 18

Network Structure What is a node? @HummusOnRails

Slide 19

Slide 19

Your computer. @HummusOnRails

Slide 20

Slide 20

Your phone. @HummusOnRails

Slide 21

Slide 21

Your toaster. @HummusOnRails

Slide 22

Slide 22

@HummusOnRails

Slide 23

Slide 23

Full Nodes These nodes maintain a complete copy of the blockchain ledger and validate each block and transaction according to the consensus rules of the network. @HummusOnRails

Slide 24

Slide 24

Light Nodes These nodes do not store the entire blockchain but instead hold only essential information. They rely on full nodes for more detailed information, making them more suitable for devices with limited resources. @HummusOnRails

Slide 25

Slide 25

Archive Nodes These nodes store the entire blockchain ledger, including historical states, which is beyond the requirements of a full node. They are useful for retrieving historical blockchain data. @HummusOnRails

Slide 26

Slide 26

RPC Nodes Nodes that provides an interface for interacting with the blockchain to send commands or requests, such as querying the current state of the blockchain, sending transactions, or invoking smart contract functions. @HummusOnRails

Slide 27

Slide 27

Down the rabbit hole…

Slide 28

Slide 28

Remote Procedure Call (RPC) RPC enables remote execution of functions and procedures in a distributed network, allowing clients to call server-side procedures with local-like simplicity, streamlining data exchange and system integration for developers. @HummusOnRails Down the rabbit hole…

Slide 29

Slide 29

You can run your own node. @HummusOnRails

Slide 30

Slide 30

@HummusOnRails

Slide 31

Slide 31

Why run your own node? Query rate limiting No third party dependency @HummusOnRails

Slide 32

Slide 32

Consensus Mechanisms @HummusOnRails

Slide 33

Slide 33

@HummusOnRails

Slide 34

Slide 34

Game theory. @HummusOnRails

Slide 35

Slide 35

Two players choose to be either aggressive “hawks” or passive “doves”. Both choose hawk, they both face high costs due to conflict. Hawk against dove, the hawk wins big, the dove gets nothing. Both as doves, they share a moderate reward. @HummusOnRails

Slide 36

Slide 36

Down the rabbit hole… Nash Equilibrium occurs when participants cannot benefit by changing their decision unilaterally, creating a state of stable, mutual strategy. @HummusOnRails

Slide 37

Slide 37

Players in “The Game” - Validators Delegators Transactors Developers Node Operators Governance Participants - Miners - Investors @HummusOnRails

Slide 38

Slide 38

Down the rabbit hole…

Slide 39

Slide 39

Byzantine Fault Tolerance Byzantine Fault Tolerance is a system property that allows a distributed network to reach consensus and maintain functionality, even when some nodes fail or act maliciously, ensuring consistent and reliable protocol execution among participants. @HummusOnRails Down the rabbit hole…

Slide 40

Slide 40

@HummusOnRails

Slide 41

Slide 41

Blockchain Trilemma Sc ala b ty uri c Se ility Decentralization @HummusOnRails

Slide 42

Slide 42

Proof of Work Proof of Work (PoW) necessitates solving cryptographic hash puzzles through brute-force computation, ensuring blockchain security and consensus by tethering block validation to CPU-intensive mining efforts. @HummusOnRails

Slide 43

Slide 43

Complete Hash Function Find Hash Value < Difficulty Target Broadcast Solution to All Nodes Nodes Verify Validity a. Correct Transaction Set b. Hash Below the Target 5. Block is Appended to Chain @HummusOnRails

Slide 44

Slide 44

Proof of Stake A stake-weighted selection process for block validation, where validators are chosen based on the amount they commit to stake. Validators risk losing their stake for dishonest behavior. (In Delegated Proof of Stake, stakeholders vote to elect a limited number of delegates to perform validation, optimizing for faster consensus and improved network throughput.) @HummusOnRails

Slide 45

Slide 45

  1. Validators Commit Their Stake 2. Algorithm Selects Validator (size of stake, other randomized factors) 3. Validator Constructs New Block 4. Other Validators Verify New Block’s Transactions 5. Block is Appended to Chain, Validators Receive Reward @HummusOnRails

Slide 46

Slide 46

  1. Token Holders Commit Stake for Validators 2. Network Elects Validators 3. Validator Constructs New Block 4. Other Validators Verify New Block’s Transactions 5. Block is Appended to Chain, Validators and Token Holders Receive Reward @HummusOnRails

Slide 47

Slide 47

Proof of Authority A consensus model where a limited number of pre-approved validators, identified through rigorous verification, create and validate blocks, offering a low-latency, energy-efficient mechanism @HummusOnRails

Slide 48

Slide 48

How do the different mechanisms address the Blockchain Trilemma? @HummusOnRails

Slide 49

Slide 49

Smart Contracts @HummusOnRails

Slide 50

Slide 50

Are you a Full Stack Developer? @HummusOnRails

Slide 51

Slide 51

Slide 52

Slide 52

The smart contract is the backend of your application … with some differences. @HummusOnRails

Slide 53

Slide 53

  1. Immutability
  2. Decentralization
  3. Trustless @HummusOnRails

Slide 54

Slide 54

How do you write a Smart Contract? @HummusOnRails

Slide 55

Slide 55

@HummusOnRails

Slide 56

Slide 56

Solidity Solidity is a statically-typed, contract-oriented programming language for writing smart contracts on the Ethereum blockchain, featuring syntax similar to JavaScript. @HummusOnRails

Slide 57

Slide 57

Slide 58

Slide 58

  1. Solidity by Example
  2. Crypto Zombies @HummusOnRails

Slide 59

Slide 59

Rust Rust is a systems programming language gaining popularity in smart contract development for its emphasis on safety, speed, and concurrent processing capabilities. @HummusOnRails

Slide 60

Slide 60

Slide 61

Slide 61

  1. Rust Book
  2. Rustlings @HummusOnRails

Slide 62

Slide 62

Sway Sway is a statically-typed, Rust-inspired domain-specific language designed for smart contract development, focusing on safe, parallelizable operations and optimized for high-throughput and efficient execution. @HummusOnRails

Slide 63

Slide 63

Slide 64

Slide 64

  1. Sway Docs
  2. Sway Playground
  3. Sway Example Apps @HummusOnRails

Slide 65

Slide 65

Decentralized Applications (dApps) @HummusOnRails

Slide 66

Slide 66

Have you heard of React? … or Vue? @HummusOnRails

Slide 67

Slide 67

Then, you can build your own dApp. @HummusOnRails

Slide 68

Slide 68

A decentralized application is a smart contract + a frontend @HummusOnRails

Slide 69

Slide 69

React Hooks Docs @HummusOnRails

Slide 70

Slide 70

@HummusOnRails

Slide 71

Slide 71

Smart Contract && Frontend == dApp @HummusOnRails

Slide 72

Slide 72

Blockchain Layers @HummusOnRails

Slide 73

Slide 73

@HummusOnRails

Slide 74

Slide 74

Layer 1 Layer 1 is the blockchain protocol itself, encompassing consensus mechanisms like Proof of Work or Proof of Stake, and is responsible for the network’s primary transaction processing, security, and data integrity. @HummusOnRails

Slide 75

Slide 75

Layer 2 A secondary framework or protocol that is built on an underlying blockchain to enhance scalability and transaction throughput, utilizing solutions like rollups. @HummusOnRails

Slide 76

Slide 76

Down the rabbit hole…

Slide 77

Slide 77

What is a rollup? A solution that aggregates and processes multiple transactions into a single batch, significantly enhancing throughput and efficiency while maintaining the underlying blockchain’s security guarantees. @HummusOnRails Down the rabbit hole…

Slide 78

Slide 78

Optimistic Rollups Execute transactions off-chain with presumed validity, batching them for on-chain verification, enhancing throughput with a fraud-proof system for retrospective dispute resolution, which allows network participants to challenge and rectify invalid transactions after they are processed. @HummusOnRails Down the rabbit hole…

Slide 79

Slide 79

ZK-Proof Rollups Leverage zero-knowledge proofs to batch and validate multiple off-chain transactions in a single on-chain proof, ensuring data integrity and privacy. @HummusOnRails Down the rabbit hole…

Slide 80

Slide 80

But, wait… What is a zero-knowledge proof?

Slide 81

Slide 81

Privacy-preserving cryptographic proof technique @HummusOnRails

Slide 82

Slide 82

Slide 83

Slide 83

Hybrid Proving Bridging the gap between Optimistic and ZK Rollups. This approach blends single-round fraud-proving models with ZK proofs. @HummusOnRails Down the rabbit hole…

Slide 84

Slide 84

Layer 3 The application layer, utilizing the underlying layers for secure, trustless transaction processing and application logic execution. @HummusOnRails

Slide 85

Slide 85

Conclusion @HummusOnRails

Slide 86

Slide 86

After our journey together, you are now officially a… @HummusOnRails

Slide 87

Slide 87

Blockchain Expert @HummusOnRails

Slide 88

Slide 88

ok, not really … but you do have a good foundation! 👏 @HummusOnRails

Slide 89

Slide 89

Continue your learning journey @HummusOnRails

Slide 90

Slide 90

● Mentorship programs ● Dedicated learning opportunities ● Networking events ● Exclusive swag @HummusOnRails

Slide 91

Slide 91

THANK YOU Questions? Comments? Hummus Recipes? @HummusOnRails

Slide 92

Slide 92

Credits ● ● ● ● ● http://bbslist.textfiles.com/619/ - Free Thinker BBS listing https://bytecellar.com/wp-content/uploads/2019/12/BBSing_image.jpg - Picture of BBS on monitor https://www.oreilly.com/library/view/mastering-bitcoin/9781491902639/ch07.html - Block contents https://www.flaticon.com - Icons used in slides https://www.explainxkcd.com/wiki/images/d/d7/xkcd_stack.png - XKCD cartoon @HummusOnRails