Liquid Stake with compassSOL for an 7.50% APY from staking, MEV + fees

Enjoy the freedom of liquid staking in Solana Defi while delegating your stake to the high performance Solana Compass validator. Stake or unstake at any time here, or with a Jupiter swap.

Benefit from our high staking returns and over 2 years experience operating a Solana validator, and receive additional yield from priority fees + MEV tips

Earn 6.8% APY staking with Solana Compass

Help decentralize and secure the Solana network delegating your stake to us and earn an impressive 6.8% APY yield on your SOL, while supporting us to create new guides and tools. Learn more

Stake your SOL

  1. Click to connect your wallet
  2. Enter the amount you wish to stake
  3. Kick back and enjoy your returns
  4. Unstake from your wallet or our staking dashboard

Earn 6.8% APY staking with Solana Compass

Help decentralize and secure the Solana network delegating your stake to us and earn an impressive 6.8% APY yield on your SOL, while supporting us to create new guides and tools.

Learn more

Write Solidity on Solana with Solang (feat. Sean Young, Solana Labs) - Solfate Podcast #31

By Solfate

Published on 2023-08-23

Discover how Solang enables Solidity development on Solana, offering EVM developers a bridge to high-performance blockchain infrastructure.

The notes below are AI generated and may not be 100% accurate. Watch the video to be sure!

Solang: Bridging Solidity and Solana

The Solana ecosystem continues to expand its reach, now offering Ethereum developers a familiar path to high-performance blockchain infrastructure. In a recent episode of the Solfate podcast, hosts Nick and James sat down with Sean Young, the creator and lead developer of Solang - a groundbreaking compiler that allows developers to write Solana programs using the Solidity programming language. This innovative project aims to bridge the gap between Ethereum's vast developer ecosystem and Solana's high-speed, low-cost blockchain.

Sean Young's Journey into Blockchain

Sean Young's journey into the world of blockchain and cryptocurrency began rather serendipitously. A friend, excited about the potential of blockchain technology, introduced Sean to the Ethereum Virtual Machine (EVM) yellow paper. This initial exposure sparked Sean's interest, leading him to dive deeper into the crypto space.

Transitioning from his role at IBM, Sean joined a startup focused on implementing legal contracts on a permissioned blockchain. This experience provided him with valuable insights into the limitations of existing blockchain technologies and the Solidity programming language.

The Genesis of Solang

While working on blockchain solutions for legal contracts, Sean encountered limitations with the Solidity programming language. He explains:

"I kind of realized that there's lots of things you could add to Solidity but it was kind of hard to do because it was maintained by the Ethereum Foundation and it didn't want to add any features that didn't exist on Ethereum."

This realization led Sean to contemplate creating a new compiler from scratch. Initially estimating it would take about a year, Sean embarked on this ambitious project, starting with a proof of concept on a rainy Sunday.

The Journey to Solana

Sean's path to Solana was not direct. He first received a grant from Web3 Foundation to build a Solidity compiler for Polkadot, which compiles to WebAssembly (Wasm). After working on this for a year, Sean stumbled upon Solana while searching for other blockchain projects.

What caught Sean's attention was Solana's unique approach to blockchain architecture:

"When I was looking at Solana, I thought, 'How do you use BPF? That's amazing.' Then I started learning about the consensus protocol. I thought, 'This is so much better.'"

Sean was particularly impressed by Solana's ability to handle parallel transactions, a feature that set it apart from other blockchain platforms he had worked with previously.

Understanding Compiler Engineering

To appreciate the significance of Solang, it's crucial to understand the basics of compiler engineering. Sean provides a comprehensive overview of how compilers work:

  1. Parsing the source code to create a parse tree
  2. Validating the code and resolving variable names
  3. Converting the code into a control flow graph
  4. Transforming the code into low-level instructions
  5. Passing the instructions to LLVM for optimization and binary production

Sean emphasizes the importance of LLVM (Low Level Virtual Machine) in the compiler process:

"LLVM is kind of a, feels like a quite magical project. You give it some format of code and then it does all these great optimizations and then produces a binary for you. So a lot of the really tricky stuff is done for us."

Solang and the Solana Virtual Machine

