A Comprehensive Guide to Web3 for Beginners

guide to web 3.0

What is Web3

Web1 vs. Web2 vs. Web3.

When the web was established in the 1970s and 80s there were a set of open-source protocols that were designed to be open, transparent, and inclusive. This was Web 1.0. Then, in the early 2000s, some techies and internet pioneers decided that the web should be monetized and so a lot of propriety technology was created, aimed to build closed protocols on top of the open ones from Web 1.0 (such as Google or Facebook). These protocols made the web less inclusive and allowed a few tech giants to become some of the most valuable in history. An example of this is people using their services for free while the tech giants gathered data on their clients and sold it to others as a commodity. This was Web 2.0, and frankly right now most of the web in 2022 functions this way. However, with the dawn of blockchain came the promise of Web 3.0 which aims to bring back the open protocols from Web 1.0 and allow people to build together, transparently. In Web 3.0, the builders and consumers will collectively own IP through crypto protocols, and there will be a large sense of identity that the ecosystem will be collaborative and fair.

Problems Web3 Solves

  • The ability to truly own our digital footprint, identity, and assets
  • A higher level of trust that the systems we use in government and finance are going to work as they say they work and do what they say they do
  • Better privacy and control over how our identity and data are presented and used

Emerging Tech Coming out of Web3


Photo credit: Canva

Also known as crypto, it is a virtual or digital currency that is backed by cryptography which makes it almost impossible to counterfeit or fake. Crypto typically runs on blockchains which are distributed ledgers that have special functions and properties that will allow them to always represent the truth of the transactions as well as have an untampered and transparent history. This allows them to provide financial or governance systems which need very little human/hierarchical interactions (such as banks) and still allow them to be fully trusted and transparent. The most popular cryptocurrencies are Bitcoin and Ethereum at the moment.


Photo credit: Canva

Stablecoins are cryptocurrencies that are backed by a stable asset in the economy such as the US dollar, or gold. This makes them more resistant to the wide variance and fluctuations in the value of other cryptocurrencies. The most popular stablecoin right now is Tether (USDT) which is pegged to the US Dollar. Other ones include Dai, Binance USD, TrueUSD, USD Coin, TerraUSD, and the Digital Gold Token among many others.


Photo credit: Canva

An NFT stands for a non-fungible token which is just a piece of digital art (e.g. music, drawings, gifs, videos, ideas, etc.) that can actually be claimed and owned by people. This works because NFTs contracts live on the blockchain, so if I wanted to buy an NFT today and own it, there would be a blockchain transaction saying that I purchased that blockchain and everyone can check as well as verify as to whether that’s the case or not.


Photo credit: Canva

A virtual place on the internet that resembles a video game with a virtual world that can be explored. People can make avatars or characters and can enter these shared worlds, explore various items, interact with each other, and much more. The most notable example of this is Meta’s (previously Facebook) foray into this space with Horizon Worlds.


Photo credit: Canva

DeFI stands for Decentralized Finance which removes central institutions from managing the control of the financial system. What is more is that since these financial protocols are decentralized, there will not be any fees that banks charge for various purposes, and you hold your currency in a digital wallet rather than a bank. Hence, if you own some Bitcoin or Ethereum which are both cryptocurrencies that have some value, you can store them in a DeFI entity that stores your currency on the blockchain.


Photo credit: Canva

Dapps stands for decentralized apps which are applications that run on a peer-to-peer network like a blockchain. While most Dapps have this property, there are other practices around Dapps that are also important, and not always followed. Dapps should be open source and not have one person or authority controlling them. The data and records of a Daap should be public. All of these properties bring some really good benefits such as allowing them to have almost zero downtime, being protected from censorship and being transparent through the blockchain. Some of the drawbacks, however, are that they are prone to hacks given how open and transparent the creation process is. Finally, as it stands, not many Dapps prioritize user experience – and that will definitely change in the near future.


Photo credit: Canva

A DAO is a decentralized autonomous organization. These are businesses that are all virtual and are collectively owned and managed by all the members instead of centralized leadership. Decisions and spending are made by member votes instead of C-level execs (e.g. CEO) and the decisions/votes are all managed by the DAO code which is fully open and transparent to be fair for all the members. While a transparent organization fully run by its members has a lot of benefits, it has a few disadvantages as well. One notable disadvantage is that it is quite dangerous to rely on a crowd of people who are not experts to make important decisions. DAOs are also prone to hacks that can destabilize the company, but that risk is there even for traditional businesses.

