Skip to content

Commit

Permalink
Merge branch 'develop' into devx/wallet-docs-pre-release-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
lucas-tortora authored Nov 15, 2024
2 parents 18d94a3 + 0f6ff19 commit 0a18ce9
Show file tree
Hide file tree
Showing 64 changed files with 1,740 additions and 1,452 deletions.
159 changes: 12 additions & 147 deletions docs/content/about-iota/iota-architecture/consensus.mdx
Original file line number Diff line number Diff line change
@@ -1,153 +1,18 @@
---
description: Overview of the IOTA mempool and consensus engines, Narwhal and Bullshark.
sidebar_label: Mempool and Consensus
title: Consensus on IOTA
sidebar_label: Consensus
description: Overview of the IOTA consensus.
---

import Quiz from '@site/src/components/Quiz';
import {questions} from '../../../site/static/json/about-iota/iota-architecture/consensus.json';
The basic purpose of consensus in blockchains is to agree on a consistent order and ensure the availability of transactions.

# Consensus on IOTA
On IOTA, consensus has a simple API: validators submit different user transactions to consensus concurrently, and the consensus outputs a consistent stream of transactions across all well-behaving validators.

## Narwall and Bullshark
Byzantine-fault tolerant (BFT) consensus protocols are a rich area of research. The next-generation consensus engine in IOTA is based on the **Mysticeti** protocol.
The protocol optimizes for both low latency and high throughput because:
- It allows multiple validators to propose blocks in parallel, utilizing the full bandwidth of the network and providing censorship resistance. These are features of the DAG-based consensus protocols.
- It takes only three rounds of messages to commit blocks from the DAGs, same as pBFT and matches the theoretical minimum.
- The commit rule allows voting and certifying leaders on blocks in parallel, further reducing the median and tail latencies.
- The commit rule also tolerates unavailable leaders without significantly increasing the commit latencies.