One of the key aspects of Solang is its compatibility with the Solana Virtual Machine (SVM). Sean explains that Solang parses Solidity code, creates a control flow graph, converts it to LLVM IR (Intermediate Representation), and then transforms it into BPF (Berkeley Packet Filter) or SBF (Solana Berkeley Packet Filter) instructions that can be executed on the Solana blockchain.

This process opens up possibilities for other programming languages to be used on Solana. Sean mentions:

"So there's another project going on in Solana where they're trying to compile, move, to move programming language to Solana. That has to sit pretty much the same approach."

Differences Between Solana and EVM Development

For developers considering a transition from EVM-based chains to Solana, Sean highlights several key differences:

  1. Parallel Execution: Solana is designed for parallel execution of smart contracts, requiring developers to specify which accounts will be used in a transaction.

  2. Account Management: Unlike EVM, where contracts manage their own storage, Solana requires explicit account management.

  3. Contract Upgrades: Solana allows for easier contract upgrades without the need for proxy contracts.

  4. Token Standards: Solana uses the SPL token standard, which differs from Ethereum's ERC-20 standard.

Sean emphasizes that while Solang allows developers to use Solidity on Solana, it doesn't isolate them from Solana's unique architecture:

"Writing in the Solidity language doesn't kind of, it doesn't isolate you from the fact that Solana, it is a, it just works very differently."

The Future of Blockchain Development

When asked about the future of blockchain technology, Sean focuses on the virtual machine and compiler aspects:

"I think, as virtual machines go, Solana has a very good design. And there's a version two coming out being worked on the program runtime V2. And that has actually some very, very good optimizations with which I actually feel quite novel."

Sean is particularly excited about Solana's Program Runtime V2, which allows for more efficient contract interactions within a single VM, potentially leading to significant performance improvements.

Challenges and Opportunities

While Solang offers numerous benefits, it also presents some challenges. Sean acknowledges that maintaining compatibility with both Solidity and Solana's evolving ecosystem requires ongoing effort. However, he sees this as an opportunity to improve the developer experience and expand Solana's reach.

Sean mentions that the Solang team is working on a long-term plan to achieve feature parity with Rust development on Solana:

"The long-term vision is you can write contracts on Solana, in Rust or in Solidity, whatever you would like. We want developers to have a good experience writing Solidity and be able to do everything you can do in Solidity, which you can do in Rust."

The Developer Experience

James, one of the podcast hosts, reflects on the differences in developer experience between EVM-based chains and Solana:

"I found that while with Solidity EVM, it was very easy for me to write my first couple of smart contracts, that the hurdle from sort of beginner to intermediate was quite large. Whereas that hurdle on Solana is kind of front-loaded a little bit."

This observation highlights the trade-offs between the two approaches. While EVM chains might offer an easier entry point for beginners, Solana's model encourages developers to understand the underlying system from the start, potentially leading to more robust and efficient code as projects scale.

Potential Future Improvements

The conversation touches on potential future improvements to the Solana programming model. Sean speculates on the possibility of abstracting away some of the explicit account management:

"I have wondered about whether you can kind of optimistically execute where you just go, it's not executing a transaction. And if you need another account, then it just gets added into the transaction."

However, he also acknowledges the challenges this approach could introduce, such as potential deadlocks and increased computational overhead.

The Importance of Understanding Lower-Level Systems

James emphasizes the importance of developers understanding the systems they work with at a deeper level:

"If you're just sort of doing a UI layer of something, you should understand how things work two levels below that because inevitably you're going to run into hiccups where you have to kind of dip down into something that you would maybe otherwise be less familiar with."

This advice underscores the value of discussions like this podcast episode, even for developers who may not be working directly with compilers or low-level systems.

Conclusion

Solang represents a significant step forward in blockchain interoperability, offering Solidity developers a bridge to Solana's high-performance infrastructure. As Sean Young and his team continue to refine and expand Solang's capabilities, we can expect to see increased adoption and innovation within the Solana ecosystem.

The project not only demonstrates Solana's commitment to developer accessibility but also highlights the platform's technical advantages in areas such as parallelism and efficiency. As blockchain technology continues to evolve, tools like Solang will play a crucial role in fostering a diverse and robust development community across different blockchain platforms.

