generated from open-education-hub/oer-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
414f952
commit 03ba087
Showing
17 changed files
with
247 additions
and
84 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Blocks in Blockchain | ||
|
||
For simplicity, we will use MultiversX blockchain and MultiversX [Explorer](https://explorer.multiversx.com/). | ||
|
||
## Notarization of blocks | ||
|
||
Inspect the image below: | ||
![Blocks on MultiversX](../../media/blocks.png) | ||
|
||
We can observe 4 blocks from 1 second ago for 4 different shards: Shard0, Shard1, Shard2, Metachain. | ||
These shard a sub-blockchains and enables MultiversX to scale. You can read more about shard [here](https://docs.multiversx.com/technology/adaptive-state-sharding). | ||
|
||
We can observe 4 more blocks from 7 seconds ago. That's because each shard outputs a block every 6 seconds. | ||
|
||
--- | ||
**NOTE** | ||
|
||
We previously saw that _every 6 seconds starts new round_, but _not necessarly a new block gets notarized_. | ||
In this case all the blocks successfully passed the consensus round and got notarized. | ||
|
||
--- | ||
|
||
|
||
## Block details | ||
|
||
[Here](https://explorer.multiversx.com/blocks/cec3654a58245c7b548ffdb56254107b3a3a46903b5d191cf67ff126eaa17111) is the link for one of the blocks in the previous image (Block Height: 16826695). | ||
|
||
![Block 16826695](../../media/block_16826695.png) | ||
|
||
Observe the block details: | ||
- Round | ||
- Epoch | ||
- Age (timestamp) | ||
- Shard | ||
|
||
Based on a simple calculus, the epoch is 1168 which means this blockchain started 3 years and 73 days ago. | ||
|
||
We will talk about the other fields in the next section. | ||
|
||
|
||
## Practice | ||
|
||
1. Go to the MultiversX [Explorer](https://explorer.multiversx.com/) and check more blocks from different shard; | ||
2. Go to the Ethereum [Explorer](https://etherscan.io/) and check some blocks details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Consensus Group | ||
|
||
We will continue with the same [block](https://explorer.multiversx.com/blocks/cec3654a58245c7b548ffdb56254107b3a3a46903b5d191cf67ff126eaa17111) from the previous section (Block Height: 16826695). | ||
|
||
Observe the field **Consensus Group**: | ||
![Leader](../../media/leader.png) | ||
|
||
There are 63 validators which execute every transaction in this block. | ||
If you click on the **63 validators (See all)** button you will see 63 public keys, which are links to all the 63 nodes that participated in consensus. | ||
|
||
## Practice | ||
|
||
- Open 3 different blocks in 3 different tabs. Observe that every time there is another consensus group. | ||
Why do you think the system is designed this way? | ||
- Open 3 different blocks in 3 different tabs on Ethereum [Explorer](https://etherscan.io/). Observe that every time there is another leader. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Blockchain Leader | ||
|
||
We will continue with the same [block](https://explorer.multiversx.com/blocks/cec3654a58245c7b548ffdb56254107b3a3a46903b5d191cf67ff126eaa17111) from the previous section (Block Height: 16826695). | ||
|
||
![Leader](../../media/leader.png) | ||
|
||
We can observe that the **Leader** (also called the **proposer**) is `Istari Vision`. | ||
The leader, also known as the block producer or validator, is responsible for performing several critical tasks within a consensus round: | ||
|
||
1. **Block Proposal:** The leader is tasked with proposing a new block containing a set of transactions. This block proposal is the first step in the process of reaching consensus. The leader selects transactions to include in the proposed block and creates a cryptographic hash of the block's contents. | ||
|
||
2. **Signature and Verification:** After proposing a block, the leader signs it with their private key to prove its authenticity. Other network participants can verify the leader's signature using their public key. This verification ensures that the proposed block is indeed from the authorized leader. | ||
|
||
3. **Broadcasting the Proposal:** Once the block is signed, the leader broadcasts it to the network. Other nodes in the network receive and validate the proposed block to ensure its compliance with the consensus rules. | ||
|
||
4. **Agreement and Confirmation:** If the proposed block meets the consensus criteria, it is accepted by the network. The leader's proposed block becomes part of the blockchain, and consensus is achieved for that round. | ||
|
||
Let's see some details about this proposer: | ||
|
||
![Istari Vision](../../media/istari.png) | ||
|
||
We can see his public key, version of the software for the blockchain node and other information we will further discuss. | ||
|
||
## Practice | ||
|
||
Open 3 different blocks in 3 different tabs. Observe that every time there is another leader. | ||
Why do you think the system is designed this way? |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Understanding Time in Blockchains | ||
|
||
In traditional computer systems, time is relatively straightforward, with a reliance on the system clock. | ||
However, in the world of blockchains, time is a unique and critical concept. | ||
Blockchains need to maintain a shared understanding of time across all participants, and this introduces some complexities. | ||
Here's how time is managed in blockchains: | ||
|
||
## Rounds | ||
|
||
`Rounds`` refer to the cyclic or sequential stages of consensus protocols, particularly in proof-of-stake (PoS) and delegated proof-of-stake (DPoS) blockchains. | ||
Each blockchain has it's own length of rounds: | ||
- MultiversX - 6 seconds; | ||
- Ethereum - 12 seconds; | ||
- Solana - 0.4 seconds; | ||
- Cardano - 5 seconds; | ||
- NEAR - 1 second; | ||
|
||
A round is a time limit to execute a batch of transactions. | ||
|
||
## Blocks | ||
|
||
Every **round** a new **block** is being proposed. | ||
That proposal can succeed or not. In case of success, a block is added to the blockchain history. | ||
The missed blocks are due to not reaching consensus and are usually under 5%. | ||
|
||
|
||
--- | ||
**NOTE** | ||
|
||
For MultiversX case, _every 6 seconds starts new round_, but _not necessarly a new block gets notarized_. | ||
|
||
--- | ||
|
||
## Epochs | ||
|
||
This is another time measurement and it's used for larger periods of time (just like minutes, hours, years, decades, etc.). | ||
|
||
Each blockchain has it's own length of epochs: | ||
- MultiversX - 14.400 rounds (24 hours); | ||
- Ethereum - 30.000 rounds (100 hours); | ||
- Solana - 432.000 rounds (48 hours); | ||
- Cardano - 432.000 rounds (5 days); | ||
- NEAR - 43.200 rounds (12 hours). | ||
|
||
## Block Timestamps | ||
|
||
Blockchains organize transactions into blocks, and each block has a timestamp. This timestamp is crucial for several reasons: | ||
|
||
1. **Order of Transactions:** The timestamp helps order transactions within a block. Transactions are grouped together and processed in the order in which they are added to a block. This ensures that everyone has a consistent view of the transaction history. | ||
|
||
2. **Difficulty Adjustment:** Some blockchains, like Bitcoin, use the block timestamp to adjust the difficulty of the proof-of-work (PoW) algorithm. This keeps the block generation rate relatively constant, regardless of the total network hash rate. | ||
|
||
3. **Block Validity:** Block timestamps are used to determine whether a block is valid. If the timestamp of a new block is too far in the future or past, it can be considered invalid. | ||
|
||
## Practice | ||
|
||
Check MultiversX [Explorer](https://explorer.multiversx.com/) and Ethereum [Explorer](https://etherscan.io/) and see how (almost) at every 6, respectively 12 seconds a new block appears. |
37 changes: 37 additions & 0 deletions
37
chapters/introduction/lab/content/explorer/transactions.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Transactions | ||
|
||
We will continue with the same [block](https://explorer.multiversx.com/blocks/cec3654a58245c7b548ffdb56254107b3a3a46903b5d191cf67ff126eaa17111) from the previous section (Block Height: 16826695). | ||
|
||
Observe the field **Transactions**: | ||
![Block 16826695](../../media/block_16826695.png) | ||
We can see that there are 6 transactions in this group. | ||
|
||
## Miniblocks | ||
|
||
Transactions are grouped in **miniblocks**. | ||
Each miniblock is a category with `Shard_source - Shard_destionation`. | ||
|
||
So, for the first miniblock we have 3 transactions from Shard1 to Shard2: | ||
![Block 16826695](../../media/miniblock.png) | ||
|
||
## Transaction details | ||
|
||
We will use the first [transaction](https://explorer.multiversx.com/transactions/e988394fa40fb97796f2250c3f33087eba46e3a12ef6d3a0ed3b0dbb2084df18#32cfd2a98e1467aaeac65b9a211cf54bc9453cac0ba64da39a8bf789967bf0a2) from the first miniblock as an example: | ||
|
||
|
||
![Transaction](../../media/transaction1.png) | ||
|
||
Observe the fields: | ||
- Status: Success; | ||
- Age: timestamp; | ||
- Miniblock: the one we previously disscussed about; | ||
- From: The user who created the transaction | ||
- To: The destination of the transaction. This is a smart contract. We will discuss about it in a further section; | ||
- Value: The number of EGLD (MultiversX native token) sent in this transaction | ||
|
||
There are more fields in this transaction, but we will discuss about it in a further section. | ||
|
||
## Practice | ||
|
||
- Open 3 different transactions in 3 different tabs. Inspect the fields. | ||
- Open 3 different transactions in 3 different tabs on Ethereum [Explorer](https://etherscan.io/). Inspect the fields. |
Empty file.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters