Sui is a Layer-1 blockchain addressing critical issues in the current blockchain technology such as high transaction costs and network congestion. Sui has been designed to be a high-performance blockchain emphasizing lower latency and achieving up to 120k TPS (transactions per second) via parallel execution, therefore presenting a viable alternative to existing L1s like Ethereum.
This article will cover Sui's implementation of the Move programming language adopted by chains like Aptos and Meta-influenced Diem (Libra), using "objects," parallel execution, and cryptography.
Move, the programming language that powers the Sui blockchain
Move is a programming language introduced in the Diem Blockchain, designed to create custom transactions and smart contracts. It features a unique approach to resource management, where resources are immutable and can only be transferred, not copied or discarded, ensuring high levels of security.
The implementation of the Move programming language on Sui introduces several vital differences and enhancements compared to its use on the Diem blockchain, tailoring it to Sui's unique architecture and capabilities:
- Object-Centric Global Storage: Unlike Diem's Move, which uses global storage to hold resources and modules owned by accounts, Sui does not employ global storage similarly. Instead, Sui's approach is object-centric, where objects and packages are given unique identifiers. This type of architecture allows Sui to schedule transactions that don't overlap in inputs in parallel, significantly improving throughput and reducing delays in finality.
- Addresses as Object IDs: In Sui, the traditional 16-byte address type common with Diem's Move is replaced with a 32-byte identifier used for both objects and accounts, reflecting Sui's lack of global storage. Each object and account has a unique identifier, enhancing the system's scalability and efficiency.
- Unique Object IDs with Key Ability: Sui extends the critical ability of Move to indicate that a structure is an object type, requiring the first field of the structure to contain the object's unique address on-chain. This ensures that every object has a globally unique ID, a concept not present in Diem's Move.
- Module Initializers: Sui introduces module initializers that run only once upon module publication. This feature allows developers to pre-initialize module-specific data, like creating singleton objects, providing a more flexible and efficient setup process for smart contracts.
- Entry Points for Object References: Sui's Move allows public functions to take objects by value, immutable reference, or mutable reference, with specific rules governing the manipulation and ownership of these objects. This includes direct invocation of module functions through entry points, even for private functions, as long as other non-entry functions haven't used the inputs.
Now that we have a better understanding of Sui's implementation of Move for its programming language, let's discuss what objects are, in more depth.
Sui’s Object-Centric Data Model
Source: John Hyuck Won
So-called "objects" are the primary storage units central to Sui’s architecture. Unlike blockchains that center storage around accounts with key-value stores, Sui's approach is object-centric.
But what exactly do we mean by object-centric?
Sui's object-centric data model treats all entities on the blockchain as objects, with a clear differentiation between structures and packages (Move contracts). This is how Sui's approach stands out.
You may also be interested in:
By representing entities as objects, Sui simplifies the conceptual model of how entities interact on the blockchain. This clarity benefits developers by making it more straightforward to design dApps, as the relationships between addresses and objects are more transparent and deterministic.
The core of Sui's security isn't just using objects but the sophisticated features these objects support.
Each object in Sui comes with metadata that defines its ownership and accessibility, which can be by an address, another object, or shared/frozen states. This model allows for definitive access control and verifiable assumptions about object interactions, significantly enhancing security.
Objects in Sui can have specific abilities (key, store, copy, drop) that dictate their interaction and lifecycle. These abilities enable a rich hierarchy and control mechanism, such as:
- Key: Ensures each object has a unique ID in the global pool, facilitating unique identification and tracking.
- Store: Allows objects to encapsulate others, enabling complex hierarchies and ownership models (e.g., a liquidity pool owning its liquidity).
- Copy: Controlled duplication ability, which prevents double-spending and ensures the uniqueness of assets.
- Drop: Ensures objects are properly owned or shared by the end of a transaction, preventing loss or orphaned assets.
In addition, by leveraging the precise ownership semantics, Sui can execute transactions in parallel, significantly enhancing throughput and efficiency.
Transactions that don't involve mutably shared objects can bypass the consensus process, taking a fast path that relies on the deterministic outcome of transactions based on their inputs rather than their order. This aspect of Sui's design reduces latency and increases the capacity for parallel processing.
Traditional blockchains like Ethereum and Diem's Move implementation rely on a more account-centric model, where the state is managed through accounts and their associated key-value pairs. This model can be less intuitive for certain types of dApps and may introduce complexities in managing access controls and ensuring security.
Unlike these traditional models, Sui's approach to defining clear ownership and capabilities for objects enhances security through verifiable access control. Sui’s approach unlocks a level of parallelization not feasible in account-centric blockchains. This results in a more scalable, efficient, and developer-friendly platform.
Parallel Execution
To go into greater detail on parallel execution, Sui has implemented a parallel transaction execution system, significantly boosting its transaction processing speeds. This system manages multiple network states concurrently while ensuring consistency in the final state across transactions.
Parallel execution is an innovative approach in blockchain that enables the simultaneous processing of multiple transactions, contrasting sharply with the traditional sequential execution method, where transactions are processed sequentially. This technique significantly boosts network throughput and scalability.
The main difference lies in how transactions are processed. Sequential execution requires network-wide validation for each transaction, consuming much energy and time.
Parallel execution, however, streamlines this process by allowing independent transactions to be executed concurrently, enhancing speed and reducing costs without compromising compatibility with the Ethereum Virtual Machine (EVM) environment.
Implementing parallel execution involves identifying transactions that can be executed without interfering with each other, a task complicated by the intricate relationships between transactions. This process is akin to managing computer memory, where the challenge is to efficiently handle transactions that do not share dependencies, requiring sophisticated control mechanisms tailored to each blockchain's unique architecture.
The benefits of parallel execution include improved scalability and maintained transparency, making the network more efficient while keeping transactions open for verification. However, it introduces complexities, such as the need for nodes to process simultaneous transactions rapidly, which can strain the network's infrastructure.
Additionally, expanding the network to support parallel execution may affect the blockchain's decentralization, introducing a trade-off between speed and decentralization.
Cryptography
Cryptography is a foundational element that ensures the security, integrity, and trustworthiness of transactions and data stored on the blockchain. One of the primitives Sui employs revolves around secure and frictionless user onboarding to Sui, zkLogin.
zkLogin
zkLogin simplifies user interaction with decentralized applications (dApps) on the Sui blockchain by allowing sign-in with standard web credentials, similar to those used for Google and Facebook. It will enable developers to use invisible wallets for a seamless user experience or to provide a more straightforward method for users to access their on-chain assets.
zkLogin is compatible with existing account types, including mnemonic and hardware wallets, catering to beginners and experienced users. zkLogin generates user accounts through OAuth credentials, creating a JSON web token (JWT) combined with a Salt (a number where each value yields a different public wallet address), to produce a zero-knowledge proof (ZKP). This ZKP confirms the user's identity without revealing their credentials on the blockchain, enabling secure transactions via OAuth credentials.
zkLogin supports various OpenID OAuth providers, like Google, Twitch, and Facebook, with expansion plans. For detailed implementation guidance, check out the provided documentation and SDKs.
Transaction Authentication
Sui's transaction authentication enhances security against unauthorized access with support for multiple key types and cryptographic algorithms. It embraces standards like BIP-32 and BIP-39 for key management and offers diverse signature options, including Ed25519 and ECDSA variants.
Sui's design enables cryptographic flexibility, multi-sig transactions for added security layers, offline signing for network-independent authentication, and intent signing to ensure signatures commit to specific transaction intents.
Final Thoughts
Sui stands out as a leading L1 blockchain with its unique use of the Move programming language and an object-centric data model to address scalability and efficiency issues prevalent in traditional blockchains like Ethereum.
By enabling parallel execution and supporting up to 120k transactions per second (TPS), Sui offers a scalable and efficient platform for developers and users.
Sui’s unique approach to storage, security through advanced cryptography, and user-friendly features such as zkLogin positions it as a promising blockchain alternative for building dApps.