For developers interested in exploring Solang, Sean encourages them to try it out and provide feedback. With ongoing development and community support, Solang has the potential to significantly lower the barrier to entry for Ethereum developers looking to leverage Solana's unique capabilities, ultimately contributing to the growth and diversification of the blockchain ecosystem as a whole.

Facts + Figures

  • Sean Young is the creator and lead developer of Solang, a compiler that allows developers to write Solana programs in Solidity.
  • Solang has been a multi-year effort to enable Ethereum ecosystem developers to use their existing Solidity knowledge on the Solana blockchain.
  • Sean began his blockchain journey after being introduced to the EVM yellow paper by a friend.
  • Before working on Solana, Sean received a grant from Web3 Foundation to build a Solidity compiler for Polkadot.
  • Solang uses LLVM (Low Level Virtual Machine) to maximize compatibility for multiple programming languages.
  • The Solidity language maintained by the Ethereum Foundation releases updates every 4 to 6 months.
  • Solana's Program Runtime V2 is in development, offering novel optimizations for contract interactions.
  • Solang aims to achieve feature parity with Rust development on Solana.
  • The Solang team runs the Ethereum Solidity compiler test suite on their compiler to ensure compatibility.
  • Solana uses BPF (Berkeley Packet Filter) or SBF (Solana Berkeley Packet Filter) instructions for its virtual machine.
  • Solang parses Solidity code, creates a control flow graph, converts it to LLVM IR, and then transforms it into BPF or SBF instructions.
  • Solana's architecture is designed for parallel execution of smart contracts, requiring explicit account management.
  • Solana allows for easier contract upgrades without the need for proxy contracts, unlike Ethereum.
  • Solana uses the SPL token standard, which differs from Ethereum's ERC-20 standard.

Questions Answered

What is Solang?

Solang is a compiler that allows developers to write Solana programs (smart contracts) using the Solidity programming language. It acts as a bridge between the Ethereum and Solana ecosystems, enabling Solidity developers to leverage Solana's high-performance blockchain infrastructure. Solang parses Solidity code, converts it to LLVM IR, and then transforms it into instructions that can be executed on the Solana blockchain.

How does Solang differ from traditional Solidity compilers?

Unlike traditional Solidity compilers that target the Ethereum Virtual Machine (EVM), Solang compiles Solidity code for the Solana Virtual Machine (SVM). It uses LLVM for optimizations and generates BPF (Berkeley Packet Filter) or SBF (Solana Berkeley Packet Filter) instructions that can run on Solana. This approach allows Solang to take advantage of Solana's unique features, such as parallel execution and improved performance, while still providing a familiar development experience for Solidity programmers.

What are the main differences between developing for Solana and EVM-based chains?

The main differences include Solana's focus on parallel execution, which requires developers to specify accounts used in transactions upfront. Solana also has a different account model, where contracts don't manage their own storage. Contract upgrades are simpler on Solana, not requiring proxy contracts. Additionally, Solana uses the SPL token standard instead of ERC-20. While Solang allows the use of Solidity, developers still need to understand and work within Solana's unique architecture and programming model.

How does Solang maintain compatibility with both Solidity and Solana?

Solang maintains compatibility by running the Ethereum Solidity compiler test suite on their compiler to ensure basic language compatibility. However, due to Solana's different architecture, some features are implemented differently or may not be available. The Solang team works to add Solana-specific features and optimizations while trying to keep the developer experience as close to traditional Solidity as possible. They also keep track of Solidity language updates and incorporate them into Solang where applicable.

What is the future roadmap for Solang?

The long-term vision for Solang is to achieve feature parity with Rust development on Solana, allowing developers to write contracts in either Rust or Solidity with equal capabilities. The team is working on improving tooling, adding Solana-specific features, and potentially introducing language extensions to better support Solana's programming model. They are also closely following Solana's developments, such as the upcoming Program Runtime V2, to ensure Solang can take advantage of new optimizations and features as they become available.

How can Solidity developers get started with Solang and Solana development?

