Home > Web3.0 > body text

One article reveals the speed king in the blockchain: Solana

WBOY
Release: 2024-06-12 17:42:26
Original
912 people have browsed it

A performance report

The "Fastest Chains" report released by CoinGecko on May 17 showed that Solana is the fastest among large blockchains, with the highest daily average real TPS reaching 1,504 (already Excluding voting transactions), Sui is the second fastest blockchain, with the highest daily average real TPS reaching 854. BSC ranks third, but the real TPS achieved is less than half of Sui.

One article reveals the speed king in the blockchain: Solana

It can be seen from this report that Solana and Sui, the best performing blockchains, are both non-EVM compatible blockchains. Furthermore, 8 non-EVM compatible blockchains The average real TPS of 17 EVM-compatible blockchains and Ethereum Layer2 is only 74. The performance of non-EVM-compatible blockchains is about 4 times that of EVM-compatible blockchains.

This article will explore the performance bottlenecks of EVM-compatible blockchains and reveal Solana’s performance method.

Performance bottlenecks of EVM-compatible blockchains

One article reveals the speed king in the blockchain: Solana

First, we generalize the EVM blockchain to general blockchains. Generally, if blockchain wants to improve TPS, the following methods are generally used:

  • Improve node performance: improve node performance by stacking hardware resources. The hardware requirements of the node will affect the degree of decentralization, such as The recommended configuration of Ethereum is Cpu 4 cores, memory 16G, network bandwidth 25Mbps, which can be achieved by ordinary user-level equipment, and the degree of centralization is high; Solana’s recommended configuration is relatively higher Cpu 32 cores, memory 128G, network bandwidth 1Gbps, professional-grade equipment can be achieved, the degree of centralization is average;
  • Improve the underlying protocol: including network protocols, cryptography, storage, etc. Improving the underlying protocol of the blockchain does not change the properties of the blockchain itself, nor does it affect the performance of the blockchain Running rules can directly improve the performance of the blockchain, but the underlying technology has received little attention, and there is currently no major breakthrough in the research field;
  • Expand the block: increasing the size of the block can include more transactions, thereby improving The transaction throughput of blockchains such as Bitcoin Cash (BCH) expanded blocks from 1 MB to 8 MB and later to 32 MB. However, expanding the block will also increase the propagation delay and cause security threats, such as increasing the possibility of forks and DDoS attacks;
  • Consensus protocol: The consensus protocol ensures that each node of the blockchain ensures that the blockchain Reaching consensus on status updates is the most important security gate of the blockchain. Consensus mechanisms that have been used in the blockchain include PoW, PoS, PBFT, etc. In order to meet the needs of scalability, generally high-performance public chains will improve the consensus protocol and combine it with its own special mechanism, such as Solana's PoH-based consensus mechanism and Avalanche's avalanche-based consensus mechanism;
  • Transaction execution: Transaction execution They only care about the number of transactions or computing tasks processed per unit time. Blockchains such as Ethereum use a serial method to execute smart contract transactions in blocks. In serial execution, the performance bottleneck of the CPU is very obvious, which seriously restricts Blockchain throughput. Generally, high-performance public chains will adopt parallel execution, and some will propose language models that are more conducive to parallelism to build smart contracts, such as Sui Move.

For the EVM blockchain, the biggest challenge lies in transaction execution due to the limitation of the virtual machine, that is, the transaction execution environment. EVM has two main performance issues:

  • 256-bit: EVM is designed as a 256-bit virtual machine in order to make it easier to process Ethereum’s hash algorithm. It will explicitly generate 256-bit output. However, the computer actually running EVM needs to map 256-bit bytes to the local architecture for execution. One EVM opcode will correspond to multiple local opcodes, making the entire system very inefficient and impractical;
  • Lack of standard library: There is no standard library in Solidity, and you must implement it yourself with Solidity code. Although OpenZeppelin has improved this situation to some extent, they provide a standard library for Solidity implementation (by including the code in the contract or by Call the deployed contract in the form of delegatecall), but the execution speed of EVM bytecode is much lower than that of the precompiled standard library.

From the perspective of execution optimization, EVM still has two major shortcomings:

  • Difficult to do static analysis: Parallel execution in the blockchain means processing unrelated transactions at the same time, treating unrelated transactions as events that do not affect each other. The main challenge in achieving parallel execution is to determine which transactions are irrelevant and which are independent. Currently, some high-performance public chains perform static analysis on transactions in advance. The dynamic jumps mechanism of EVM makes it difficult to statically analyze the code. ;
  • JIT compiler is immature: JIT compiler (Just In Time Compiler) is a commonly used optimization method in modern virtual machines. The main goal of JIT is to turn interpretation execution into compiled execution. At runtime, the virtual machine compiles the hot code into machine code related to the local platform and performs various levels of optimization. Although there are currently EVM JIT projects, they are still in the experimental stage and not mature enough.

Therefore, in terms of the selection of virtual machines, high-performance public chains use virtual machines based on WASM, eBPF bytecode or Move bytecode rather than EVM. Solana, for example, uses its own unique virtual machine SVM and eBPF-based bytecode SBF.

