Decentralized Book Recs

Nouhaila Fellahi
13 min readJan 6, 2022

--

Yep, you read that right! I’ve included a video tutorial on how to make it at the end of the article! But before, I’m also going to be talking about DApps and what they really are, so either way, come along for the ride :)

Decentralized?

When saying decentralized, what is meant is: built on and supported by a blockchain.

centralized network versus decentralized network
Centralized network vs. Decentralized network

All participants in a centralized system are connected to one main point which controls input and output from and to each participant.

This leaves the whole network very vulnerable to attacks from outside or from within the system itself.

Blockchain

You guessed it: blockchain is a chain of blocks.

Each one of these blocks contains the following:

  • Transactions processed. When users are making transactions on the blockchain, they aren’t automatically processed. They are broadcasted to the network where they wait for a miner who groups the latest transactions made together into a block. They then perform the proof-of-work necessary to verify and broadcast the block onto the blockchain. The wait-time varies from one chain to the other.
  • Timestamp: the time the block was mined. When I say ‘mined’ I mean verified to not contain any fraudulent transactions and broadcasted to the network so everyone can add it to their version of the blockchain.
  • Nonce: the number generated in the process of verifying the block. I won’t be talking much about nonces in this article, but the article linked here goes deeper into explaining what nonces are.
  • Hash of the previous block: this part is what makes the blockchain immutable. Every block contains the hash of the previous block. So if someone tries to modify the transactions in a certain block, they’d have to modify the ones of all the blocks after it. Which can turn out to be a near-impossible process if you own a minority of the blockchain. (i.e. less than 50%)

This chain is consistently updated on every computer or node connected to it. These computers are called nodes, which are what keep the blockchain running at all times. Meaning every time a transaction is made, it’s broadcasted to the whole network and every node automatically records it on its version of the ledger, which makes it immutable.

This also means that as long as more than a few nodes are always connected on the network, any supported blockchain could never be taken down.

Take Bitcoin for example (the chain, not cryptocurrency): it technically could never be taken down. There are millions of nodes connected to it. So since there is no way found of shutting down millions of computers around the world at the same time, it’s going to be there forever.

Uno Game

UNO

Let’s think of blockchain as an Uno game.

Let’s say you and your friends are gathered at your house on a Friday night, very bored, and you all decide to play a few rounds of Uno, though that night, you were feeling very bored, and in need of something to spice it up, so you decide to bet a certain amount of money on each round.

There are 5 of you, and you know that some of your friends can be sore losers so you don’t completely trust that they will remember the right winners. You then all decide to take out a sheet of paper each and record the results of each round to calculate who owes what at the end.

You guys end up playing a few entertaining rounds, and at the end, it’s time to calculate the wins and losses so you all take out your sheets of paper, and all have the same thing written down.

But your friend Bob was feeling funky that night so he decided to write down his loss as a win on one of the rounds. You and your other friends all have the same answers though, so you all realize and agree that Bob’s recording was the fraudulent one.

Now that you know Bob wrote down a false win, you realize he might’ve written down even more false wins, so you decide to throw away Bob’s paper overall and decide to stay on the safe side.

Permanent AF

Once smart contracts are deployed onto a blockchain, there’s no going back.

Meaning that if your contract contains a bug then people could lose their money by interacting with the contract. Of course, the code of smart contracts is public.

Smart contracts

smart contracts

Put in the simplest words, a smart contract is a complicated ‘if…then’ statement written in code that self-executes by performing certain actions once pre-defined conditions are met.

The actions could include releasing funds to a certain account, transferring a token from one person to the other, passing the ownership of a physical object to other accounts, and even issuing tickets.

Smart contracts can be as simple or complicated as you want them to be. They range from serving as crowdfunding services to making up Defi Apps.

Accounts VS. Smart Contract Addresses

A contract has its own address, and it looks just like an externally owned address (EOA) address:

0x71C7656EC7ab88b098defB751B7401B5f6d8976F

All addresses on ethereum start with a 0x then a 40 characters long sequence.

Externally owned addresses are the ones that have private keys associated with them and are the ones you might get from a crypto wallet like MetaMask or Coinbase Wallet. While smart contracts addresses are generated and assigned to the contract upon deployment.

This means that smart contracts have the same abilities as EOAs’. If specified, smart contracts can buy, sell, exchange, burn, mint, and perform any transaction on tokens whenever specified.

DApps

DApps

Now that we’re familiar with how blockchains work, let’s talk about DApps.