Solidity developers can get started with Solang by referring to the Solang documentation and getting started guide available on the Solana developer portal. They should familiarize themselves with Solana's account model and parallel execution paradigm. While the Solidity language remains largely the same, developers will need to adapt to Solana-specific concepts such as explicit account management and the use of SPL tokens instead of ERC-20. The Solang team encourages developers to try out the compiler and provide feedback to help improve the tool and ecosystem.

What are the potential performance benefits of using Solana over EVM-based chains?

Solana's architecture is designed for high throughput and low latency, capable of processing thousands of transactions per second. The parallel execution model allows multiple contracts to run simultaneously on the validator, significantly improving overall performance. Solana's use of BPF instructions and its unique consensus mechanism contribute to faster transaction processing and finality. While Solang allows the use of Solidity, contracts compiled for Solana can potentially benefit from these performance advantages, especially for applications requiring high transaction throughput.

How does Solang handle language features that exist in Solidity but not in Solana's native environment?

Solang attempts to implement as many Solidity features as possible within Solana's constraints. For features that don't have direct equivalents in Solana, Solang may provide alternative implementations or workarounds. In some cases, certain Solidity features may not be available or may behave differently on Solana. The Solang team is continuously working on expanding language support and finding ways to bridge the gap between Solidity's expectations and Solana's capabilities, often requiring creative solutions and careful consideration of the underlying architectural differences.

Related Content

Web3 Domains on Solana with AllDomains - Solfate Podcast #52

Discover how AllDomains is transforming the domain landscape on Solana, offering innovative solutions like tokenized web2 domains and emoji domains.

Breakpoint 2023: How to Store Solana NFTs On-Chain - A Brief Overview

An insightful exploration into the essentials of storing NFTs on Solana's blockchain.

Why put #bitcoin on #solana with tBTC? (feat. Matt Luongo, Threshold Network) - Solfate Podcast #40

Discover how Threshold Network's tBTC is bringing Bitcoin to Solana, enabling cross-chain interoperability and expanding DeFi opportunities.

Why build on Solana? (w/ Vidor from Solflare Wallet)

Discover why Solflare Wallet's founder chose to build on Solana, exploring its unique features, performance, and developer-friendly ecosystem.

Solana governance and Squads multi-sig protocol (feat. Stepan, Squads) - Solfate Podcast #33

Discover how Squads is transforming multi-signature wallets on Solana, enhancing security and governance for crypto teams and individuals alike.

Breakpoint 2023: How Solana Empowers Consumer Data Sovereignty

Hugh Rhodes of Friday discusses how Solana blockchain can reshape consumer data control and privacy.

Breakpoint 2023: Solang: Running Solidity Natively on Solana

An introduction to Solang, a tool that compiles Solidity code to run natively on the Solana blockchain.

Breakpoint 2023: IP Development and Brand Building in Web3

Insights from gaming professionals on the development of intellectual property and brand building in the Web3 space.

Breakpoint 2023: Widening the Design Space of AMMs with Solana

Joe Corey discusses innovative mechanisms for AMMs leveraging Solana’s high-performance blockchain

xNFTs and Solana Phone ft. Armani Ferrante

Discover how xNFTs and the Solana Phone are revolutionizing Web3 mobile experiences with Coral founder Armani Ferrante.

Elusiv: Enabling Private Token Swaps on Solana (w/ Nico, co-founder) - Solfate Podcast #46

Discover how Elusiv is transforming blockchain privacy with zero-knowledge technology, enabling compliant private transactions on Solana.

Breakpoint 2023: Solana Communities Panel Discussion Highlights

A panel from Breakpoint 2023 discussing the growth and development in Solana communities globally.

MEV on Solana with buffalu from Jito Labs

Dive deep into the world of MEV on Solana with Lucas from Jito Labs. Learn about validator clients, searchers, and the future of blockchain technology.

Smart messaging and NFT chat stickers in Dialect (feat. founder Chris Osborn) - Solfate Podcast #18

Discover how Dialect is transforming Web3 communication with smart messages and NFT chat stickers, built on Solana's high-speed blockchain.

Breakpoint 2023: ZK on Solana: Private Solana Programs

An exploration of zero-knowledge proofs for enhanced privacy on the Solana blockchain.