Blockchain Architecture &
Development
Lecture 1 – Distributed Systems
A distributed system is a network of independent nodes that communicate through messages. All
nodes share a common goal. Nodes:
are independent
are part of a distributed system because they are connected with each other through other
nodes.
The system, with independent nodes, behaves as 1 entity to all its users.
3 characteristics
1. Concurrency (simultaneous) of components
Multiple nodes (servers) work simultaneous.
2. Lack of a global clock
Due to the absence of any system-wide clock that is accessible to all processes , the
notion of common time does not exist in a distributed system; as a result, it is not always
possible to determine the order in which two events on different processes were
executed.
3. Independent failure of components
Dysfunction, malfunction, or breakdown of node doesn’t cause the system to fail.
Well-designed distributed systems don’t go down when a node malfunctions or gets
congested.
CAP theorem
In the past, when we wanted to store more data or increase our processing power, the common
option was to scale vertically or further optimize the existing code database.
With the advances in parallel processing and D.S., it is more common to expand horizontally, or have
more machines to do the same task in parallel.
We’d like to see these 3 conditions simultaneously. CAP Theorem is a concept that a distributed
system can only have 2 of 3 conditions at the same time.
1 Blockchain Architecture & Development 2022-2023
,Consistency
This condition states that all nodes see the same data at the same time.
Simply put: performing a read operation will return the most recent write operation causing all
nodes to return the same data.
A system has consistency if a transaction starts with the system in a consistent state, and ends
with the system in a consistent state.
A system can read shift into an inconsistent state during a transaction, but the entire transaction
gets rolled back if there is an error during any stage in the process.
Consistency in distributed systems means every node / replica has the same view of data at a
given point in time irrespective of whichever client has updated the data.
Availability
This condition states that every request gets a response on success/failure.
Achieving availability in a D.S. requires that the system remains operational 100% of the time.
Every client gets a response, regardless of the state of any individual node in the system. This
metric is trivial to measure:
o Either you can submit read/write commands, or you cannot.
Hence, the databases are time independent as the nodes need to be available online at all times.
Partition Tolerance
The system continues to run, despite the number of messages being delayed by the network
between nodes.
A system that is partition-tolerant can sustain any amount of network failure that doesn’t result
in a failure of the entire network
When dealing with modern distributed systems, partition tolerance is necessary.
Hence, we have to trade between consistency and availability.
Partition tolerance means that entire clusters can still work even if a network partition causes
communication interruption between nodes.
Consistent + available = not partition tolerant
This system is consistent and always available. Partitions are not tolerated. This combination is not
realistic in distributed networks...
Conclusion
D.S.s allow us to achieve a level of computing power and availability that were simply not
available in the past
D.S.s have higher performance, lower latency, and near 100% up-time in data centers that span
the entire globe.
Best of all, the systems of today are run on commodity hardware that is easily obtainable and
configurable at affordable costs.
However, there is a price:
D.S.s are more complex than their single-network counterparts.
Understanding the complexity incurred in D.S.s, making the appropriate trade-offs for the task at
hand (CAP), and selecting the right tool for the job is necessary.
2 Blockchain Architecture & Development 2022-2023
,Characteristics of a distributed app
Applications that run on a decentralized peer-to-peer network
Not on a single computer
Source code is open source
Owned by the ecosystem
o No single node in the network has complete control over the distributed app
Decentralized applications don’t necessarily need to run on top of a blockchain network
DAPP: BitTorrent
BitTorrent is a peer-to-peer file-sharing protocol that enables massive distribution of files over the
Internet. It allows users to share very large files like movies, books and TV shows. The BitTorrent
protocol helps to efficiently download files from the Internet.
Terminology
Seeding: serving a file for download
Leech: a client who is downloading from the seeders
Leeching: to download without contributing
Chunk: a piece of a file typically 64KB to 256KB in size
Tracker: a middleman who informs the peers of all the other peers in the network
Peer: a client to the network dedicated to a torrent
Seeder: a peer who has all the blocks in a torrent
Chocked: a connections is choked if not file data is passed through it
Interest: indicates whether a peer has blocks which other peers want
Snubbed: a peer acting poorly – not uploading – or sending bad control messages (disconnected)
Reseeding: if no one is currently sharing a file, it must be reintroduces the network by someone
who has a complete copy of the file
The challenge
Decentralized peers are ‘anonymous’
A big challenge is to detect and prevent peers from making invalid changes
o To the application data
o Sharing wrong information with others
We need some sort of ‘consensus’ between the peers regarding whether the data published by a
peer is right or wrong.
o No central server in a decentralized app to coordinate the peers and decide what is right
and wrong
o Therefore, it becomes really difficult to solve this challenge.
Consensus protocols are designed specifically for the type of data structure the decentralized
application users.
Byzantine fault tolerance
Exchanged hashes
Decentralized applications need to be open source
Decentralized applications use clients and open API interfaces
3 Blockchain Architecture & Development 2022-2023
, The more value, and reason, the ecosystem has to exist, the more chances there are it will
survive and be used
o No users – no value
o No transactions – no reason to exist
The more reason the ecosystem has to be decentralized the better change to attract users and
bring value
Advantages
dApps are fault-tolerant as there is no single point of failure because they are distributed by
design
no central authority
o no central authority to whom the government can pressurize to remove some content
o governments cannot block the app’s domain or IP address as dApps are not accessed
via a particular IP address or domain. Thus: owned by the people governing the
ecosystem.
It is easy for users to trust the application
o It’s not controlled by a single authority that could possibly cheat the users for profit.
o However: that doesn’t mean data is safe as anyone using the ecosystem
It is anonymous
Can share anything
Hard to remove data
o In BitTorrent: even 0 seeds and 0 leech files can be revived by simply reseed the original
Disadvantages
Fixing bugs or updating dApps is difficult , as every peer in the network has to update their node
software.
Some applications require verification of user (KYC), as there is no central authority to verify
the user identity, it becomes an issue while developing such applications.
o However: decentralized trust authorities and applications are on the rise
They are difficult to build because they use very complex protocols to achieve consensus and
they have to be built to scale from the start itself. So we cannot just implement an idea and then
later on add more features and scale it.
o However: blockchains and smart contracts make this more easy
Applications are usually independent of third-party APIs to get or store something. dApps
shouldn’t depend on centralized application APIs, but dApps can be dependent on other dApps.
As there isn’t a large ecosystem of dApps yet, it is not that easy to build a dApp.
o Although dApps can be dependent on other dApps theoretically, it is very difficult to
tightly couple dApps practically.
o Again – blockchains with smart contracts leverage dApps .
Definition decentralized application
are digital applications that run on a blockchain network of computers instead of relying on a
single computer. Because dApps are decentralized, they are free from the control and interference
of a single authority.
4 Blockchain Architecture & Development 2022-2023
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller xanderdjema. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $11.32. You're not tied to anything after your purchase.