In the second article of the series, I will describe in more detail some of the main challenges of blockchain. We will find out what a peer-to-peer network is, and what are smart contracts as well as decentralized applications. Together, we will also take a look at the world of Web3. I will describe how these concepts come together.
If you want to read about the basics, history, and potential uses of blockchain, I invite you to read the first article:
The Guide to Blockchain: How Does It Work?
Grab a hot coffee, sit back - and let’s begin a new adventure.
What Is a Peer-to-Peer Network
This term has two different but related meanings in computer science and finance. In peer-to-peer computing, it is a group of related devices that share data together. In finance, this term refers to the exchange of resources via a distributed network between seller and buyer without the use of a middleperson such as a central administrator.
Each network user acts as an individual node. Each node has copies of the transferred files. It is a client and server for other nodes at the same time. Each node is able to download and upload files to other nodes.
The more peer-to-peer users, the faster and more efficient the network. Thanks to the distribution, there is no central server to attack, so peer-to-peer networks are resistant to hacking attacks and this is one of the most important advantages of peer-to-peer networks.
Peer-to-peer architecture is an integral part of blockchain technology. Thanks to it, no middlepeople are required in cryptocurrency transactions between network users, as previously described. Anyone can become a node.
Nodes need to reach a consensus to add a new block to the blockchain. The network is safe, and the bigger it is, the more secure it is. Such networks are resistant to DoS attacks that other systems often struggle with. In addition to security and decentralization, resistance to censorship is also important. In essence, cryptocurrencies are censorship-free and anonymous.
Smart Contracts - Definition
A smart contract is a blockchain program. It acts as a set of predefined rules enforced by the program. All network nodes will perform the tasks specified in the digital smart contract when and if certain conditions are met. Thanks to this, peer-to-peer network users can enter into contracts with each other via blockchain, with the certainty that if the conditions are not met, the contract will not be enforced. In addition, the use of smart contracts eliminates middlepeople, significantly reducing operating costs.
The concept of smart contracts was discussed for the first time by Nick Szabo in the 1990s as contractual agreements in payment and credit systems. Another person who popularized smart contracts was the co-founder of Ethereum Vitalik Buterin.
A smart contract only performs the activities for which it was designed. The performance of a given contract will always be the same, regardless of who initiates the first interaction. In the Ethereum network, a smart contract consists of a code and two public keys. The first public key is the one provided by the contract creator. On the other hand, the second key represents the contract itself, acting as its digital identifier. Launching a smart contract requires a transaction in the blockchain network.
Smart contracts are resistant to changes. They cannot be changed once they’ve been enacted. If such a function has been implemented earlier, the given smart contract can be removed and replaced with a new one, but if it has not been added in advance, it will not be possible to do so.
Therefore, the creators of smart contracts often divide one large smart contract into several smaller ones and decide which functions of their smart contract they give the possibility to remove in order to be able to update them later.
What are Decentralized Applications?
Decentralized applications (dApps for short) are applications that run on a blockchain. They can be similar to all the applications we know, but they have a differently constructed backend based on smart contracts that operate in a distributed network (peer-to-peer), rather than on a centralized server which is usually the case.
The goal of decentralized applications is to streamline many traditional services using blockchain technology, e.g. finances, games, and social media. You can connect to dApps using a cryptocurrency wallet (e.g. metamask), which ensures anonymity. You don't need an email and password. All you need is a wallet.
Thanks to a decentralized application, it is more difficult to hack the network. DApps provide greater network security, anonymity, and transparency at the same time.
On the network stage, you can see who sent a given cryptocurrency to whom and how much - but when the transaction is completed via a dApp - you don't know who was the sender and who was the recipient. The rules of operation of a given application are included in the smart contract. Once a smart contract is implemented on the blockchain, it is difficult to change or destroy the code. Therefore, even if the team behind dApp has been disbanded, users can still access it - even if the site does not work on the domain. They can then connect via a blockchain.
DApps - Examples
Popular use cases for decentralized applications:
DEX / DeFi - decentralized exchanges and finance. You can exchange your tokens on them by trading directly with other users using smart contracts. Orders are executed on-chain and directly between users' wallets. In addition to exchanging tokens, you can add them to staking and to the liquidity fields.
GameFi - Play2Earn type games - you can play and earn in-game tokens. Often the games are also linked to the NFT. You have your NFT character and thanks to it, you can earn game tokens by playing with other users, and then you can sell them, just like you'd do with regular cryptocurrency.
Move-to-earn platforms (Move2Earn) - when you complete physical activities, you get to earn platform tokens that you can later exchange.
Decentralized Autonomous Organizations (DAOs) - with the help of smart contracts, users who have management tokens for a given blockchain project, can create proposals for which the community can vote anonymously.
DApps are growing very fast and may have many more viable non-cryptocurrency uses in the future, e.g. free, non-decentralized social media. They are also the beginning of what Web3 may be in the future.
Web3 - What’s Next
Web3 is the next step in the development of new web applications. Web 1.0 were static HTML pages where users could only display information. Web 2.0 was the internet of dynamic websites. Users could share their content with other users through social media and instant messaging - both based on the databases processed on the side of a centralized server. Once user content is online, users lose ownership and control.
Web3 was created to give users more freedom through blockchain-based decentralization. It is not only the blockchain itself and the peer-to-peer network, but also a technology that is also largely based on artificial intelligence and machine learning. All this is to make the web more personalized and familiar, reflecting user behavior.
Data storage will be scattered among users and will no longer belong to the tech giants. Algorithms will learn our behavior and will tell us the content that interests us the most. This is already happening, in mainstream social applications, we can see what the algorithms tell us. In Web3, this will happen on a larger scale. At the moment, we cannot yet say in what direction exactly it will go. The main goal is to take data from corporations and give it to users in a distributed network.
Web3 is also linked to the metaverse. Advanced 3D graphics as well as augmented and virtual reality will be used in web3 applications. There are already prototypes that work, but we will have to wait a while until full adoption.
The current application of Web3 is used in decentralized applications: DEX/DeFi and play-to-earn cryptocurrency games, or move-to-earn platforms. The future of Web3 is being built right now.
Summary
You may look at the topics presented in this article as unrelated, but if you look closely enough, they are more so than you think.
Peer-to-peer networks are used for the decentralized exchange of resources between users, which are defined in smart contracts, i.e. what and how agreements are to be performed when the given contract conditions are met. Smart contracts are used in dApps. DApps are the beginning of what Web3 may be in the future: the Internet with more user-based freedom, not a centralized server.
In the next article, I will try to describe the role of cryptography in blockchain. We will also look at the hashing function in more detail, and describe what a consensus algorithm is, using examples.