11.9 C
Los Angeles
Sunday, March 26, 2023
HomeCryptoSolana Core Concepts. The...

Solana Core Concepts. The Good, Bad, and Ugly | by Mabel Oza | Coinmonks

Good

Solana is popular with a growing ecosystem. Some significant Solana projects are Civic, Audius, Raydium, Serum, FTX, and many NFT marketplaces (thanks to Metaplex).

Solana uses Rust, making it easier for pre-existing Rust developers to jump into development. On top of it, they have a stable framework called Anchor that abstracts out a lot of complex code and makes it easy for beginner Rust developers.

Solana’s most significant selling point is their high Transaction Per Second (~50,000 TPS), one of the highest among popular blockchain networks.

Bad

A high number of validators keeps the network secure and available. As of 1/10/2021, there are only 1,371 validators up. Running a Solana node can get expensive; you need a 128GB RAM machine with a CPU around 3GHz+, and the recommended hardware (AMD Ryzen) can cost around $729.

Ugly

There have been multiple network outages within a year, one on 9/14/21 and another on 10/9/21.

9/14/21 Network Outage

Bots during a Raydium IDO (Initial DEX Offering) flooded the network at 300k tx per second. This overloaded the “forwarders” (part of the Gulf Stream queues that push transactions to validators) and caused the validators to crash. To mitigate this the block producers started to automatically propose a number of forks. Because of parallelization, validators couldn’t agree on a fork.

After the network was “restarted”, 80% of the validators agreed on a state of the chain and manually did a hard fork, the issue was resolved.

I highly recommend checking out Leopold Schabel’s analysis on Solana’s Network Outage on 9/14/21.

In developing Solana, 8 innovations came about to help Solana achieve its speed and scalability. I will not cover all these concepts, just a few notable ones.

Proof of History is a clock solution that works with distributed systems on determining the time. In a distributed system, each node must maintain its clock. Using PoH, they can maintain their clock using VDF (Verifiable Delay Function).

VDF is a sequential hash function where the input is the previous function’s output. It makes it impossible to parallelize, preventing anyone with additional CPU cores from influencing the results. However, we can verify the results using multiple CPU cores, making it take a fixed time to calculate the results but immediate to verify.

More on VDF can be from the lecture below. In Solana’s case, VDF isn’t used for randomness but for determining a universal clock.

Sequencing Events

With proof-of-history, we know that Alice was at the stations after the newspaper was published, March 7th, 2017 (assuming she could have been reading an old newspaper) and was there before this blog was published, January 19th, 2022. We know Alice had to be at this train station between March 7th, 2017, and January 18th, 2022.

More on how Proof of History works:

Tower BFT is a Byzantine Fault Tolerant consensus that prefers liveness over safety. So it values everyone being on the same page over the consistency of results.

TBFT is the specific algorithm used in Solana, and it’s a variation of proof of stake. TBFT is somewhat controversial in the community because it favors speed over decentralization, because:

  1. TBFT runs over a fixed set of validators called active set
  2. Leader election uses a deterministic approach based on PoH
  3. The active set is predictable

This isn’t a deal-breaker, and it doesn’t make Solana a very decentralized system, it means it leans more towards speed, and for certain use cases like a DEX (Decentralized Exchange), that’s perfect.

More on Tower PBFT can be found below.

Solana introduces this new concept of mempool-less transaction forwarding.

A little background on Mempools…

Mempools are the waiting for transactions before they go through consensus. All the transactions in a node’s mempool are unconfirmed transactions waiting for a miner to prioritize them and put them into their block. Each node has a different mempool, with different transactions, number of transactions, and queuing systems, it’s really a huge mess.