For more about DAOs, check out the following articles:

Decentralized autonomous organizations (DAOs) (article from Ethereum)
Decentralized Autonomous Organization (DAO) (article from Investopedia)
What is a decentralized autonomous organization, and how does a DAO work? (article)

Common Web3 Terms

Photo credit: dreamstime

The Web3 vocabulary is vast and continues to expand with each passing week as new protocols and frameworks get created. Below are some resources to help get you started with understanding all the foreign words and phrases from web3 land. Ones like “Smart Contract”, “Proof of work” or “Double-spending” or “gas” for instance.

Comprehensive Collection Of Commonly Used Words In Web3 And Their Meanings (article)

The Web3 Glossary (article)

Web3 Stack (for developers)

web3 stack
Photo credit: Web3 Tech Stack 2022 – Programmer explains (video)

While Web3 is the wild west right now and constantly evolving, there are a few patterns and themes that have emerged. A good way to think about the stack is via abstractions. In traditional programming we have assembly code that can speak directly to the hardware, then low-level languages like C/C++ that compile to the assembler. And there are even higher-level languages like Java which allows one to not worry about the details of how memory is allocated and enables one to very quickly create complex programs with a little bit of loss of control. Finally, there are No Code platforms like Retool that allows one to simply create programs and write software processes by just dragging and dropping like you would in a PowerPoint presentation. This example illustrates how we go from very low-level frameworks that give us the utmost control of our programs (e.g. Assembly/C) to the highest level frameworks that allow us to create something in minutes instead of weeks or days but we lose a little bit of control. The Web3 stack is starting to be organized the same way, and here’s how.


Photo credit: Web3 Tech Stack 2022 – Programmer explains (video)

In the lowest level of Web3, we have the blockchains which are not new if you’ve been following along in the article. Ethereum, Solana, Avalanche, Polygon, Cardano, and Polkadot are some of the popular ones, and there are many others. A given blockchain, say Ethereum, is nothing but a network of nodes (or specialized servers) that together maintain the integrity and function of the blockchain. Even you reading this article can actually spin up a node or server of your own and connect it to the Ethereum chain, but this would be a fairly complex endeavor and most people choose not to do this. Most people choose to work higher in the stack and use the frameworks others have already built. The value in this stack is that it is ripe for innovation. Because the layer is so low level, and a lot of the concepts are in the theoretical/research space, you can create and innovate your own blockchain as a creator.


Photo credit: Web3 Tech Stack 2022 – Programmer explains (video)

A little higher up the stack, we have the node providers. These are simply software frameworks that contain a complete copy of a blockchain and which have already built the nodes for you. This would be useful if you want to check, accept, or reject various transactions as well as manage and control the validity of transactions. Some popular node providers are Infuria, Alchemy, and Chainstack among many others. However, when you use a node service, you are still quite limited in what you could do. For instance, you can’t use a Node provider service and ask what are all the transactions in the network. For this reason, working with nodes is a very niche low-level aspect of web3 that only blockchain developers actually have an interest in.


Photo credit: Web3 Tech Stack 2022 – Programmer explains (video)

The most common abstraction for developers in web3 are the APIs which is what they would interact with the most. This is because APIs already have Chain and Node level infrastructure all connected and all one needs to do is create, query, and search transactions within the nodes. The APIs will allow you to check all types of information necessary for building web3 apps such as user balances, token metadata, and much more. Some common APIs are Moralis, Alchemy, Blockchain API, and The Graph, but there are many more.

For more information on APIs here are some resources:

Alchemy API Alternatives – Web3 Development Platforms (article)
Exploring the Web3 API Economy (article)


Photo credit: Web3 Tech Stack 2022 – Programmer explains (video)

