CSBC 1000 - Fundamentals of Backend and Blockchain Development
Class 12: Revision
Dhruvin Parikh
Class Plan
- Milestone #2 Presentation
- Three tier architecture
- Software Design Principles
- DLT (digital ledger platform)
- Product development process
- Cryptography and security
- Bitcoin, Ethereum & HLF
DBMS architecture
- Single tier architecture
- Client, server and database reside on same machine
- Two tier architecture
- Server and database reside on same machine
- Three tier architecture
- functional processes, logic, data access, data storage and UI interface done independently a separate modules
Three tier DBMS architecture diagram

Layers of 3 tier architecture
- Presentation layer
- Application layer
- Java, .NET, C#, Python, C++
- Database server
- MySQL, PostgreSQL, SQL Server, MongoDB
High level design

Three tier application architecture

Backend development
- Selecting database (SQL v/s NoSQL)
- Application configuration
- Code Review
- Testing - unit, integration, system, acceptance
- Technical debt
- Deployment environments
- Development, testing, staging, production
Development stacks
- LAMP stack - Linux Apache MySQL PHP
- MEAN stack - MongoDB Express Angular Node
- MERN stack - MongoDB Express React Node
- JAM stack - Javascript API Markup
Common programming paradigms
- Procedural Programming
- sequentially ordered operations
- Functional Programming
- Object Oriented Programming
- Encapsulation, Inheritance and Polymorphism
SOLID principles
- High quality software program :
- Understandable
- Upgradeable
- Maintainable
Simple Responsibility Principle
- A function or class should have only one reason to change
- If a class or function has to be be refactored due to change in logic than it has more than one responsibility
- Passing class object as a parameter is known as dependency injection
Open Closed Principle
- Class or function should be open for extension and closed for modification
Liskov Substitution Principle
- Code (behaviour) can be shared between a class and its derived classes called “subclasses”
Interface Segregation Principle
- Interfaces should not contain code that the end client (user of your code) will not use
Dependency Inversion Principle
- Invert the order of dependencies in code
- The low level information becomes concrete implementation of abstract high level information
- High level code is independent of details beneath it
- Low level implementations should depend on abstractions above them
Why decentralize?
- Eliminate Single Points of Failure
- If everyone relies on a centralized service, everyone loses service if it breaks or goes away
- Diffuse control
- Absolute power corrupts absolutely
- Better to give large numbers of people little bits of power
Meanings of decentralization
- Architectural decentralization
- Many computers instead of one
- Political decentralization
- Many people controlling the system
- Logical decentralization
- Many different variations of protocols or data
- Blockchains are logically centralized
web3/dapps
- Concept for a semi-decentralized application
- Usually uses normal URLs, but your identity and authorization is isolated from the websites
- The blockchain is used as a back-end
- But: Most dapps use a normal back-end as well
- Large amounts of data can be verified by merkle trees
DApp architecture

Agile manifesto (1/4)
- Our highest priority is to satisfy the customer through early and continuous delivery of valuable software.
- Welcome changing requirements, even late in development. Agile processes harness change for the customer’s competitive advantage.
- Deliver working software frequently, from a couple of weeks to a couple of months, with preference to the shorter timescale.
Agile manifesto (2/4)
- Business people and developers must work together daily throughout the project.
- Build projects around motivated individuals. Give them the environment and support they need, and trust them to get the job done.
- The most efficient and effective method of conveying information to and within a development team is face-to-face conversation.
Agile manifesto (3/4)
- Working software is the primary measure of progress.
- Agile processes promote sustainable development. The sponsors, developers, and users should be able to maintain a constant pace indefinitely.
- Continuous attention to technical excellence and good design enhances agility.
Agile manifesto (4/4)
- Simplicity -- the art of maximizing the amount of work not done -- is essential.
- The best architectures, requirements, and designs emerge from self-organizing teams.
- At regular intervals, the team reflects on how to become more effective, then tunes and adjusts its behavior accordingly.
Scrum
- Scrum Artifacts
- Scrum roles
- Scrum ceremonies
Scrum roles
- Development team
- Product owner
- Project manager
- Scrum master
Scrum ceremonies
- Sprint planning
- Daily scrum
- Sprint review (demo)
Sprint process

Cryptography
- Way to hash and unhash the messages using a pass key
- Types of cryptography
- Symmetric key Cryptography
- Asymmetric key Cryptography
Symmetric key Cryptography
Sender and receiver generates and uses fresh key every-time to encrypt and decrypt messages.
Asymmetric key Cryptography
A message signed using public key can be decrypted using private key and vice versa.
Public and private keys
- Use good randomness to choose a private key
- Always keep your private key secret!
- Each private key has a corresponding public key
- Your public key is your bitcoin/ethereum address
Public keys and addresses
- secp256k public keys are 64 bytes
- Ethereum addresses are 20 bytes
- To compute an ethereum address from a public key:
- Hash public key with keccak256 (giving 32 bytes)
- Take last 20 bytes of hash
- Encode as hexadecimal
- Prefix with "0x"
- Optional: Compute checksum
Birth of Blockchain technology

Blockchain
- Peer to peer
- Group of nodes
- Miners
- Transaction
- Block
- Consensus
- Token
- State
- Smart contract
Block structure
- Decentralized public database that keeps a permanent record of the digital transactions

Merkle tree

Consensus
- Need for consensus
- Two general's problem
- Byzantine Generals Problem
What is Ethereum
- Decentralized platform to run smart contracts
- no single point of failure
- censorship resistant
- Account-based model
- Distributed state machine
- block of transaction modeled as state transition function
Ethereum
- Ethereum has a native asset called Ether
- basis of value in Ethereum ecosystem
- need to align incentives
- given to miners as reward to mint blocks
Ethereum vs Bitcoin
- Ethereum : Smart contract platform
- Complex but feature-rich
- Turing complete scripting language
- Account based model
- Bitcoin : Decentralized asset
- Simple and robust
- Simple stack based language; not Turing complete
- UTXO based model
EVM (Ethereum Virtual Machine)

Public permissionless blockchains
- Public networks
- Open to anyone,
- Participants interact anonymously
- Bitcoin
- Ethereum
- Account model
- Smart contract
Limitation of public permissionless technologies
- Identity of participant
- Low transaction throughput
- High transaction confirmation latency
- Privacy and confidentiality of transactions
Enter Hyperledger Fabric
- Open source
- Enterprise-grade
- Permissioned DLT platform
- Established under linux foundation
HLF transaction flow

Bug Bounties
- Web3 native platforms
- Traditional platform
- Bounty collaboration
- Crowd sourced security solutions
CSBC 1000 - Fundamentals of Backend and Blockchain Development
Class 12: Revision
Dhruvin Parikh