DApps, short for decentralized apps, are simply applications or websites that are run on a blockchain. At first, glance, there is rarely any way to tell that an app is running on a different kind of network because all the ✨magic✨ happens behind the scenes.

Their back-end is made of a smart contract, that is then integrated with the front-end UI, where users can interact seamlessly.

The fact that DApps run on blockchains allows them to inherit all the special features of decentralization as well.

No Owners

One of the main differences that are deemed important to most developers and users, is that DApps have no owners. Meaning that no one party controls how the app behaves once it’s deployed onto the chain. Remember, the blockchain is immutable. It can only do what its code tells it to. Therefore people don’t have to worry about anyone having access to their private data.

There are no owners when talking about DApps and blockchain in general. All nodes (computers connected to the network) hold a copy of the blockchain and spend a bit of their computing power to verify transactions in hope of getting the nonce right and receiving an amount of the blockchain’s native cryptocurrency, i.e. ether, bitcoin…etc.

Anonymous

By using cryptography, blockchains also allow us to remain completely anonymous. Using crypto wallets like MetaMask, anyone can ‘surf’ the decentralized web without having to provide any real-life indicator. There’s absolutely no way for people to track your real-life identity using your address on the blockchain.

There is one paradox though, and it’s if someone gets hold of the identity associated with an address, it’s endgame. Their whole history of transactions is traceable back to that person since all transactions on the blockchain are completely public and transparent.

The date and time those transactions were made, when they were mined, to who they were sent, and from who is information anyone can have access to.

If you’ve owned a wallet address for 10 years and have been a frequent user ever since, it doesn’t matter what you do to keep your identity private, if you slip up only once, all transactions and their information is traceable to you.

Remember when I said that blockchains are also immutable? Yeah, that makes it even worse as there’s no way for you to delete or edit any transactions.

Of course, this is bad for you assuming you’re an ‘honest’ user. But let’s not forget that Bitcoin, and cryptocurrency in general, got a reputation for being mostly used by gangs and traffic rings as it allowed them to have guaranteed anonymity.

So it became a hotspot for illicit users and transactions from its very early stages.

Built-in payment

This part is most important to developers. Let me just say that it’s a total pain to build an app or website and have to integrate a third-party payment protocol that will most likely cost you extra money. The fact that blockchains are themselves powered by currencies is extremely convenient as it’s all taken care of when writing your code.

Composable

composability

As I said…everything’s completely transparent. At this point, I might as well ask you to start thinking of blockchains as made out of transparent glass.

Meaning that the code of smart contracts and DApps is also completely public, therefore anyone on the network can ✨copy/pasta✨ code and use it in their application. This makes the community a very fast-growing one because there’s no need to reinvent the wheel, as one would say.

Anyone can take any piece of code and add their improvements to it, making it almost like a collaborative game between developers.

The fame that Defi gets today could be greatly attributed to the fact that everyone is technically building one big structure by adding their block (Dapp/DAO) to it.

It (DeFi environement) is often called money LEGOs due to its composability — How to DeFi

Never Down

Public blockchains are global and worldwide. This ensures that there are always enough nodes running to keep the network backed up and up to date.

There is no central authority. No owners = no one that could shut down the app or network whenever they wanted to

Even if a few nodes go down, all nodes connected to it still run which keeps the network safe from any major attacks. There’s no central point of failure.

Secure (backed by cryptography)

Each blockchain uses different cryptographic systems and techniques. For the sake of this article, I’ll mainly be focusing on Ethereum.

visualization of asymmetric encryption

Ethereum’s way of providing security to accounts is by using asymmetric cryptography. In other words, public-key cryptography. This relies on the basis that a public key is easy to find once provided with its private-key pair. Though it’s not the same when provided with the public key to an account — it’s virtually impossible to find the private key to a public key as it would take an unimaginable amount of computing power.

This is done using the ECDSA (Elliptic Curve Digital Signature Algorithm). ECDSA is often compared to RSA, but most agree that using the former is more convenient as it provides the same amount of security while using smaller key sizes.

Ethereum Virtual Machine (EVM)

The EVM is where all of the previous stuff I talked about happens.

You must’ve heard somewhere before that a blockchain is a ‘distributed ledger’. This statement is true to an extent, as it doesn't apply to all blockchains, especially not Ethereum.

Sure, Ethereum is a blockchain that acts as a distributed ledger, but it also has one thing unique to it, and it’s the ability to support and run smart contracts through its famous EVM.

The Ethereum Virtual Machine is not something anyone can specifically point at and describe as being the EVM. It’s real, but it is instead supported by a collection of nodes that is so large that even if some nodes are down, there are still enough to run the EVM at any time.