The most comprehensive abstraction near the top of the stack is using platforms for web3 development. You can think of platforms as a one-stop-shop where all the chains, nods, APIs, and frameworks live with added benefits of authentication, database storage, etc. Platforms make it very simple to create web3 apps and require less back-end coding because they solve most of the common problems when configuring and setting up a web3 app. The only drawbacks are that they are pricier to use than setting up your own configurations, and you may lose a little bit of control in how you can configure and run your web3 apps. Some common platforms in the web3 space are Moralis, thirdweb, Alchemy, and buildspace among others.


Photo credit: Web3 Tech Stack 2022 – Programmer explains (video)

At the very top of the stack, we have the applications which the consumers interact with daily. These applications typically speak directly to the platforms and rarely do they have to traverse lower to speak to the APIs, Chains, or Nodes. Here are some popular applications below:

OpenSea – The largest NFT marketplace – https://opensea.io/

Coinbase – An app to buy/sell crypto – https://www.coinbase.com/

Brave – A browser that can seamlessly connect with the web3 ecosystem – https://brave.com/

MetaMask – A platform that allows you to seamlessly connect to the blockchain and Daaps specifically – https://metamask.io/

Axie Infinity – An online game where you can breed and battle monsters and even potentially make a profit from your gaming endeavors – https://axieinfinity.com/

Horizon Worlds – Facebook/Meta’s metaverse which is a VR world with many features such as stand-up comedy, games with friends, and much more – https://www.oculus.com/horizon-worlds/

Loot – Randomized loot for gamers all placed on the blockchain to be transferrable in other Daaps – https://www.lootproject.com/

This explanation was inspired by
Web3 Tech Stack 2022 – Programmer explains (video)

How to set up a wallet

crypto wallet
Photo credit: learn crypto

What is a crypto wallet?

A crypto wallet is simply a place where you can store your cryptocurrency.

What are the different types of wallets?

The main types of wallets are hosted (or custodial) wallets, non-custodial wallets, and physical wallets. Hosted or custodial wallets allow a 3rd party (e.g. a bank or a company like Coinbase) to hold your crypto for you and offer you peace of mind and security that it will be safe and that they will not lose your crypto. While custodial wallets can be more secure they also offer you less control of what you can do with your crypto. On the other hand, non-custodial wallets are wallets that are managed by you, and you have to remember a private key or password to recover your crypto. This password must be kept in a very safe place because whoever has access to it has access to your crypto. The upside of non-custodial wallets is that they give you complete control of how you can manage your crypto and what you can do with it. Finally, there are physical wallets which are hardware devices holding information to your crypto wallet. These are the most secure, but also the most expensive and complex to use.

Another commonly used term when it comes to crypto wallets is the notion of a hot or cold wallet. A hot wallet is one that is hosted on the internet so it is always connected potentially opening you up for security breaches. However, a hot wallet is very user-friendly and flexible. A cold wallet on the other hand is storing your crypto access physically somewhere such as with a hardware wallet (e.g. your computer or another physical device) or simply on a piece of paper.

Three popular wallets


Photo credit: flickr

Coinbase is one of the most popular and mainstream apps that allows you to buy, sell, send, receive, and convert crypto. With Coinbase you can choose between a custodial wallet or a non-custodial wallet.

Use Coinbase if you want the most popular and secure solution that gives you access to a myriad of different cryptocurrencies.

How to set it up and use it:
Coinbase Wallet Tutorial for Beginners: FULL Guide & Review! (2021) (video)


Photo credit: Google Play Store

MetaMask is an open-source platform that is supported by the developer community. It is essentially a browser extension and app that allows you to very quickly and seamlessly link up a non-custodial crypto wallet and connect to decentralized applications on the Ethereum Blockchain (such as the game Axie Infinity) both as a consumer and also as a developer. Note that at the time of this writing MetaMask only supports connecting to the Ethereum Blockchain which also happens to be the most popular in the world. If you want to work with other blockchains, MetaMask won’t work

Use MetaMask either if you are a Web3 creator, and/or you want the most flexibility with your crypto.

How to set it up and use it:
MetaMask Tutorial for Beginners – How to Set Up MetaMask (video)

Ledger Nano X

ledger nano x
Photo credit: Cryptodots

The Ledger Nano X is one of the simplest and most secure physical devices that can store your crypto. Think of it as a secure USB drive. As of this writing, many crypto storage review sites tout the Ledger Nano X as one of the best physical wallets. Use it if you want the store your crypto with the highest amount of security and control, and don’t mind paying a premium in order to do this.

