Frontend Development / Software Development / Technology

Solana Uses Rust to Pull in Developers and Avoid Copypasta

31 Jan 2022 6:00am, by
copypasta

One of the interesting developer trends in Web3 is the emergence of Rust as a way to program blockchains. Rust, of course, is a popular programming language that has a wide range of uses — it’s been the most-loved language in Stack Overflow’s annual developer survey for the last six years. So its uses in crypto are just a part of what developers love it for. That said, if the blockchain Solana is anything to go by, Rust could become a key battleground technology for the future of Web3.

Many in the Web3 world view Solana as a potential competitor to Ethereum as the leading platform for dapps (decentralized applications). As of the time of writing, Solana is ranked seventh in market value on CoinMarketCap, a popular index of cryptocurrencies. It’s certainly the highest-ranked blockchain that uses Rust.

Before we get to Solana and Rust, a quick note on the “traditional” way to program a blockchain (I used air quotes because all of this stuff is less than a decade old!). Ethereum was the first programmable blockchain and to this day it is the foundational development environment for the small but growing Web3 ecosystem. To program something on Ethereum, you need to create a “smart contract” using a custom Ethereum language called Solidity. You then run the smart contract on the Ethereum Virtual Machine (EVM), Ethereum’s runtime environment.

How Development on Solana Works

Now let’s turn to how Solana approaches programming its blockchain. Firstly, in its developer documentation, Solana gets rid of the legal-sounding “smart contract” terminology and returns us to traditional software development language:

“In Solana, smart contracts are called Programs. Rust C, C++ are the languages used to build programs that are deployed on-chain.”

Once deployed to the Solana blockchain, programs “are run via the Solana Runtime where they live forever.” As with Ethereum, dapps for Solana will most likely be built using traditional Web 2.0 languages and frameworks (JavaScript and React are both popular). These dApps will then interact with “programs” on the blockchain via Solana’s JSON RPC API, which is the communication layer.

solana

Image via Solana

When creating a dApp, Solana recommends you use its official SDK, solana-web3.js, which according to Solana Labs “feels just like talking to any other API you’ve used.” But there are other, third-party, SDKs that are also built on top of the JSON RPC API — including SDKs for Java, C#, Python, Go, Swift, Dart-Flutter and Kotlin.

Why Did Solana Choose Rust?

In a recent episode of the YouTube show UpOnly, Solana’s founders Anatoly Yakovenko and Raj Gokal discussed the reasons why they opted to build Solana “programs” (a.k.a. Smart contracts) with Rust, and not the already established Solidity of Ethereum.

Yakovenko, who is the engineering brains of Solana, firstly noted Rust’s popularity. “​It’s not like we picked Haskell or something,” he joked (a dig at Solana’s rival blockchain, Cardano, currently ranked 6th on CoinMarketCap, which did choose Haskell). He went on to explain why they didn’t choose to build with Solidity and the Ethereum Virtual Machine (EVM).

“The hard part with EVM,” he said, “is are you gonna get, like, really smart people full-time thinking about […] how do I build in scale? […] Or are you just going to get somebody that copies something from Solidity and then slaps a token on it?”

What Yakovenko is getting at is that Solidity, in his opinion at least, attracts developers that are more likely to copy-and-paste smart contract code from existing blockchain projects (a practice known colloquially as “copypasta”). So by choosing Rust, which is a harder language to learn than Solidity and is much more likely to be used by professional programmers, they are hoping to attract developers who can build custom, scalable programs.

One of the co-hosts of UpOnly, a popular crypto influencer who goes by the name Cobie (real name Jordan Fish), noted that it could go the other way too — that inexperienced Rust developers could make a mess of building a program, and potentially cost users a lot of money. To that, Yakovenko replied that “we have a lot of community review,” made up of experienced developers who will “identify every bug that they can find.”

Solana’s Recent Technical Issues

Now’s a good time to mention that Solana has recently experienced some worrying network issues. Fortune reported last week that Solana “suffered its sixth serious outage of more than eight hours this month.”

Other blockchains have had problems too, in many cases caused by an inability to scale. “Ethereum continues to be plagued by scaling difficulties and extremely high gas fees,” Fortune wrote, “while newcomers like Polygon PoS saw costs spike by more than seven times in a month in January as play-to-earn video games clogged up demand.”

In a Twitter thread, Yakovenko blamed Solana’s problems on “liquidator bots […] spamming the network.” That suggests the outages are more related to cryptocurrency trading shenanigans than any issue with scaling programs on Solana. Regardless, it does highlight the dangers of developing applications on a blockchain. The likes of Solana — and even Ethereum — are still very new as development platforms.

Update, 3 February: after this article was published, the Solana blockchain was involved in a hack that resulted in around $300 million of wETH (“wrapped” Ethereum) being stolen. This Twitter thread has the details:

Solana’s Developer Community

Technical issues aside, Solana appears to have a thriving developer community. It’s one of the top five blockchain projects for Web3 development, according to a recent report from Electric Capital. Also, based on data analysis by the Cloud Native Computing Foundation (CNCF), The New Stack’s Lawrence Hecht reported that Solana “is demonstrating project velocity on par with the open source community’s mainstays.”

Solana also got good mileage out of a hackathon it ran last June. The winner of the “Web3 track” was an app called ​​Solarium, described as “a fully decentralized, end-to-end encrypted, censorship-resistant instant messenger based on the Solana blockchain.”

Solarium

Solarium in action.

The app looks slick enough, but there is one catch (and it’s the same catch on any crypto app) — it costs money to use the product. As co-creator Daniel Kelleher noted on the demo video, “every message on Solarium is a transaction on the Solana blockchain.”

It remains to be seen whether Solana’s embrace of Rust does indeed result in more high-quality blockchain dApps, compared to rival platforms like Ethereum and Cardano. Even if it does, there’s the enduring dApp usability issue to contend with. Examples like Solarium are interesting test cases, for sure, but new users are unlikely to flock to them as long as it’s pay-to-play.

Feature image via Pexels.