Check out Dan Robinson Dark Forest to get a better understanding of it (https://medium.com/@danrobinson/ethereum-is-a-dark-forest-ecc5f0505dff).

So if there isn’t a waiting room, where do these unconfirmed transactions go? They are submitted directly to the current leader’s TPU (Transaction Processing Unit), and the leftovers are forwarded to the next leader in line. With this process, transactions aren’t prioritized based on fees.

One benefit of doing things differently is preventing forward and backward running attacks like the Sandwich Attack. Besides something that happens every day at lunchtime, the Sandwich Attack is an infamous front-running attack. In a sandwich attack, the price of an asset is manipulated by buying and selling the asset, and it’s all possible because the transactions are exposed but not locked in yet in a particular order.

Image from https://hackernoon.com/no-sandwich-please-popular-defi-attack-strategy-analysis-jk1734rf

Turbine is the communication layer that handles block propagation, there are two elements to it packeting and neighborhoods.

Packets

It’s inspired by BitTorrent (for all of you early 2000 Napster Pirates), and like BitTorrent, it chunks up a block into packets and distributes them in 64kbs to different validators. The data is transmitted using UDP (User Datagram Protocol) and implements a random path per pack through the network as leaders stream their data.

What if someone is terrible and decides not to rebroadcast data or rebroadcasts bad data? To protect ourselves from culprits like that each node generates Reed-Solomon erasure codes. Erasure codes allow each validator to reconstruct the entire block without receiving all the packets. The validators with the most staked (remember proof of stake) have a higher weight in the selection (fanout) algorithm.

Neighborhood

Turbine creates neighborhoods throughout the network. The leader retransmits packets to a neighborhood. The highest stakers are in the neighborhood are closest to the leader.

Each validator retransmits the packet to another neighborhood and its peers in the neighborhood, and so the story goes on.

Sealevel is Solana’s runtime environment, similar to how Ethereum has EVM’s, Solana has Sealevel. Sealevel was created to allow parallel executions of instructions and transactions, it achieves this using the scatter-gather pattern.

Scatter-Gather is a Message routing pattern that broadcasts messages to multiple recipients and aggregates the response in a single message.

Scatter Gather

“Like replicated and sharded systems, the scatter/gather pattern is a tree pattern with a root that distributes requests and leaves that process those requests. However, in contrast to replicated and sharded systems, with scatter/gather requests are simultaneously farmed out to all of the replicas in the system. Each replica does a small amount of processing and then returns a fraction of the result to the root. The root server then combines the various partial results together to form a single complete response to the request and then sends this request back out to the client.”

It uses SIMD (Single instruction, multiple data), a multiprocessor machine that’s capable of executing the same instructions on all the CPUs but operating on different data streams.

Sealevel gives the homework ahead of time. Each instruction tells the VM which accounts it wants to read and write ahead of time; the root of optimizations to the VM are:

  • Sort millions of pending transactions.
  • Schedule all the non-overlapping transactions in parallel

Only non-overlapping transactions can run in parallel. It can’t run transactions that write to the same account in parallel, so Solana programs must optimize account locking behavior and not write-lock the same set of accounts.

Does Sealevel execute transactions?

No, it schedules transactions, it doesn’t execute these transactions in the VM. Instead, it passes the instructions to the hardware using bytecode called Berkeley Packet Filter (BPF).

Fun Fact (for Nerds): When you create smart contracts for Solana, you will notice the Borsh rust crate. This is used to handle BPF serialization.

The idea here is to make other lightweight nodes that aren’t validator nodes storage nodes, archivers. These nodes don’t participate in consensus but are compensated if they can prove at any given time they are storing the data, this is known as proof of replication (PoRep). The history of a state is broken into pieces and is erasure coded, so Archivers store small chunks of a state.

More on Archiver nodes can be found below:

Speed

Without a doubt, Solana is fast, and it has the TPS (~50,000) to prove it.

Scalable

Solana is scalable, and their scalability was tested out with Tour de Sol, but I have doubts after seeing the backlash from 9/14/21’s network outage. Not having a mempool isn’t a great way to throttle transaction loads when transactions rapidly increase. Because it’s difficult to set up a Solana node, it prevents more validators from helping out in the network. As the number of transactions increases, how will the limited number of running validators handle the increased load?

Security

How Gulfstream prevents forward and back running attacks is interesting and makes the network secure from financial fraud. A cryptographic clock, Proof of History, that validates node times makes the ordering of transactions more trustworthy.

Anchor Framework

Solana Cookbook

Solana Tutorial and Explainer

Solana Full Stack Tutorial (React, Rust, Phantom)

Sample Code for Creating Token

NFT Marketplace Generator

Auditing Solana Contracts

Everything I Know about Solana

Solana Whitepaper

Join Coinmonks Telegram Channel and Youtube Channel learn about crypto trading and investing

Source link

Most Popular

LEAVE A REPLY

Please enter your comment!
Please enter your name here

More from Author

Ari Lennox Shares ‘Princess And The Frog’ Video Audition

Ari Lennox revealed her fans were heartbroken late last year age gender location tourism Will be her last. "I love my loyal fans so much and can't wait to give you my all every night!!" she wrote on social media. "Europe, I love you, but...

DefiLlama resolves internal conflict, quelling ‘hostile takeover’ accusations

Decentralized finance (DeFi) analytics platform DefiLlam has resolved an internal conflict that threatened to result in a “fork” of the platform. The issue was first raised by developer 0xngmi, who claimed on Twitter on March 19 that DefiLlama was "subject to a hostile takeover" for launching a token...

Sifflet raises cash to expand its data observability platform

Organizations working with large amounts of data often struggle to ensure that data remains high quality. According to a research from Great Expectations, which creates open source data testing tools, 77% of companies have data quality problems and 91% believe that this affects their performance. With this...

Matt Kuhnemann gets ‘awesome tips’ from Ravindra Jadeja

Ravindra Jadeja he is a man of his word. India allrounder promised Australia spinner Matt Kuhnemann masterclass after the Border-Gavaskar series - and he did just that.Soon Fourth exam in Ahmedabad ended in a draw on Monday, Jadeja took time to speak to the Australian visitor....

At Ukraine’s front, police try to evacuate holdout families

AVDIIVKA, Ukraine -- Pale and grimy from living in a damp, dark basement for nearly a year, the crying teenager and her mother emerged to the sound of pounding artillery and made their way to a waiting armored police van that took them into salvationRussian forces were...

Rabbit Hole Cast Had No Idea About The Show’s Twists Until The Very End [Exclusive]

Meta Golding also came as a bit of a surprise to co-star as Hayley Winton in the series alongside Kiefer Sutherland. she told me: "When I first got the script, I think I had two episodes. At that point, I didn't even understand if she was good or...

Will Amazon Or Apple TV + Offer The Pac-12 Deal They Can’t Say No To?

By Jim Williams If we're to believe what we're reading in the trade press, the new Pac-12 media deal with ESPN, Amazon Prime Video, and Apple TV+ remains on the table. What we've been reading in the tea leaves is that potential conversations are heavy on distribution...

Abdur Rehman to be Pakistan’s head coach for Afghanistan T20Is; Umar Gul named bowling coach

Pakistan mentioned Abdur Rehman as a long-time principal and Umar Gul as the bowling coach for the three T20I matches against Afghanistan. Mohammad Yousuf and Abdul Majeed will continue as batting coach and player, respectively.Rehman is an experienced homework trainer with more than ten years of experience...

Ari Lennox Celebrates Sobriety With Splits In A Sexy Dress

go through Kay Lewis Posted on March 21, 2023 1:00 amAli Lennox released a series of Behind-the-scenes A picture was taken before she hit the stage, and they were kind of spooky. Ari Lennox Bling The singer wore what appeared to be gold coins, held together...

Arbitrum token finds its way to OTC market before the airdrop

The Arbitrum community has been speculating and selling its unissued ARB tokens in the over-the-counter (OTC) markets following Arbitrum's announcement. Arbitrum Foundation announced that ARB, Arbritrum's new token, will be released to eligible community members on Thursday, March 23rd. It was explained that ARB Marks Arbitrum's...