How to set it up and use it:
Ledger Nano X Tutorial: Beginners Guide on How to Set up a Ledger Nano Wallet

Other wallet providers:

Best Bitcoin and Crypto Wallets for April 2022 (article)

Best Crypto Software Wallets (article)

6 Best Crypto Wallets of 2022 (article)

If you want to start developing in web3, where do you start?

learning web3
Photo credit: Canva

First, join a community like Odyssey and TLDR Crypto to stay up to date on all things web3. Then, I would review the content from Web3 University for a deeper and more dedicated learning experience. Finally, check out Moralis, Polygon, Thirdweb , and Buildspace. These are platforms akin to Google’s Firebase that can guide you step-by-step in creating on the web3 platforms and have the resources available to help you create something from scratch on their platforms.

Check out the following resources to learn more:

The Web3 Stack: Reference for Developers (article)
The Complete Guide to Full Stack Web3 Development (article)

Adieu 👋

That’s all for now! I hope this guide energizes you to create the next cool web3 app, or become a more informed citizen who can navigate this treacherous and ever-changing web3 future. If there is one takeaway from this post you should remember, it is to not get hung up on any web3 feature or cryptocurrency in particular. It is still the very early days and who knows what the next Google of crypto might be.

Understanding The Blockchain Ecosystem From The Ground Up

Author: Mihai Avram | Date: 12/08/2020

There is no doubt about it that Blockchain has started exploding both as a topic and technology for a few years now. Maybe you are a professional who simply has seen the word blockchain too many times and want to learn it once and for all. Or maybe you are a blockchain enthusiast who wants to dive in deeper in understanding the internals of the blockchain ecosystem. In both cases, you came to the right article place!

Here we will cover:

  • How blockchain technology works
  • What blockchain is used for and what industries use it
  • What programming languages to use to build a blockchain
  • What are the leading providers of blockchain technologies
  • How to build a blockchain from the ground up (with code)
  • How to learn more about blockchain

If you want to learn any of these notions then keep reading!

What is Blockchain and How Does it Work

In a nutshell, blockchain is a piece of technology that ensures that transactions (e.g. paying for your groceries, a doctor visit, an artist signing a record label contract, etc.) are transparent in a securely decentralized fashion, so there is no longer a need for a central authority (such as a bank or government) to oversee or regulate it. Because blockchain is also built with privacy in mind, it is very difficult to alter or tamper with.

In order to understand how blockchain does this and how it works, let’s envision the following example:

Simple Blockchain Example

Imagine that you and two other friends (let’s call them Friend 1 and Friend 2) are using a blockchain to update your shared expenses online. All three of you will have a file on your computers that automatically updates when you buy or sell an item, either from the internet or from each other. You buy some tickets to a concert, and when you do, your computer quickly updates your file and sends copies of your file to your friends. Once your friends receive those files, their computers quickly check if your transaction makes sense (e.g. did you have enough money to buy the tickets, and it is really you who is buying the tickets). If both friends agree that everything checks out, everyone updates their file to include your transaction. This cycle repeats for every transaction that either you or your friends make so that all three of your files are synced up, and there is no authority to oversee the process.

There is of course a bit more nuance to it and gets very technical very quickly in understanding to build such a system from a programming perspective. If you want to understand how blockchain works in-depth, you can read the academic paper by Satoshi Nakamoto who created the first blockchain database

Original blockchain paper by Satoshi Nakamoto (link)

What is Blockchain Used For?

Blockchain is quickly becoming very widespread where almost every industry is touched by this technology. For inspiration, here are just a handful of examples of how Blockchain is used today.

Monetary Payments – Blockchain used in monetary transactions creates a more efficient and secure payment infrastructure.

Global Commerce – Global supply chains are governed by blockchain technologies to ensure a more efficient transactional trade system.

Capital Markets – Blockchain enables audit trails, quicker settlements, and operational improvements.

Healthcare – Secondary health data that cannot identify an individual by itself can be placed on the blockchain which can then allow administrators to access such data without needing to worry about the data all being in one place which makes it very secure.

Energy – Utility processes such as metering, billing, emission allowances, and renewable energy certificates all can be tracked via blockchain transactions in one decentralized place.