Fastest Chains: Solana

One article reveals the speed king in the blockchain: Solana

Solana is famous for its PoH (Proof of History) mechanism and low latency and high throughput. It is the most famous "Ethereum chain". One of the "Fang Killers".

The core of PoH is a simple hash algorithm similar to the Verifiable Delay Function (VDF). Solana is implemented using a sequence preimage-resistant hash function (SHA-256) that runs continuously, using the output of one iteration as the input for the next. This computation is run on a single core per validator.

One article reveals the speed king in the blockchain: Solana

While sequence generation is sequential and single-threaded, verification can occur in parallel, enabling efficient verification on multi-core systems. While there is an upper bound on hash speed, hardware improvements may provide additional performance gains.

One article reveals the speed king in the blockchain: Solana

Solana Consensus Process

The PoH mechanism serves as a reliable and trustless time source, creating a verifiable and ordered record of events within the network. PoH-based timing allows the Solana network to rotate leaders in a scheduled and transparent manner. This rotation occurs at fixed intervals of 4 slots, each slot is currently set to 400 milliseconds. ⁠This leader rotation mechanism ensures that every participating validator has a fair chance to become the leader and is an important mechanism for the Solana network to maintain decentralization and security, preventing any single validator from gaining too much power on the network.

One article reveals the speed king in the blockchain: Solana

Each slot period, the leader proposes a new block containing transactions received from users. The leader validates these transactions, packages them into a block, and then broadcasts the block to the remaining validators of the network. This process of proposing and broadcasting blocks is called block production, and other validators in the network must vote on the validity of the block. Validators check the contents of blocks to ensure transactions are valid and comply with network rules. A block is considered confirmed if it receives a majority vote of the stake weight. This confirmation process is critical to maintaining the security of the Solana network and preventing double spends.

When the current leader’s time period ends, the network will not stop or wait for block confirmation, but will move to the next time period, providing subsequent leaders with the opportunity to produce blocks, and the entire process starts over. This approach ensures that the Solana network maintains high throughput and remains resilient, even if some validators experience technical issues or go offline.

Solana Performance Tips

Because the Solana network can confirm leaders in advance, Solana does not require a public memory pool to hold users' transactions. When a user submits a transaction, the RPC server converts it into a QUIC packet and immediately forwards it to the leader's validator. This approach is called Gulf Stream, and it allows for fast leader switching and pre-execution of transactions, reducing the memory load on other validators.

Solana’s block data is brought into the kernel space, and then passed to the GPU for parallel signature verification. Once the signature is verified on the GPU, the data will be passed to the CPU for transaction execution, and finally returned to the kernel space for execution. Data persistence. This multiple processing process of dividing data into different hardware components, called pipeline technology, can maximize hardware utilization and speed up the verification and transmission of blocks.

Because Solana's transactions explicitly specify which accounts are accessed, Solana's transaction scheduler can utilize the read-write lock mechanism to execute transactions in parallel. Each thread of the Solana transaction scheduler has its own managed queue, processes transactions sequentially and independently, attempts to lock (read-write lock) the account of the transaction and execute the transaction. Transactions with account conflicts will be executed later. This multi-threaded parallel execution technique is called Sealevel.

The process by which the leader propagates blocks, dividing QUIC packets (optionally using erasure coding) into smaller packets and distributing them to validators with a hierarchical structure. This technique, called Turbine, essentially reduces the bandwidth usage of the leader.

During the voting process, validators use a consensus mechanism for fork voting. Validators do not need to wait for votes to proceed with block production; instead, block producers continuously monitor for valid new votes and include them in the current block in real time. This consensus mechanism is called TowerBFT, and by merging fork votes in real time, Solana ensures a more efficient and streamlined consensus process, thereby improving overall performance.

For the persistence process of blocks, Solana developed the Cloudbreak database to maximize SSD by partitioning the account data structure in a specific way to benefit from the speed of sequential operations and using memory mapped files. s efficiency.

To reduce the burden on validators, Solana moves data storage from validators to a network of nodes called Archiver. The history of transaction status is split into many fragments and erasure coding technology is used. Archiver is used to store fragments of state, but does not participate in consensus.

Summary

Solana’s vision is to be a blockchain whose software scales at the speed of hardware, so Solana takes full advantage of all the CPU, GPU and bandwidth capabilities available in today’s computers to maximize Optimal performance, the theoretical maximum speed can reach 65,000 TPS.

It is precisely because of Solana’s high performance and scalability that Solana has become the preferred blockchain platform for processing high-frequency transactions and complex smart contracts, whether it is the DePIN/AI track at the beginning of the year or the recent hot Meme On the track, Solana showed great potential.

After the launch of the Ethereum ETF, Solana has also become the cryptocurrency with the most calls for the next ETF. Although the SEC still lists Solana as a security, other cryptocurrency ETFs will not be approved in the short term. But in the crypto market, consensus is value, and Solana’s consensus may be becoming as indestructible as Bitcoin and Ethereum.

The above is the detailed content of One article reveals the speed king in the blockchain: Solana. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:jb51.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact [email protected]
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!