Skip to content

Commit 2212d99

Browse files
committed
Merge branch 'main' of github.com:shan57blocks/web3-knowledge-base
2 parents 7ef1fd2 + d0465ee commit 2212d99

32 files changed

+504
-60
lines changed

SUMMARY.md

+10-4
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,16 @@
77

88
## Blockchain
99

10-
- [ Introduction](blockchain/README.md)
11-
- [ Wallet](blockchain/wallet.md)
12-
- [ Transaction](blockchain/transaction.md)
13-
- [ Consensus](blockchain/consensus.md)
10+
- [Introduction](blockchain/README.md)
11+
- [Web3 Wallets](blockchain/web3-wallets/README.md)
12+
- [Types Of Web3 Wallets](blockchain/web3-wallets/types-of-web3-wallets.md)
13+
- [Wallet Technologies](blockchain/web3-wallets/wallet-technologies.md)
14+
- [MetaMask Wallet](blockchain/web3-wallets/metamask-wallet.md)
15+
- [Transaction](blockchain/transaction/README.md)
16+
- [UTXO Model](blockchain/transaction/utxo-model.md)
17+
- [Account Model](blockchain/transaction/account-model.md)
18+
- [UTXO vs Account](blockchain/transaction/utxo-vs-account.md)
19+
- [Consensus](blockchain/consensus.md)
1420

1521
## Web3
1622

Loading
68 KB
Loading
50.9 KB
Loading
13 KB
Loading

assets/images/Web3Wallets/cex_dex.png

176 KB
Loading
Loading
Loading
51.7 KB
Loading
85.9 KB
Loading

assets/images/utxo-state-graph.png

77.1 KB
Loading

blockchain/README.md

+16-12
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
1-
# What is blockchain?
1+
# Introduction
22

3-
_Author: Martin_
3+
4+
5+
An introduction to the basics of blockchain.
6+
7+
## What is blockchain?
48

59
![Blockchain system](../assets/images/btc_overview.png)
610

7-
we see that the blockchain system consists of users with wallets containing keys, transactions that are propagated across the network, and miners who produce (through competitive computation) the consensus blockchain, which is the authoritative ledger of all transactions.
11+
We see that the blockchain system consists of users with wallets containing keys, transactions that are propagated across the network, and miners who produce (through competitive computation) the consensus blockchain, which is the authoritative ledger of all transactions.
812

913
A blockchain is a distributed ledger with growing lists of records (blocks) that are securely linked together via cryptographic hashes. Each block contains a cryptographic hash of the previous block, a timestamp, and transaction data (generally represented as a Merkle tree, where data nodes are represented by leaves). The timestamp proves that the transaction data existed when the block was created. Since each block contains information about the previous block, they effectively form a chain (compare linked list data structure), with each additional block linking to the ones before it. Consequently, blockchain transactions are irreversible in that, once they are recorded, the data in any given block cannot be altered retroactively without altering all subsequent blocks.
1014

11-
# Category
15+
## Category
1216

13-
## Public Blockchain
17+
### Public Blockchain
1418

1519
A public blockchain has absolutely no access restrictions. Anyone with an Internet connection can send transactions to it as well as become a validator (i.e., participate in the execution of a consensus protocol). Usually, such networks offer economic incentives for those who secure them and utilize some type of a Proof of Stake or Proof of Work algorithm.
1620

@@ -20,7 +24,7 @@ Some of the largest, most known public blockchains are the bitcoin blockchain an
2024

