Structure of blockchain
Tags: blockchain, beginners, webdev, web3
Published: 2023-08-23 17:59:19

## Workflow

![blockchain-workflow](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uvg06egwvljwl7bdqn96.png)

## Dictionary

- **Node** - user or computer within the blockchain architecture (each has an independent copy of the whole blockchain ledger)
- **Transaction** - smallest building block of a blockchain system (records, information, etc.) that serves as the purpose of blockchain
- **Block** - a data structure used for keeping a set of transactions which is distributed to all nodes in the network
- **Chain** - a sequence of blocks in a specific order
- **Miners** - specific nodes which perform the block verification process before adding anything to the blockchain structure
- **Consensus (consensus protocol)** - a set of rules and arrangements to carry out blockchain operations

## Architecture

![Architecture-of-blockchain](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t7tmu6oomt3aao5xmrxh.png)

### Centralized
Each node of the internet send the content for a unique server(datacenter) and only this server could process and interpret the information

### Decentralized
A new way of implement applications and handle data, each node of the network could process and interpret the information

### Distributed Ledgers
- Public
A public ledger is how bitcoin is currently working, anyone could connect, process and use

- Private
Private ledgers are only for persons that the administrator of the network allows you to enter, a example is a bank private ledger

## Web 2 X Web 3

![comparission-of-web](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t3k1hpfemw5edy53gn1f.png)

- The traditional architecture of the World Wide Web uses a client-server network. In this case, the server keeps all the required information in one place so that it is easy to update, due to the server being a centralized database controlled by a number of administrators with permissions.
- In the case of the distributed network of blockchain architecture, each participant within the network maintains, approves, and updates new entries. The system is controlled not only by separate individuals, but by everyone within the blockchain network. Each member ensures that all records and procedures are in order, which results in data validity and security. Thus, parties that do not necessarily trust each other are able to reach a common consensus.

## Technology

The structure of blockchain technology is represented by a list of blocks with transactions in a particular order. These lists can be stored as a flat file (txt. format) or in the form of a simple database. Two vital data structures used in blockchain include:

- **Pointers** - variables that keep information about the location of another variable. Specifically, this is pointing to the position of another variable.
- **Linked lists** - a sequence of blocks where each block has specific data and links to the following block with the help of a pointer

![blockchain-macro-structure](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nz7fkuqpx1kkzujigaye.png)

![blockchain-micro-structure](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a511ku3sw7wcmzg6iw1m.png)

## Types of Blockchain

![type-of-blockchain](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/px8ki9cgi1fniq919175.png)

All blockchain structures fall into three categories:

- **Public blockchain architecture**

A public blockchain architecture means that the data and access to the system is available to anyone who is willing to participate (e.g. Bitcoin, Ethereum, and Litecoin blockchain systems are public).

- **Private blockchain architecture**

As opposed to public blockchain architecture, the private system is controlled only by users from a specific organization or authorized users who have an invitation for participation.

- **Consortium blockchain architecture**

This blockchain structure can consist of a few organizations. In a consortium, procedures are set up and controlled by the preliminary assigned users.

The following table provides a detailed comparison among these three blockchain systems:

| Property | Public blockchain | Consortium blockchain | Private blockchain |
| --- | --- | --- | --- |
| Consensus determination | All miners | Selected set of nodes | Within one organization |
| Read permission | Public | Public or restricted | Public or restricted |
| Immutability level | Almost impossible to tamper | Could be tampered | Could be tampered |
| Efficiency (use of resources) | Low | High | High |
| Centralization | No | Partial | Yes |
| Consensus process | Permissionless | Needs permission | Needs permission |

## Key Points

- Nodes within P2P network
- Properties of block & genesis block
- Transactions within the ledger
- The validation process - mining
- The “consensus” within a blockchain architecture
- Proof-of-work