Exploring the object-oriented model and programming language
The Sui blockchain has emerged as a novel layer-1 (L1) protocol, incorporating sophisticated technologies to solve common layer-1 transactions. Cointelegraph Research uncovers the details of this newcomer to the blockchain space.
Sui uses the Move programming language, designed with a focus on property delegation and access control. This article examines Sui's object-oriented data storage model, its implications for transaction processing, and its advantages over traditional account-based paradigms.
An object-oriented example of UI
Sui draws significant inspiration from the Diem blockchain, particularly when it uses the Move programming language for smart contracts. Move is designed specifically for asset management and access control enforcement. SuiMove builds on this foundation an object-oriented data storage model that uses objects as primitives from labels.
Unlike the traditional token model, where transactions exchange balances, or the UTXO model, where transactions have simple inputs and outputs, its object model views assets (as well as smart contracts) as complex objects. Transactions in Sui take objects as inputs and transform these inputs into output objects. Each object records the hash of the last transaction it created. This approach is conceptually similar to the UTXO model but more general and powerful. A comparison of the models can be seen below.
MOVE uses linear logic to facilitate the creation of object-oriented model-connected and secure software. Linear logic, sometimes called resource logic, ensures that resources representing digital assets cannot be duplicated or inadvertently destroyed. When a transaction involving a property is executed, the SuMove definition process ensures that the property's state is updated to reflect the result of the transaction, consuming the property in its previous state and reproducing it in its new state.
Objects in Sui can have access controls and permissions that enhance security and control over resource usage after a transaction. This mitigates vulnerabilities common to account-based chains, allowing re-entry attacks. In a callback attack, a task makes an external call to another contract before updating its own state, allowing attackers to repeatedly execute actions that should only happen once.
This can lead to unauthorized changes in the contract state, such as spending more money than should be allowed. Since ownership transfers are transparent and atomic in Sui, this type of error cannot occur. Move's linear type system ensures that once a resource has been moved, it cannot be reused unless explicitly allocated.
The traditional tag-based model used by Solidity, on the other hand, requires developers to implement additional checks to prevent such errors. For example, re-entry attacks need to be avoided by following the check-influence-interaction pattern. All state change operations (effects) must occur after all checks, but before any interactions (external calls). This pattern, often referred to as optical accounting, ensures that state variables are updated before any external interaction takes place.
While the object-oriented model does not improve security by itself, it simplifies the development process and makes it easier to write secure code. Although smart contracts on Ethereum can be regularly verified to achieve a high level of security, this process can be complex and expensive.
Solidity is known for its semantic ambiguity, which makes it difficult for developers to reason about the code's behavior. This increases the chance of introducing hidden bugs and security vulnerabilities.
SUI Move is a language family that attempts to simplify secure contract development by baking sensible financial prerequisites into the language definition from the start. Another example is the Algorand blockchain's Transaction Execution Approval Language (TEAL), which uses a stateless execution model to ensure that transactions are atomic and secure.
Its object-oriented model is particularly useful for managing complex assets such as non-fungible tokens (NFTs). In Ethereum, NFTs are tied to smart contract addresses, and interactions often require complex contract calls and state updates, resulting in high costs and security risks. For example, transferring an NFT in Ethereum involves calling an ERC-721 smart contract function, which updates state and emits events.
This process involves several steps and gas charges for each operation. In contrast, Sui's object model allows each NFT to be viewed as a separate object with intrinsic properties and permissions. The behavior of NFTs is closely tied to the predecessors of the Move language, but in Ethereum this behavior must be implemented, which adds overhead and leaves room for error.
Object orientation and blockchain performance
An object-oriented model facilitates sharing and parallelization on the SUI blockchain. Combined with the recently improved Sui consensus mechanism, SUI can thus achieve a time-to-completion time of approximately 390 milliseconds.
This allows for a flow of over 100,000 transactions per second. A comparison of Sui with other popular layer-1 blockchains can be found below.
Database sharing with account-based chains and UI
One of the biggest concerns for blockchain is the famous trade-off between scalability, security and decentralization. Sharding, which facilitates the partitioning of blockchain databases, is considered a solution to this problem.
In arithmetic-based architectures, sharing involves partitioning the state into separate addresses. Each shard manages a separate address range, and transactions are performed on the shard that contains the data for the specified identifier.
However, this faces several issues. For example, Polkadot requires each account's balance and status to be updated and synchronized with shards (Parachains). Maintaining consistency across multiple shards is challenging because each shard must constantly synchronize with the global state, introducing latency and complexity.
Transactions involving accounts on different shards require shard messaging and coordination, which increases computational cost and delays the end of the transaction. In the past, this has led to a reduction in time on such restrictions, as seen for Zilica.
Its object-oriented model avoids many of these issues by treating each object as an independent unit of state. Objects can be created and managed independently without the need for global state synchronization, and multiple transactions can be executed concurrently without the need for synchronization across threads. This reduces the need for complex shard communication and allows for more straightforward and efficient parallel processing.
Parallel transaction process on SUI
Parallelism refers to executing multiple tasks at the same time and improving the speed of the process by using concurrent threads of execution.
There are two main methods of parallelization: state access method (or deterministic execution) and bright execution. In the state access method used by SU and Solana, transactions declare which parts of the state they access, allowing the system to identify independent transactions that can be executed simultaneously.
This approach ensures predictable results and eliminates the need to re-execute transactions, enabling flexible gas payment markets that manage congested government hotspots.
Bright execution, on the other hand, is used by networks like Monad and Aptos, where all transactions are initially independent and re-enforces any transactions that conflict with each other. While easier for developers, it can lead to computational inefficiencies.
Sui can achieve state access parallelism through its object-oriented model. Operations on one thing do not affect or delay the other, allowing them to work simultaneously naturally. Similar structural features simplify partitioning of transactional databases, thereby simplifying parallel processing on a single node.
Summary
In summary, the Sui blockchain's object-oriented model, combined with the Move programming language, addresses several key limitations of traditional layer-1 blockchains. The ability to process transactions in parallel greatly increases scalability and reduces latency.
Using linear logic and capability-based security ensures robust resource management and access control, which can reduce the risk of errors and security vulnerabilities. Additionally, Sui's approach to managing complex assets such as NFTs simplifies interoperability and improves efficiency compared to traditional account-based models. These features position Sue as an important development in blockchain technology.
In our next article, we will examine the Sui blockchain consensus mechanism, its evolution and the benefits it offers. Sui uses a consensus protocol designed to work with the object-oriented model.
To understand the contribution of these elements to the infrastructure, we examine the different aspects of its communication mechanism, including fault tolerance and utility optimization methods.
Additionally, we compare Sui's consensus approach to other popular blockchains such as Ethereum, Polkadot, and Solana, to identify its unique features and areas where it can excel or face challenges.
Magazine: As Ethereum Mining Gets Stronger, Drains Move To Tons And Bitcoin