2125
- [Ethereum](https://ethereum.org/en/what-is-ethereum/)
2226

23-
## Consortium Blockchain
27+
### Consortium Blockchain
2428

2529
A consortium blockchain is a type of blockchain that combines elements of both public and private blockchains. In a consortium blockchain, a group of organizations come together to create and operate the blockchain, rather than a single entity. The consortium members jointly manage the blockchain network and are responsible for validating transactions. Consortium blockchains are permissioned, meaning that only certain individuals or organizations are allowed to participate in the network. This allows for greater control over who can access the blockchain and helps to ensure that sensitive information is kept confidential.
2630

@@ -29,25 +33,25 @@ Consortium blockchains are commonly used in industries where multiple organizati
2933
- [Hyperledger Fabric](https://www.hyperledger.org/use/fabric)
3034
- [Ethereum quorum](https://consensys.net/quorum/)
3135

32-
## Private Blockchain
36+
### Private Blockchain
3337

3438
A private blockchain is permissioned. One cannot join it unless invited by the network administrators. Participant and validator access is restricted. To distinguish between open blockchains and other peer-to-peer decentralized database applications that are not open ad-hoc compute clusters, the terminology Distributed Ledger (DLT) is normally used for private blockchains.
3539

36-
# Comparison
40+
## Comparison
3741

3842
| Property | Public | Consortium | Private |
3943
| :----------------------------------------- | :------------------------------------------------ | :-------------------------------------- | :-------------------------------------------- |
4044
| **Usability** | Currency, Document validations and IoT operations | Finance, supply chain and research work | Supply chain, real estate and asset ownership |
41-
| **Performance** | Low | Very High | Very High |
45+
| **Performance** | Low | High | Very High |
4246
| **Decentralization** | Public | Permissioned | Permissioned |
4347
| **Transparency / Auditability / Security** | Lack of security | Lack of transparency | Lack of auditability |
4448
| **Scalability** | Bad | Good | Good |
4549

46-
# Glossary
50+
## Glossary
4751

4852
- [Binance](https://academy.binance.com/en/glossary)
4953
- [Coingecko](https://www.coingecko.com/en/glossary)
5054

51-
# Reference
55+
## References
5256

53-
- [Mastering Bitcoin](https://github.com/bitcoinbook/bitcoinbook)
57+
[Mastering Bitcoin](https://github.com/bitcoinbook/bitcoinbook)

blockchain/consensus.md

+26-20
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
# What is consensus?
1+
# Consensus
22

3-
_Author: Martin_
3+
4+
5+
An introduction to the consensus mechanism of blockchain.
6+
7+
## What is consensus?
48

59
Blockchain consensus is the process by which all participants in a blockchain network reach agreement on the current state of the network. This agreement is critical for ensuring the security and integrity of the blockchain, as it ensures that all participants have a consistent view of the network and that transactions are properly validated and processed.
610

@@ -10,9 +14,9 @@ There are several consensus mechanisms used in different blockchain networks, in
1014

1115
In general, the consensus mechanism is a crucial component of any blockchain network, as it determines the security, efficiency, and decentralization of the network. A well-designed consensus mechanism is essential for ensuring the long-term success and viability of the network, and choosing the right consensus mechanism is an important decision for any blockchain project.
1216

13-
# Category
17+
## Category
1418

15-
## PoW
19+
### PoW
1620

1721
![PoW flow](../assets/images/pow_flow.jpg)
1822

@@ -22,21 +26,21 @@ The first node to find a suitable nonce gets the bookkeeping right. After the no
2226

2327
Finding a nonce that meets the requirements is very difficult and requires nodes to consume a lot of computing power. With the continuous accumulation of valid blocks, malicious nodes need to consume a huge amount of computing power to overthrow the previous blocks and complete the double-spending attack.
2428

25-
Please read [Mining and Consensus](https://github.com/bitcoinbook/bitcoinbook/blob/develop/ch10.asciidoc) to learn the PoW consensus details.
29+
Please read [Mining and Consensus](https://github.com/bitcoinbook/bitcoinbook/blob/develop/ch10.asciidoc) to learn the PoW consensus details.
2630

27-
## PoS
31+
### PoS
2832

29-
![PoS flow](../assets/images/pos_flow.jpg)
33+
![PoS flow](../assets/images/pos_flow.jpg)
3034

3135
In the PoS consensus, nodes compete for accounting rights not by computing power but by rights (tokens). PoS also needs to calculate the hash value, but unlike PoW, it does not require continuous violent calculation to find the nonce value.
3236

3337
Each node only needs to calculate Hash once in each round of consensus. The more rights and interests it has, the greater the chance of meeting the Hash target and the greater the chance of obtaining bookkeeping rights. PoS is a resource-saving consensus protocol. The rights and interests defined by PeerCoin are not only related to the number of tokens, but also the coin age (Coin Age) is introduced. 100 tokens are held for two days, and the coin age is 200. The greater the chance of account rights.
3438

3539
Please read [Proof of stake](https://ethereum.org/en/developers/docs/consensus-mechanisms/pos/) to learn more.
3640

37-
## DPoS
41+
### DPoS
3842

39-
![DPoS flow](../assets/images/dpos_flow.jpg)
43+
![DPoS flow](../assets/images/dpos_flow.jpg)
4044

4145
Delegated Proof-of-Stake (DPoS) aims to address some of the scalability, security, and decentralization issues associated with PoW and PoS while providing a more efficient way to reach consensus on the network.
4246

@@ -48,17 +52,17 @@ Several nodes with the most votes from holders become the block producing nodes,
4852

4953
Please read [DPoS Consensus Algorithm - The Missing White Paper](https://steemit.com/dpos/@dantheman/dpos-consensus-algorithm-this-missing-white-paper) to learn more.
5054

51-
## PBFT
55+
### PBFT
5256

53-
![PBFT flow](../assets/images/pbft_flow.jpg)
57+
![PBFT flow](../assets/images/pbft_flow.jpg)
5458

5559
PBFT is a Byzantine Fault Tolerance protocol with low algorithm complexity and high practicality in distributed systems. PBFT is mainly used in consortium blockchains. PBFT contains five phases: request, pre-prepare, prepare, commit and reply. The primary node forwards the message sent by the client to the other three nodes. In the case that node 3 is crashed, one message goes through five phases to reach a consensus among these nodes. Finally, these nodes reply to the client to complete a round of consensus. PBFT guarantees nodes maintain a common state and take a consistent action in each round of consensus. PBFT achieves the goal of strong consistency, thus it is an absolute-finality consensus protocol. As mentioned before, EOS takes a combined consensus protocol.
5660

57-
Please read [Practical Byzantine Fault Tolerance](https://pmg.csail.mit.edu/papers/osdi99.pdf) to learn more.
61+
Please read [Practical Byzantine Fault Tolerance](https://pmg.csail.mit.edu/papers/osdi99.pdf) to learn more.
5862

59-
## PoH
63+
### PoH
6064

61-
![PoH flow](../assets/images/poh_flow.png)
65+
![PoH flow](../assets/images/poh_flow.png)
6266

6367
Keeping track of the order of transactions is vital for cryptocurrencies. Bitcoin does this by bundling transactions into blocks with a single timestamp. Each node has to validate these blocks in consensus with other nodes. However, this process results in significant waiting time for nodes to confirm a block across the network. Solana takes a different approach called Proof of History (PoH).
6468

@@ -72,7 +76,7 @@ PoH is not a consensus mechanism but instead, a way of shortening the time spent
7276

7377
Please read [Proof of History: A Clock for Blockchain](https://medium.com/solana-labs/proof-of-history-a-clock-for-blockchain-cf47a61a9274) to learn more.
7478

75-
# Comparison
79+
## Comparison
7680

7781
| Property | PoW | PoS | DPoS | PBFT |
7882
| :---------------- | :--------------------- | :--------------------- | :--------------------- | :---------------- |
@@ -82,10 +86,12 @@ Please read [Proof of History: A Clock for Blockchain](https://medium.com/solana
8286
| Scalability | Good | Good | Good | Bad |
8387
| Application | Public | Public | Public | Permissioned |
8488

85-
Please read [Analysis of the main consensus protocols of blockchain](https://www.sciencedirect.com/science/article/pii/S240595951930164X) to learn the details.
89+
Please read [Analysis of the main consensus protocols of blockchain](https://www.sciencedirect.com/science/article/pii/S240595951930164X) to learn the details.
90+
91+
## References
92+
93+
[Analysis of the main consensus protocols of blockchain](https://www.sciencedirect.com/science/article/pii/S240595951930164X)
8694

87-
# Reference
95+
[Proof of History: A Clock for Blockchain](https://medium.com/solana-labs/proof-of-history-a-clock-for-blockchain-cf47a61a9274)
8896

89-
- [Analysis of the main consensus protocols of blockchain](https://www.sciencedirect.com/science/article/pii/S240595951930164X)
90-
- [Proof of History: A Clock for Blockchain](https://medium.com/solana-labs/proof-of-history-a-clock-for-blockchain-cf47a61a9274)
91-
- [What is solana](https://academy.binance.com/en/articles/what-is-solana-sol)
97+
[What is solana](https://academy.binance.com/en/articles/what-is-solana-sol)

blockchain/transaction.md

-1
This file was deleted.

blockchain/transaction/README.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Transaction
2+
3+
4+
5+
A transaction refers to a contract, agreement, transfer, or exchange of assets between two or more parties. The asset is typically cash or property. Likewise, a blockchain transaction is nothing but data transmission across the network of computers in a blockchain system.
6+
7+
Today’s blockchain networks use two types of transaction models: the UTXO model and the Account/Balance model.
8+
9+
**The UTXO model** are almost similar to cash or coins, Bitcoin and many Bitcoin derivatives such as Bitcoin Cash, Zcash, Litecoin, Dogecoin, Dash, and more are UTXO chains.
10+
11+
**The Account/Balance model** is similar to a bank account or debit card. Ethereum, EOS, Tron, and Ethereum Classic are account-based chains.
12+
13+
In this section, we'll explore what these two types of transaction model are, what's the difference between them and also go through their pros and cons.
+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Account Model
2+
3+
4+
5+
The account-based transaction model represents assets as balances within accounts, similar to bank accounts.
6+
A transaction in the account-based model triggers nodes to decrement the balance of the sender's account and increment the balance of the receiver's account.
7+
Ethereum uses this transaction model. See more detail of ethereum transaction, please refer to: [Ethereum Transaction](../../ethereum/concepts/transaction.md)
8+
9+
## How an ACCOUNT transaction works
10+
11+
The account model keeps track of all balances as a global state. This state can be understood as a database of all accounts, private keys, and contract-code controlled along with their current balances of the different assets on the network. Transactions are interpreted by the virtual machine in the network, and make the corresponding state changes to all accounts in the global state.
12+
13+
![ACCOUNT-STATE-TRANSITION (Source: SEBA Research)](../../assets/images/account-model-transaction.jpg)
14+
15+
To better understand how an UTXO transaction been constructed, imagine Bob wants to pay 3.7 ETH to Alice:
16+
17+
1. Check if Bob has enough ETH balance (4.4 ETH) to cover the payment (3.7 ETH).
18+
19+
2. Send 3.7 ETH from Bob to Alice.
20+
21+
3. Bob's ETH balance subtract payment amount, and set to 4.4 - 3.7 = 0.7 ETH.
22+
23+
4. Alice's ETH balance add payment amount, and set to 7.15 + 3.7 = 10.85 ETH.
24+
25+
## Transaction fees
26+
27+
They are calculated based on the number of computations required to complete the state transition. Ethereum set out to be a world computer. Hence they decided that fees should be based on the number of computational resources consumed rather than storage capacity taken.
28+
29+
## Replay attack & Nonce
30+
31+
A replay attack is when a payee broadcasts a fraudulent transaction in which they get paid a second time. If the fraudulent transaction were to be successful, the transaction would be executed a second time - it is replayed - and the sender would be charged twice the amount they wanted to transfer.
32+
33+
To prevent replay attacks, each transaction in the account model has a nonce attached. A replay attack is when a payee broadcasts a fraudulent transaction in which they get paid a second time. If the fraudulent transaction were to be successful, the transaction would be executed a second time - it is replayed - and the sender would be charged twice the amount they wanted to transfer.
34+
35+
To combat this behavior, each account in Ethereum has a public viewable nonce that is incremented by one with each outgoing transaction. This prevents the same transaction being submitted to the network more than once.
36+
37+
## References
38+
39+
[Comparing the UTXO and Account Model](https://www.horizen.io/academy/utxo-vs-account-model/#comparing-the-utxo-and-account-model)
40+
41+
[TRANSACTIONS](https://ethereum.org/en/developers/docs/transactions/)
42+
43+
[Ethereum Whitepaper](https://ethereum.org/en/whitepaper/#ethereum-whitepaper)

0 commit comments

Comments
 (0)