• This repository has been archived on 18/Oct/2022
  • Stars
    star
    153
  • Rank 243,368 (Top 5 %)
  • Language
    Rust
  • License
    Apache License 2.0
  • Created about 3 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Narwhal & Tusk are a high throughput mempool & consensus, used in the Sui smart contract platform

Narwhal development now happens at https://github.com/MystenLabs/sui/tree/main/narwhal

For Narwhal (and Bullshark / Tusk) users: Narwhal (together with Bullshark and Tusk) still exists as an independent project. We will be periodically publishing Narwhal packages to crates.io.

For Narwhal (and Bullshark / Tusk) contributors: to consolidate infrastructure and iterate faster, the latest development of Narwhal will happen in the Sui repo. Please open your PRs and issues over there. Appreciate the contributions!

Narwhal

build status rustc license Narwhal Rust Crates Documentation (main) codecov

This repo provides an implementation of Narwhal, Tusk and partially synchronous Bullshark, a DAG-based mempool and efficient BFT consensus. The codebase has been designed to be small, efficient, and easy to benchmark and modify.

This repo uses fastcrypto as its cryptography library.

Quick Start

The core protocols are written in Rust, but all benchmarking scripts are written in Python and run with Fabric. To deploy and benchmark a testbed of four nodes on your local machine, clone the repo and install the python dependencies:

$ git clone https://github.com/mystenlabs/narwhal.git
$ cd narwhal/benchmark
$ pip install -r requirements.txt

You also need to install Clang (required by RocksDB) and tmux (which runs all nodes and clients in the background). Finally, run a local benchmark using Fabric:

$ fab local

This command may take a long time the first time you run it (compiling rust code in release mode may be slow), and you can customize a number of benchmark parameters in fabfile.py. When the benchmark terminates, it displays a summary of the execution similarly to the one below.

-----------------------------------------
 SUMMARY:
-----------------------------------------
 + CONFIG:
 Faults: 0 node(s)
 Committee size: 4 node(s)
 Worker(s) per node: 1 worker(s)
 Collocate primary and workers: True
 Input rate: 50,000 tx/s
 Transaction size: 512 B
 Execution time: 19 s

 Header size: 1,000 B
 Max header delay: 100 ms
 GC depth: 50 round(s)
 Sync retry delay: 10,000 ms
 Sync retry nodes: 3 node(s)
 batch size: 500,000 B
 Max batch delay: 100 ms

 + RESULTS:
 Consensus TPS: 46,478 tx/s
 Consensus BPS: 23,796,531 B/s
 Consensus latency: 464 ms

 End-to-end TPS: 46,149 tx/s
 End-to-end BPS: 23,628,541 B/s
 End-to-end latency: 557 ms
-----------------------------------------

Next Steps

The next step is to read the paper Narwhal and Tusk: A DAG-based Mempool and Efficient BFT Consensus. It is then recommended to have a look at the README files of the worker and primary crates. An additional resource to better understand the Tusk consensus protocol is the paper All You Need is DAG as it describes a similar protocol.

The README file of the benchmark folder explains how to benchmark the codebase and read benchmarks' results. It also provides a step-by-step tutorial to run benchmarks on Amazon Web Services (AWS) across multiple data centers (WAN).

License

This software is licensed as Apache 2.0.

More Repositories

1

sui

Sui, a next-generation smart contract platform with high throughput, low latency, and an asset-oriented programming model powered by the Move programming language
Rust
5,992
star
2

awesome-move

Code and content from the Move community.
1,355
star
3

fastcrypto

Common cryptographic library used in software at Mysten Labs.
Rust
236
star
4

ed25519-unsafe-libs

List of unsafe ed25519 signature libs
Rust
194
star
5

move-book

The Move Book and The Move Reference
Move
122
star
6

capybot

Automated trading bot
TypeScript
58
star
7

mysticeti

Mysticeti: Low-Latency DAG Consensus with Fast Commit Path
Rust
45
star
8

apps

Home for applications created by MystenLabs
Move
45
star
9

mysten-infra

Common infrastructure used by multiple Mysten projects
Rust
36
star
10

sui-genesis

Genesis state for various sui networks
29
star
11

truncator

Compress cryptographic outputs via mining
Rust
23
star
12

deepbookv3

Deepbook V3
Move
21
star
13

walrus-sites

Walrus Sites: Decentralized Websites using Sui and Walrus.
Rust
19
star
14

blackjack-sui

BlackJack with Sui and Move!
TypeScript
17
star
15

satoshi-coin-flip

A Move implementation of a time locked Satoshi coin flip game.
Move
16
star
16

dapol

DAPOL+ Proof of Liabilities using Bulletproofs and Sparse Merkle trees
Rust
16
star
17

research

Research papers
Python
15
star
18

suins-contracts

The SuiNS Smart Contracts & Documentation repository
Move
14
star
19

capybot-monitor

A Jupyter Notebook to monitor the status of a Capybot
Python
13
star
20

evm-sui-bridge

Solidity
12
star
21

solvency-proofs

Cryptographic Solvency Proofs (schemes, standards, links, edu material)
11
star
22

Sui-Unity

Unity project to test SuiDotnet interface
C#
10
star
23

sui-axelar

Move
9
star
24

example-walrus-sites

A demo for a dApp on Walrus Sites, with minting and per-NFT sites.
HTML
9
star
25

mysten-sim

Deterministic executor + network sim for tokio-based systems.
Rust
6
star
26

polydiv

Faster Polynomial Division
Rust
6
star
27

sui-fantasy

Move
5
star
28

sui-doctor

Tool for automatic diagnosis of configuration problems
Python
5
star
29

sui-circulation-api

Simple API returning info about SUI circulation amounts
CSS
4
star
30

controlled-treasury

An example smart contract to manage a controlled treasury with flexible risk-management controls
Move
4
star
31

multisig-move

Move
4
star
32

sui-dev-newsletter

The Sui developer newsletter repository
Python
4
star
33

plinko-poc

TypeScript
3
star
34

sui-native-randomness

Move
3
star
35

telemetry-subscribers

Common utilities for Tokio-based application telemetry, including tracing, logging, spans
Rust
2
star
36

react-native-zklogin-poc

TypeScript
2
star
37

sui-nft-rental

Move
1
star
38

suifrens-display-system

Library that demonstrates how SuiFren images are constructed and rendered 🦈
TypeScript
1
star
39

BugPub

The First Web3 Bug Bounty Marketplace
TypeScript
1
star
40

historical-jwks-zklogin

Rust
1
star