Media – Media companies use blockchain to protect IP rights, eliminate fraud, and reduce costs.

Voting – The notion of each vote being in a decentralized blockchain solves the problem of elections being hacked or tampered with.

Cybersecurity – Blockchain solutions in the security space ensure that there is no single point of failure, and it also provides privacy as well as end-to-end encryption.

Other real-life examples exist in Regulatory Compliance and Auditing, Insurance, Peer-to-Peer Transactions, Real Estate, Record Management, Identity Management, Taxes, Finance Accounting, Big Data, Data Storage, and IoT among many others.

What are the Most Popular Types of Cryptocurrency?

Bitcoin – The cryptocurrency that started it all. It was started in 2009, and follows closely to the original Satoshi Nakamoto cryptocurrency paper referenced earlier. It is mostly used for monetary transactions.

Litecoin – Crated in 2011 as an alternative to Bitcoin. Litecoin is a little faster than Bitcoin, has a larger limit and, operates on different algorithms.

Ethereum – Ethereum was created in 2015 and is also focusing on decentralized applications with smart contracts instead of just monetary transactions. This way different transactions outside of monetary exchange can happen, such as digital trading cards, or IoT activations on a smart-grid network.

Ripple – A cryptocurrency that is not blockchain-based. However, it is often used by companies to move large amounts of money quickly across the globe.

For a more extensive list, check out these resources.

  • An ever-growing list of cryptocurrencies on Wikipedia (link)
  • Understanding The Different Types of Cryptocurrency by SoFi (link)
  • Types of Cryptocurrency Explained by Equity Trust (link)

What are the Best Programming Languages to Develop Blockchain?

C++ – Best if you need to build a blockchain from scratch or change some low-level internals of how blockchain works.

Solidity – Best if you are set on using the Ethereum Blockchain framework and platform.

Python – Best if you want to bring blockchain to general-purpose apps, especially in Data Science.

JavaScript – Best if you want to build a blockchain for the web.

Java – Best if you want to build a general, and large-scale object-oriented application.

There are, however, blockchain developments in almost all programming languages, so pick the one you’re most comfortable with or is required for the project.

What are the Leading Providers of Blockchain Technologies

Coinbase – A very secure and free API that supports many different cryptocurrencies such as bitcoin and ethereum, and also supports different blockchain transactions such as generating digital wallets, getting real-time prices, and crypto exchanges. Use it if you want to create blockchain apps cost-effectively.

Bitcore – Another free and speedy option with many different blockchain transactions possible. Use it if you want to build very fast blockchain applications with quick transaction times.

Blockchain – The oldest and most popular blockchain framework. It has a large developer community and low timeouts. Use it if you need to implement blockchain wallet transactions.

For a more extensive list check out the following resources.

  • Top 10 Best Blockchain APIs: Coinbase, Bitcoin, and more (link)
  • How to Choose the Best Blockchain API for Your Project by Jelvix (link)

How to Learn More About Blockchain

The fastest way to learn about blockchain is to first take a course, and then start building one yourself. If you’re also serious about blockchain and want to learn it continuously, you should subscribe to some blockchain newsletters.

Here are some links to the courses. Look for the ones with the highest ratings and popularity:

  • [Top 10] Best Blockchain Courses to learn in 2020 (link)
  • 10 Best Blockchain Courses and Certification in 2020 (link)

Also, if you want to build a blockchain, check out this well-sourced Quora post. Furthermore, here is a list of good newsletters to learn more about blockchain from your inbox!

How to Build a Blockchain, a Brief Introduction (With Code)

Let’s build a simple blockchain so that we can understand some of the more subtle nuances of one. The most important inner workings of a blockchain are the following. The chain itself which stores transactional information, a way to mine new possible slots in the chain, the proof of work that identifies if the chain is valid, and a consensus algorithm that can allow nodes or computers to vote whether the chain is valid. The code will label these important notions as #CHAIN step, #MINING step, #POW step, and #CONSENSUS step respectively to trace back to these notions. Note that there is an important aspect of the proof of work. The proof of identifying if a new block is valid should very easily be verified; however, it should be very hard to create from scratch (mining a new block). This property is important because it allows us to easily validate if a blockchain is not tampered with, and prevents hackers from re-creating a blockchain easily (it becomes immutable). We will build all these things below. Pay close attention to the comments as they explain the purpose of each component. Also, note that some functions, such as (is_valid_proof_pattern, get_blockchain, block_matches_proof, etc.) have yet to be implemented to keep this post short, so just imagine that they exist and that they do what they are supposed to do.

