In the first of Encode Club’s Sui series, we explain Sui’s infrastructure and how it differs from other blockchains.
The Sui Foundation partnered with Encode Club to offer a series of six developer-focused videos. This series will range from the basics of Sui to tutorials about building smart contracts and working with objects in Sui Move.
Our introduction to Sui, hosted by Encode Club, includes fundamentals about Sui’s infrastructure. We cover the different types of transactions and how they increase scalability, the components of the consensus engine, and key Sui advantages.
Sui differentiates transactions into two categories: simple and complex.
For simple transactions, such as sending tokens from one account to another or minting an NFT, a transaction may bypass the consensus protocol. This makes Sui scalable and increases throughput on the blockchain by allowing unrelated assets to reach finality almost immediately, without having to go through the relatively longer and more expensive consensus process.
For complex transactions, such as a liquidity pool, orderbook, or any other myriad of DeFi use cases using shared objects, transactions go through Sui’s novel Narwhal and Bullshark directed acyclic graph (DAG)-based mempool and efficient Byzantine Fault Tolerant (BFT) consensus.
Due to Sui’s object-centric view, as well as Move’s strong ownership types, dependencies are explicitly encoded. As a result, Sui both agrees on and executes transactions on many objects in parallel.
Let’s hop into some of the terminology regarding Sui’s novel consensus engine.
A DAG is essentially a directed graph that never loops. It consists of edges and vertices, with each edge directed from one vertex to another, such that following those directions will never form a closed loop.
Sui utilizes a DAG in the form of its mempool engine, Narwhal, which is decoupled from its consensus engine, Bullshark. By decoupling transaction dissemination from consensus, Sui is able to achieve very high throughput.
Bullshark is a state-of-the-art consensus engine that, unlike its predecessors, allows for consistently high transactions-per-second regardless if there are weaker validators in the set or not.
Sui uses an object-oriented data model. Distinct objects on Sui include a coin balance, an NFT instance, and a smart contract. This data model allows smart contracts to express computation on objects. It also means transactions are naturally organized in groups based on the objects they are targeting.
Through features such as horizontal scaling, composability, sparse replay, and on-chain storage, Sui’s architecture solves pain points common to first generation blockchains.
On the Sui network, each group of transactions process in parallel, as opposed to the bottlenecking that occurs in some earlier blockchains due to any lack of distinction between the various objects, resources, accounts, and other components.
In Sui, unlike most other blockchains, one can directly pass an asset (such as an NFT), directly into a function argument. Sui’s object-centric approach also allows for more esoteric data structures, and the ability to store assets inside such data structures, or in an asset itself.
Naturally, a blockchain provides a ledger of every single transaction. For a Sui-specific example, game builders don’t need to track transactions interacting with unrelated dApps. Because querying on-chain data can be expensive, products on Sui will be able to follow the evolution of the objects in this game, without digging out the data from the Merkle tree.
Because assets are directly stored as objects on the Sui blockchain, they are never subject to Merkle tree indexing. Storing assets directly on-chain is used in tandem with conventional means, such as IPFS, to scale the problem of on-chain storage, as it is much cheaper to directly update assets on-chain.
Note: This article has been updated from its original form to correct a sentence about higher latency in the consensus model. While the original Narwhal paper made this discovery, the Sui network has been refined to deliver low latency.