Sign up for Sanctum wonderland and earn points for holding compassSOL! Sign up

Liquid Stake with compassSOL for an 9.77% 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

Breakpoint 2023: Introducing the New Web3.js

Steven Luscher presents the new Web3.js with enhanced features and performance improvements.

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

Summary

During the 2023 Breakpoint conference, Steven Luscher from Solana Labs introduced the revamped Web3.js, a crucial JavaScript library for blockchain development on the Solana network. He emphasized the evolution of Web3.js to become more efficient, customizable, and user-friendly, drawing an analogy to how consuming vegetables provides long-term health benefits compared to the fleeting satisfaction of sugary treats. The new Web3.js promises not just a tech-rich experience but also intends to lead developers towards a "pit of success" by its very design. The talk covered the ins and outs of the updated library, highlighting the ways it can significantly benefit developers and ultimately, the end-users of blockchain applications.

Key Points:

The New Web3.js: A Healthier Option for Developers

Comparing the new API to vegetables, Steven highlighted the importance of creating an API that is robust and sustainable in the long run. The aim for the new Web3.js is to deliver a library that promotes best practices, leading to more stable and successful applications without the common pitfalls of overly sugary APIs that can lead to technical debt and performance issues.

The Demand for a Better Web3.js

Feedback from the Solana community indicated a clear desire for a more customizable and less opinionated version of Web3.js. This includes the need for improved transaction confirmation strategies, support for multiple RPC connections, and the ability to batch requests. Developers have been asking for tree shaking capabilities, modern JavaScript support, and generally a more modular and slimmed-down library.

Performance Improvements and Reductions in Library Size

There have been significant improvements in the performance and size of the new Web3.js. The library has been reduced in size by as much as 14 times in typical applications, making it efficient for web environments and mobile users who may experience poor connectivity. Performance metrics also showed notable speed improvements in transaction signing and block hash operations.

Technical Deep Dive: Subscription APIs, Keys, Transaction Builders, and TypeScript

Steven went into detail about several technical aspects of the new library, including a simpler and more efficient transport interface, a dynamic and slim RPC API, modern subscription APIs for better error handling and gap recovery, improvements to cryptographic key management, unified transaction building, and enhanced TypeScript support.

Facts + Figures

  • The new Web3.js was described by Steven Luscher as being more like vegetables rather than candy; it aims for long-term developer success rather than short-term ease of use.
  • Web3.js is a JavaScript library pivotal for developers interacting with the Solana blockchain, including actions like minting NFTs and playing blockchain-based games.
  • Despite being downloaded 400,000 times a week, feedback indicated developers wanted more from the library.
  • Size reductions in the new Web3.js have been substantial, with a full browser bundle dropping from 90 kilobytes in the old version to 33 kilobytes in the new, a 2.7 times improvement—and potentially down to 17 kilobytes for environments supporting ED25519 natively.
  • An AWS service bundle for transaction handling was reduced in size from 5.4 megabytes in the old version to 1.7 megabytes with the new Web3.js.
  • Solana's official explorer saw a 26% reduction in first-page load size after replacing the old Web3.js with the new.
  • The RPC API of a new Web3.js is now TypeScript-based and can easily extend to support additional RPC methods.
  • The new subscriptions API leverages modern JavaScript features like async iterators, promising a more reliable and maintainable way to handle real-time data.
  • Keys now use native JavaScript crypto keys with polyfills for environments lacking native ED25519 support.
  • Transaction builders unify legacy and version transactions into a single, more efficient class.
  • TypeScript integration ensures developers catch errors early in the development process, reducing runtime errors.

Top quotes

  1. "I like to think of the new Web3JS API as more like vegetables. You eat them, you chew on them, they sharpen your teeth."
  2. "Folks from Mango told us, Steve, your transaction confirmation strategy just doesn't work for us. We need something different."
  3. "For the past six months or so, me and this crack team of developers... have been working on a new version of Web3JS."
  4. "Old Web 3JS was able to crank out 700 of those operations per second, 10 times more if you use the native ED25159 stuff in new browsers and new JavaScript environments."
  5. "Just migrating to the new Web3JS let you throw out a quarter of the code."
  6. "The subscriptions API is now based on modern JavaScript async iterators."
  7. "Keys now are based on native JS crypto keys."
  8. "We want to offer you APIs that are closer to your customers' desires."
  9. "Tell us if you find something broken. Tell us if we missed including something."
  10. "Solana FM, get at me. And let's get this done."

Questions Answered

What is Web3.js?

Web3.js is a JavaScript library used for interacting with the Solana blockchain. It allows developers to read and write data, and execute programs, essentially facilitating a direct line of communication with blockchain-based applications like games, services, or NFT platforms.

Why was a new version of Web3.js necessary?

The new version of Web3.js was created in response to community feedback that highlighted the need for a more customizable, efficient, and less opinionated API. Developers wanted better performance, a reduced library size, and features ripe for modern JavaScript practices.

How does the new Web3.js improve performance and size?

The new Web3.js improves performance by facilitating faster transactions, reduced latency, and a higher rate of operations per second. It reduces size by implementing tree shaking, which means projects only include the code they actually use, significantly slimming down the library footprint.

What are some of the technical improvements in the new Web3.js?

Technical improvements include a new RPC transport interface that's easier to work with, an RPC API that uses TypeScript for error reduction, a more robust and efficient subscription API that utilizes modern JavaScript async iterators, and native JavaScript crypto keys for better security and performance.

How does the new Web3.js leverage TypeScript to benefit developers?

The new Web3.js leverages TypeScript to help developers catch errors during the coding phase rather than in production, reducing runtime errors and ensuring a smoother development process and more reliable end-user experience.