Note: that the code below is not an exact replica of a blockchain. Instead it is a simplified representation which can be used for inspiration/intuition and not for rigorous implementation of a blockchain.

Blockchain Server Code

""" Blockchain Server Code

On the blockchain server is where we store the main
implementation of the blockchain. The clients (or apps
such as your banking app) would hit a server like this
as they create new transactions and store them on the
blockchain, or as miners try to mine new blocks.
The classes and code below represents the code that
sits on the blockchain server.

# Imports

from datetime import datetime  # Generates unique timestamps
import hashlib  # Used for hasing our blocks

# Classes

class Transaction():
    A given monetary transaction.
    Example: Joe pays Amy 10 mBTC.
  __init__(self, frm, to, amount):
    self.frm = frm
    self.to = to
    self.amount = amount

class Block():
    A block on the blockchain containing blockchain
    transactions. Note that every block has a hash
    that is associated to previous blocks.

    self.index = index
    self.previous_hash = previous_hash
    self.proof_of_work = proof_of_work
    self.timestamp = timestamp
    self.transactions = transactions

class Blockchain():
		The blockchain containing various blocks
		that build on each other as well as methods
		to add and mine new blocks. (# CHAIN step)
		self.blocks = []
		self.all_transactions = []

		# Every blockchain starts with a genesis first block
		genesis_block = new Block(


	def add_block(block):
		"""Adds a new block to the blockchain.

		       block (Block class): A new block for the


	def add_new_transaction(transaction):
	    """Adds a new transaction to the blockchain.

		       transaction (Transaction class): A new transaction
			                                    for the blockchain

	def get_full_chain():
	    """Returns all the blockchain blocks.

	           all_blocks (List[Block class]): All the blocks in
			                                   the blockchain.
	    all_blocks = self.blocks
	    return all_blocks

	def get_last_block():
	    """Gets the last block in the blockchain.

	           last_block (Block class): The last block in the
	    last_block = None
	    if self.blocks:
	        last_block = self.blocks[-1]

	    return last_block

    def hash(block):
        """Computes a hashed version of a block and returns it.

               block (Block class): A block in the blockchain.

               hashed_block (str): A hash of the block.
        stringified_block = json.dumps(
			block, sort_keys=True
        hashed_block = hashlib.sha256(
        return hashed_block

	def mine_new_block(possibilities):
	    """An attempt to mine a new block in the blockchain.
           (# MINING step)

		       possibilities (List[Possibility class]):
			   	All possibilities for mining that the
				miners compute/create.
		       reward (str): A reward for the miners if they

        last_block = self.get_last_block()

		# Go through many possible proofs, which is equivalent to
		# using computational power, to find the new block.
		for possibility in possibilities:
			mining_success = False
			previous_hash = self.hash(last_block)
			possible_proof = hashlib.sha256(

			# We imagine this method exists (# POW step)
			if is_valid_proof_pattern(possible_proof,
				# Our possible proof was correct, so miner was
				# able to mine a new block!

				# Forge the new Block by adding it to the chain
				index = last_block.index + 1
				proof_of_work = possible_proof
				timestamp = timestamp.utcnow()
				transactions = self.all_transactions

				new_block = new Block(

				# The mining was a success, we stop mining
				mining_success = True

		# Give reward to miner if mining was a success
		reward = '0 mBTC'
		if mining_success:
		    reward = '0.1 mBTC' # The reward can be anything

		return reward

In short, the server code contains a blockchain which contains blocks and transactions. Miners can use computational power to mine new blocks and as an incentive for doing so, they get rewarded. Consumers can add transactions to the blockchain (e.g. you pay a friend back for lunch) and that transaction will then live on the blockchain. The blockchain is really then a chain of transactions that have the property of being tied to one another and able to be verified if that tie is correct or not.

Client Code Accessing The Blockchain

""" Client Code Accessing The Blockchain

The client or blockchain application that gets
API requests for new transactions. It primarily
interacts with the blockchain server from above,
but has some internal helper functions to store the
new transactions. Note that there could be dozens if
not thousands of these clients that do the same things
as decentralized transactions are written to the
blockchain. Imagine an app like Apple Pay where
everyone is paying each other, client connections
like these would register the transactions on the
blockchain. Below are the client helper functions and

# Functions

def check_consensus(all_nodes, our_blockchain):
    """Compares our blockchain with blockchains from
	   other nodes in the network, and attempts to
	   find the longest valid blockchain, and returns it.
       (# CONSENSUS step)

	       all_nodes (List[Node class]): All nodes in
		   								 the network.
	       our_blockchain (Blockchain class): Our blockchain.

           longest_valid_blockchain (Blockchain class):
		   		The longest valid blockchain.
	longest_valid_blockchain = our_blockchain
	longest_blockchain_len = len(

	for node in all_nodes:
		# Imagine the get_blockchain method exists on the node
		node_blockchain = node.get_blockchain()

		is_valid_chain = True
		for block in node_blockchain.get_full_chain():
			# Imagine the block_matches_proof method exists
			if not block_matches_proof(block):
				is_valid_chain = False

		current_blockchain_len = len(
		if (is_valid_chain
		    and current_blockchain_len > longest_blockchain_len):
			longest_valid_blockchain = node_blockchain
			longest_blockchain_len = len(

	return longest_valid_blockchain

def get_other_nodes_in_network():
	    Returns all nodes, or servers/computers in the network.
	    Code not written here as it is application dependent.
	return all_nodes

def get_our_stored_blockchain():
	    Retrieves the current blockchain on our node or server.
	    Code not written here as it is application dependent.
	return our_blockchain

def set_our_stored_blockchain(new_blockchain):
	    Sets the current blockchain on our node or server.
	    Code not written here as it is application dependent.
	return status

# Now let's say that Joe wants to pay Amy 10 mBTC and
# the client prepares this transaction to write it
# to the blockchain. This is roughly what happens below.

# We first prepare the transaction
frm = 'Joe'
to = 'Amy'
amount = '10 mBTC'
new_transaction = new Transaction(frm, to, amount)

# Then we get the longest valid blockchain we can write our
# new transaction to.
our_blockchain = get_our_stored_blockchain()
all_nodes = get_other_nodes_in_network()
longest_valid_blockchain = check_consensus(
	all_nodes, our_blockchain
if our_blockchain != longest_valid_blockchain:
	# We have an out of date or invalid blockchain
	# so we update our blockchain as well.
	our_blockchain = get_our_stored_blockchain()

# Now that we have the current up-to-date blockchain
# we simply write our new transaction to our blockchain.

All the client code needs to do is to make sure that the blockchain it is working with is up to date by checking the consensus between all the nodes (or servers) in the blockchain network. After the client code has the proper and up to date blockchain, a new transaction can be written.

Code That Miners Use

""" Code That Miners Use

The miners also leverage the blockchain server from above. 
The role of the miners is to come up with compute possibilities 
to create new blocks using compute power. They first retrieve 
the most current blockchain, and then try to mine a new 
block via calling the following methods, and getting rewarded 
in the process if they are successful.

# Code for the generate_possibilities function is application 
# dependent.
possibilities = generate_possibilities()  
reward = current_blockchain.mine_new_block(possibilities)

As the miners keep mining new blocks, the blockchain grows and more transactions can be stored on the blockchain. With understanding the server, client, and miner parts of the blockchain lifecycle you should have a good understanding of different components of a blockchain. There are also more intricacies to a blockchain than the components covered here, such as the details of the proof of work, how transactions are stored, hashed, and regulated, double spending, the verification process, and much more. Taking a course is one of the best ways to understand these nuances.

Below are some resources to other simple blockchain implementations if you’re curious.

Learn Blockchains by Building One (link)

Simple Blockchain in 5 Minutes [Video]

In Conclusion

Well, there you have it, a good primer on this new technology that is dawning upon us. I hope that by understanding blockchain high-level and by diving deeper into the links provided, you can become proficient with blockchain in no time!