@HummusOnRails

Layer What?? Explaining the Architecture of Blockchain

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

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

Blockchain 101 @HummusOnRails

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

@HummusOnRails

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

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

What’s in a block? @HummusOnRails

Down the rabbit hole…

Down the rabbit hole… @HummusOnRails

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

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

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

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

Network Structure What is a node? @HummusOnRails

Your computer. @HummusOnRails

Your phone. @HummusOnRails

Your toaster. @HummusOnRails

@HummusOnRails

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

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

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

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

Down the rabbit hole…

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…

You can run your own node. @HummusOnRails

@HummusOnRails

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

Consensus Mechanisms @HummusOnRails

@HummusOnRails

Game theory. @HummusOnRails

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

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

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

Down the rabbit hole…

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…

@HummusOnRails

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

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

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

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

  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

  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

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

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

Smart Contracts @HummusOnRails

Are you a Full Stack Developer? @HummusOnRails

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

  1. Immutability
  2. Decentralization
  3. Trustless @HummusOnRails

How do you write a Smart Contract? @HummusOnRails

@HummusOnRails

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

  1. Solidity by Example
  2. Crypto Zombies @HummusOnRails

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

  1. Rust Book
  2. Rustlings @HummusOnRails

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

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

Decentralized Applications (dApps) @HummusOnRails

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

Then, you can build your own dApp. @HummusOnRails

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

React Hooks Docs @HummusOnRails

@HummusOnRails

Smart Contract && Frontend == dApp @HummusOnRails

Blockchain Layers @HummusOnRails

@HummusOnRails

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

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

Down the rabbit hole…

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…

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…

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…

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

Privacy-preserving cryptographic proof technique @HummusOnRails

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…

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

Conclusion @HummusOnRails

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

Blockchain Expert @HummusOnRails

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

Continue your learning journey @HummusOnRails

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

THANK YOU Questions? Comments? Hummus Recipes? @HummusOnRails

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