It’s responsible for running and executing the code of smart contracts. It has millions of them running at all times and it could be considered as a decentralized computer with many nodes contributing to it.

It is considered to be the part of the Ethereum that runs execution and smart contract deployment. — Alexandria.

So instead of ‘distributed ledger’, the expression ‘decentralized state machine’ would be much more accurate. Every time new input is given, it changes the state of the machine.

From the bigger perspective, it all comes together to make up something like this:

Once we add block over block over block, we get a blockchain where each block changes the state of the machine and chain:

Gas (not gasoline…well, kind of)

Gas to the EVM acts like gasoline to a motor engine.

When mining, miners can get paid in two ways: minting new currency, and transaction fees.

When a new block is verified, new coins are sent to the node that verified it. This process is called minting. The word ‘mint’ is taken from the real-world context of making new money. Miners first mine for gold and silver in the earth which is then ‘minted’ into coins.

The minting protocol in Bitcoin and most blockchains also mimics the process of mining gold by dividing the amount of currency given to miners for verifying new blocks by half approximately every 4 years. The same rate at which gold becomes more valuable every year since there’s less of it on earth.

Running a mining node costs a bit of money, and that’s because it requires a lot of computational power therefore a lot of electricity. This is where transaction or gas fees come into play.

Gas is the computational power needed to verify a transaction. Gas fees are the money users pay to miners so their transaction is processed

more complicated transaction = more gas fees needed to pay.

As miners can accept or decline whatever transactions they’d like to process, the lower gas you are willing to pay, the longer your transaction stays in the mempool. The mempool, short for memory pool, is where all the transactions that have been made but not verified yet stay until they are picked up by a miner willing to verify them.

DApps are run on the blockchain and every call from the app is treated like any other transaction on the blockchain, making it necessary to spend computer power on it to mine it.

Types of Dapps

There are all kinds of DApps. This might surprise you but even Bitcoin is a DApp, yeah totally crazy I know. It checks all the categories though:

  • Data is stored on a decentralized blockchain. ✅
  • Open-source. Owned by the users. ✅
  • Distributes its tokens as rewards. ✅
  • Generates tokens that act as proof of value. ✅

There are two ways to classify DApps:

Use

There are infinite uses for decentralized DApps, the most popular though are the following:

Here are some cool ones to check out:

Crashino is a ‘decentralized casino’ where people can play games and hit the jackpot of huge prizes. At first glance, the need for a decentralized casino might seem useless but online casinos are often scams meant to make people lose their money. In-person casinos are also not so favoured by many, as the casinos still get a large sum of the participants’ money. Decentralized casinos are just the solution as they are completely transparent, tamper-proof, and immutable due to their decentralized nature.

Many of you might already be familiar with OpenSea, it’s widely known as an NFT marketplace, but it’s, more importantly, an auction-based DApp

CryptoKitties is the first game DApp ever made on the Ethereum mainnet.

It was a place where people were able to own, exchange, and spawn virtual cats. It was also the first game/DApp to test the limits of the Ethereum chain.

It basically ‘broke’ the ethereum mainnet since there were so many transactions being made when the chain’s bandwidth could not support too many transactions. This made the speed of the network slower than ever.

Decentralized exchanges: people were having a problem with exchanges being centralized as it beats the whole point of using a blockchain.

Structure

There are three types of DApps when talking about how they are built/structured:

  • Blockchain: Bitcoin.

One that has and is its own blockchain

These DApps have their own currency that is used to help the chain function. Bitcoin and many altcoins, like Ethereum, fit this category.

  • Protocol: The Omni Protocol.

The second type of DApps is often protocols that leverage the first type of DApps. They have tokens necessary for their functioning. One of the best examples to help you understand these types of DAapps is the Omni Protocol.

The Omni Protocol facilitates the creation and use of smart properties and user currencies as well as other types of smart contracts. — Crunchbase.

It’s a decentralized trading platform built on top of the Bitcoin blockchain as an ‘extra layer’ to facilitate the exchange of tokens in a trustless decentralized and effortless manner.

  • The Third Type’:

This third category of DApps leverages the second type of DApps.

These are often, but not always, apps that are aimed at the wider public. They’re the most accessible out of the three and very easy to interact with.

It’s often made for the wider public’s use. For example, OpenSea, the NFT marketplace that is built on top of the Polygon side-chain. Or the SAFE Network, which is built by leveraging the Omni protocol.

Now the part where we make our own Dapp! Check out my tutorial on youtube.

--

--