IOTA uses [Narwhal](https://github.com/iotaledger/iota/tree/develop/narwhal),
and [Bullshark](https://arxiv.org/abs/2209.05633), the high-throughput mempool and consensus engines developed by Mysten
Labs, to sequence transactions that require total ordering, synchronize transactions between validators, and
periodically checkpoint the
network's state.

[Narwhal](https://arxiv.org/abs/2105.11827) ensures that data that was submitted for consensus is readily available,
while [Bullshark](https://dl.acm.org/doi/abs/10.1145/3548606.3559361) is in charge of generating a consensus on the
specific ordering of said data.

The IOTA consensus engine is a cutting-edge advancement in multi-proposer, high-throughput consensus algorithms. It can
achieve over 125,000 transactions per second with a two-second latency for a deployment of 50 participants. This
includes production-level cryptography, permanent storage, and a scaled-out primary-worker architecture.

The IOTA consensus engine offers significant scalability advantages in the following scenarios:

* A blockchain that has experimented with larger blocks and encountered increased latency before the execution phase.
* A blockchain with fast execution (e.g., focused on transactions or using a UTXO data model) where the mempool and
consensus processes cannot keep up.

## Key Features

The Narwhal mempool offers:

* A high-throughput data availability engine with cryptographic proofs of data availability at
a [primary node](https://github.com/iotaledger/iota/blob/develop/narwhal/primary)
* A structured graph data structure for traversing information.
* A scaled architecture that splits disk I/O and networking requirements across
several [workers](https://github.com/iotaledger/iota/blob/develop/narwhal/worker)

## Architecture

A Narwhal instance sets up a message-passing system with a set of $3f+1$ units of stake divided among nodes. It assumes
a computationally bounded adversary that controls the network and can corrupt parties holding up to $f$ units of stake.
The validators collaborate to form a leaderless graph of transaction batches, referred to as collections in IOTA (often
called blocks in DAG-based consensus literature). This process uses mempool data with an unspecified consensus
algorithm.

The graph's _vertices_ are certified collections. Each valid collection, signed by its validator-author, must include a
round number and a certificate of availability signed by a quorum (2f+1) of validator stake. Each collection must also
contain hash pointers to a quorum of valid certificates (from validators with 2f + 1 units of stake) from the previous
round, forming the _edges_ of the graph.

Collections are formed as follows: each validator reliably broadcasts a collection for each round. Subject to specified
validity conditions, if validators with 2f + 1 stake receive a collection, they acknowledge it with a signature.
Signatures from 2f + 1 validators by stake form a certificate of availability, which is then shared and potentially
included in collections at round r + 1.

The following figure represents five rounds of constructing such a DAG (1 to 5), with validators A, B, C, and D
participating. For simplicity, each validator holds 1 unit of stake. The collections transitively acknowledged by A's
latest round in A5 are represented with solid lines in the graph.

```mermaid
flowchart TB;
subgraph A;
A5 --> A4 --> A3 --> A2 --> A1;
end;
subgraph B;
B5 -.-> B4 --> B3 --> B2 --> B1;
end;
subgraph C;
C5 -.-> C4 --> C3 --> C2 --> C1;
end;
subgraph D;
D5 -.-> D4 -.-> D3 --> D2 --> D1;
end;
A5 --> B4 & C4;
A4 --> C3 & D3;
A3 --> B2 & C2;
A2 --> C1 & D1;
B5 -.-> A4 & C4;
B4 --> C3 & D3;
B3 --> A2 & C2;
B2 --> C1 & D1;
C5 -.-> A4 & B4;
C4 --> B3 & D3;
C3 --> A2 & B2;
C2 --> B1 & D1;
D5 -.-> A4 & B4;
D4 -.-> B3 & C3;
D3 --> A2 & B2;
D2 --> B1 & C1;
```

## How It Works

* The graph construction enables the insertion of more transactions into the system by each authority and in each round.
* Certificates prove the data availability of each collection or block in every round.
* The contents form a DAG that can be identically traversed by each honest node.

## Dependencies

Narwhal is implemented using:

* [Tokio](https://github.com/tokio-rs/tokio)
* [RocksDB](https://github.com/facebook/rocksdb/)

Generic cryptography is implemented in [fastcrypto](https://github.com/MystenLabs/fastcrypto).

## Configuration

You can follow the instructions
on [Running Benchmarks](https://github.com/iotaledger/iota/blob/develop/narwhal/benchmark) to conduct a fresh deployment
of IOTA Consensus Engine.

## Further Reading

Narwhal and Tusk (Danezis et al., 2021) is a consensus system that leverages directed acyclic graphs (DAGs). DAG-based
consensus has been developed over the last 30 years, with some history summarized in Wang et al. (2020). The theoretical
ancestor of Narwhal and Tusk is DAG-Rider (Keidar et al., 2021).

Narwhal and Tusk are developed in
the [asynchronous model](https://decentralizedthoughts.github.io/2019-06-01-2019-5-31-models/). A partially synchronous
variant of Narwhal and Tusk is called Bullshark (Spiegelman et al. 2022).

Narwhal and Tusk started [as a research prototype](https://github.com/facebookresearch/narwhal) at Facebook Novi.

[Bullshark: DAG BFT Protocols Made Practical](https://arxiv.org/pdf/2201.05677.pdf) -
Bullshark replaces Tusk for even greater performance.

[Bullshark: The Partially Synchronous Version](https://arxiv.org/pdf/2209.05633.pdf) -
A simplified version of Bullshark that is used in IOTA today.

[DAG Meets BFT - The Next Generation of BFT Consensus](https://decentralizedthoughts.github.io/2022-06-28-DAG-meets-BFT/) -
Explains the evolution of the consensus protocol used by IOTA.

## Bibliography

* Danezis, G., Kogias, E. K., Sonnino, A., & Spiegelman, A. (2021). Narwhal and Tusk: A DAG-based Mempool and Efficient
BFT Consensus. ArXiv:2105.11827 [Cs]. http://arxiv.org/abs/2105.11827
* Spiegelman, A., Giridharan, N., Sonnino, A., & Kokoris-Kogias, L. (2022). Bullshark: DAG BFT Protocols Made Practical.
ArXiv:2201.05677 [Cs]. https://dl.acm.org/doi/abs/10.1145/3548606.3559361
* Spiegelman, A., Giridharan, N., Sonnino, A., & Kokoris-Kogias, L. (2022). Bullshark: The Partially Synchronous
Version. ArXiv:2209.05633 [Cs]. https://arxiv.org/abs/2209.05633
* Keidar, I., Kokoris-Kogias, E., Naor, O., & Spiegelman, A. (2021). All You Need is DAG. ArXiv:
2102.08325 [Cs]. http://arxiv.org/abs/2102.08325
* Wang, Q., Yu, J., Chen, S., & Xiang, Y. (2020). SoK: Diving into DAG-based Blockchain Systems. ArXiv:
2012.06128 [Cs]. http://arxiv.org/abs/2012.06128

## Quizzes
<Quiz questions={questions} />
For more details including correctness proofs, the [Mysticeti paper](https://arxiv.org/pdf/2310.14821) is the best source.
16 changes: 12 additions & 4 deletions docs/content/about-iota/iota-architecture/iota-architecture.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: IOTA Architecture
---
import ThemedImage from '@theme/ThemedImage';

IOTA shares some similarities with other blockchains but is unique in many ways. Use the topics in this section to understand the features that define the IOTA network.

Expand All @@ -16,11 +17,12 @@ Life of a Transaction details the transitions that all transactions on IOTA go t

Go to [Life of a Transaction](transaction-lifecycle.mdx).

## Mempool and Consensus Engines
## Consensus

Narwhal and Bullshark combine to form the basis of the IOTA mempool and consensus engine. This topic offers a brief introduction to the technologies that keep the activities on IOTA synchronized and secure.
Every transaction on IOTA is sequenced by consensus, where validators agree to the same order of execution of the transactions, even if a minority of them are down or are malicious actors that want to harm the network and users.
IOTA currently uses the [Mysticeti](https://arxiv.org/pdf/2310.14821) consensus algorithm.

Go to [Mempool and Consensus Engines](consensus.mdx).
Go to [Consensus](consensus.mdx).

## Protocol Upgrades

Expand All @@ -39,4 +41,10 @@ The core components are:
- [IOTA RPC](../../references/iota-api)
- [IOTA CLI](../../references/cli)

![IOTA Architecture](/img/concepts/execution-architecture/iota-architecture.svg)
<ThemedImage
alt='IOTA Architecture'
sources={{
light: '/img/concepts/execution-architecture/iota-architecture.svg',
dark: '/img/concepts/execution-architecture/dark/iota-architecture.svg',
}}
/>
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
import Quiz from '@site/src/components/Quiz';
import {questions} from '../../../site/static/json/about-iota/iota-architecture/transaction-lifecycle.json';
import ThemedImage from '@theme/ThemedImage';

# Transaction Life Cycle

## High-level Overview

![Transaction life cycle](/img/about-iota/iota-architecture/txn-lifecycle.png)
<ThemedImage
alt='Native functions'
sources={{
light: '/img/about-iota/iota-architecture/TransactionLifeCycle.svg',
dark: '/img/about-iota/iota-architecture/dark/TransactionLifeCycle.svg',
}}
/>

1. **Create a Transaction**: A user [submits](#submission) a transaction and signs it with a private key. The transaction can affect objects owned by the user, as well as [shared objects](../../developer/iota-101/objects/object-ownership/shared.mdx).

Expand Down
12 changes: 9 additions & 3 deletions docs/content/about-iota/tokenomics/tokenomics.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
title: IOTA Tokenomics
---

import Quiz from '@site/src/components/Quiz';
import {questions} from '../../../site/static/json/about-iota/tokenomics/tokenomics.json';
import ThemedImage from '@theme/ThemedImage';

The collective ideation that the term tokenomics encompasses includes a wide range of concepts that define the science and behavior of blockchain economies. In basic terms, tokenomics are the financial foundation of blockchains. Much the same way a building with a poor foundation is doomed to fail, a blockchain without a well-researched, extensively planned, and painstakingly implemented token economy eventually crumbles.

Expand All @@ -23,7 +23,7 @@ Three main types of participants characterize the IOTA economy:
The IOTA economy is composed of four core components:

- **[IOTA](iota-token.mdx):** The IOTA token is the IOTA platform native asset.
- **[Gas fees](gas-in-iota.mdx):** Gas fees are charged on all network operations, consisting of a computation fee component and a fully rebated storage deposit component. Gas is used to reward participants of the proof-of-stake mechanism and prevent spam and denial-of-service attacks.
- **[Gas fees](gas-in-iota.mdx):** Gas fees are charged on all network operations, consisting of a computation fees which are burnt and a fully rebated storage deposits.
- **[Staking rewards](proof-of-stake.mdx):** Staking rewards are provided to users participating in the delegated proof-of-stake mechanism, namely delegators and validators. This incentivizes honest behavior by IOTA Validators and the IOTA token holder that delegate to them.
- **Voting:** On-chain voting is used for governance and protocol upgrades.

Expand All @@ -32,7 +32,13 @@ The IOTA economy is composed of four core components:

The following flowchart presents the tokenomic flow of IOTA at a high level. Referring back to this chart after you learn concepts in this section should provide additional clarity.

![IOTA tokenomics flow](/img/about-iota/tokenomics/iota-tokenomics-flow.png "Flowchart showing the tokenomics structure.")
<ThemedImage
alt='IOTA Tokenomics flow'
sources={{
light: '/img/about-iota/tokenomics/IOTA-tokenomics-flow.svg',
dark: '/img/about-iota/tokenomics/dark/IOTA-tokenomics-flow.svg',
}}
/>

## Quizzes
<Quiz questions={questions} />
8 changes: 8 additions & 0 deletions docs/content/developer/getting-started/local-network.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,15 @@ The response resembles the following, but with different IDs:
```

:::tip explorer

In order to use the explorer locally users can use the deployed explorer and set another endpoint like this: [https://explorer.iota.cafe/?network=http%3A%2F%2F127.0.0.1%3A9000](https://explorer.iota.cafe/?network=http%3A%2F%2F127.0.0.1%3A9000) or manually provide a Custom RPC URL on the [Explorer](https://explorer.iota.cafe/) page in the top right corner.

:::

:::warning HTTPS only

The [IOTA Explorer](https://explorer.iota.cafe) requires a secure HTTPS connection. If your local network doesn't support HTTPS, consider [running your own instance of the Explorer](https://github.com/iotaledger/iota/tree/develop/apps/explorer#iota-explorer).

:::

## Install IOTA Wallet Locally
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ import { homedir } from 'os';
import path from 'path';
import { Ed25519Keypair } from '@iota/iota-sdk/keypairs/ed25519';
import { fromB64 } from '@iota/iota-sdk/utils';
import { fromBase64 } from '@iota/iota-sdk/utils';
const sender = execSync(`${IOTA} client active-address`, { encoding: 'utf8' }).trim();
const signer = (() => {
Expand All @@ -606,7 +606,7 @@ const signer = (() => {
);
for (const priv of keystore) {
const raw = fromB64(priv);
const raw = fromBase64(priv);
if (raw[0] !== 0) {
continue;
}
Expand Down Expand Up @@ -708,7 +708,7 @@ import { fileURLToPath } from 'url';
import { getFullnodeUrl, IotaClient } from '@iota/iota-sdk/client';
import { Ed25519Keypair } from '@iota/iota-sdk/keypairs/ed25519';
import { Transaction } from '@iota/iota-sdk/transactions';
import { fromB64 } from '@iota/iota-sdk/utils';
import { fromBase64 } from '@iota/iota-sdk/utils';
const IOTA = 'iota';
const POLICY_PACKAGE_ID = '<POLICY-PACKAGE>';
Expand All @@ -722,7 +722,7 @@ const signer = (() => {
);
for (const priv of keystore) {
const raw = fromB64(priv);
const raw = fromBase64(priv);
if (raw[0] !== 0) {
continue;
}
Expand Down Expand Up @@ -963,7 +963,7 @@ import { fileURLToPath } from 'url';
import { getFullnodeUrl, IotaClient } from '@iota/iota-sdk/client';
import { Ed25519Keypair } from '@iota/iota-sdk/keypairs/ed25519';
import { Transaction, UpgradePolicy } from '@iota/iota-sdk/transactions';
import { fromB64 } from '@iota/iota-sdk/utils';
import { fromBase64 } from '@iota/iota-sdk/utils';
const IOTA = 'iota';
const POLICY_PACKAGE_ID = '<POLICY-PACKAGE>';
Expand All @@ -979,7 +979,7 @@ const signer = (() => {
);
for (const priv of keystore) {
const raw = fromB64(priv);
const raw = fromBase64(priv);
if (raw[0] !== 0) {
continue;
}
Expand Down
Loading

0 comments on commit 0a18ce9

Please sign in to comment.