Project Review: How Solana works.
Solana is a high performance and high throughput BlockChain network. It uses PoH for generating blocks and PoS for voting confirmation. Solana has two types of nodes: leader and validator. The leader processes all transactions and broadcasts them to the entire network. Validators voting block confirmation via PoS mechanism, the verifications is faster than generate and can be running on parallelly.
Solana invented PoH(proof of history) for generating a time slot. Each slot has one block, the previous block hash was used for the next block-generating input. For understanding PoH well, you can treat it as a VDF(verifiable delay function). Like the PoW(proof of work) time-consuming feature, it still uses Sha256 for the computing cycle. Solana named each sha256 calling as a tick, a block must be ticked for 400ms. The PoH algorithm Pseudocode is like:
function poh_generate()
hash = prev_block_hash
loop ticks
hash = sha256(hash) //one tick
return hash
end
The entire network has a primary leader, the leader has been running PoH algorithm for its scheduled term. During the PoH algorithm running, each transaction will be inserted into the generating block, the order of transaction is determined by the queue order. Because a block can represent a unit of time, Solana utilized it for time synchronization and data consistency.
Every block is filled in a slot, even there is no transactions, the PoH still generate an empty block. The replatioship of PoH and transactions are like:
function poh_generate()
hash = prev_block_hash
loop ticks
tx = obtain_transaction_from(queue)
if tx != nil
hash = sha256(hash, tx)
else
hash = sha256(hash)
end
end
return hash
end
Unlike the other BlockChain network without obvious structure, the Solana network is a tree structure. Solana transmits blocks over the GOSSIP protocol. Each block will be split into shreds with additional loss erasure codes. The order of sending packages doesn't need to be determined. Because the network is a top-down structure, each node just transmits packages to neighbors and lower- level nodes. The lower-level nodes don't need to send packages back to upper- level nodes.
how does Solana process transactions?
Solana has two types of nodes: Leaders and Validators. The Leader serves as primary and secondary, a primary Leader is running for each elected epoch, a secondary Leader receives backup blocks from primary. When the primary Leader has crashed, the secondary leader is scheduled for primary Leader. The primary Leader receives all transactions and merged them into the PoH slot, and then transmits them to all validators for voting the confirmed state.
When a user has created a transaction through a Client(wallet), It first sends the data to a node(validator) through HTTP. Next, the node send the transaction through UDP to Leader. After the Leader received the transaction, the Leader's TPU(Transaction Processing Unit) module processes the transaction and generates a block. The next stage is to broadcast the block to all validators. After a block has been verified by two third of validators, the final stage is to store the block on the BlockChain.
Solana represented each slot as a period of time, when a transaction has been banked(decreasing/increasing balance), it will be sent into the PoH queue and merged into the block.
Why Solana is fast and high throughput?
- The single leader can determine the time order and sync the ordered block fast.
- The network is tree architecture, package transmitting is up to down, it doesn't need to send back.
- PoH is fast, the leader only take 400ms to generate a block, other validators can verify a block immedately.
- Block transmitting are cut for packages with erasure codes, it can tolerant some degrees of loss packages.Turbo Engine
PoS can guranteen data consensus if the most of nodes are honest. According to the Byzantine protocol, one third of dishonest nodes will stop the network, two third of dishonest nodes will control the network. Solana is a centralised network. If a leader has attacked, the entire network needs time to resume.
See Also:
Solana Validator 101: Transaction Processing (Recommending)
Retrying Transactions
Shinobi Systems'
Solana Proof of Stake + Proof of History Primer
white paper
8 Innovations that Make Solana the First Web-Scale Blockchain