Web3.js serves as a comprehensive toolkit empowering developers to establish connections with blockchains via various communication methods, such as HTTP, IPC, or WebSocket.
Normally, each blockchain possesses its own customized version or library, similar to Web3.js, which caters to its distinctive functionalities and protocols.
For example, Ethereum has Web3.js for interacting with its blockchain, while Solana has Solana-Web3.js designed specifically for Solana.
These libraries provide developers with the tools and functions needed to interact with the respective blockchain, such as sending transactions, querying data, and managing smart contracts. The specific library used depends on the blockchain platform a developer is working with.
When compared to traditional APIs, Steven said that the new Solana Web3.js API is a better choice. It equips developers with more effective tools for creating applications in the industry.
In simpler terms, it’s like giving developers a better set of tools to build cool things on the Solana blockchain.
The decision to update the software was driven by user feedback. Developers expressed their desire for improved customization, less opinionated features, and the ability to meet diverse application requirements. Mango Protocol provided several examples to support these needs.
The engineer said that one significant improvement is making the new Web3.js API tree-shakable. “You told me, Steve, I’m happy that you offer all of these 110 billion methods for me to call but I only use three or five,” he said to the audience. “But when I include web3.js in my project, I get all of them whether I like it or not.”
So in response to this complaint, Steven explained that the compilers have been optimized to allow developers to choose the method they want to use without the need for extra tools that have been integrated into the Web3 Js tool.
It is a secure public-key signature system that is used in various protocols and software and has been implemented on AWS although it’s flagged off on a platform such as Chrome.
He went on to say that the reduction in bundle size for the new Web3.js is substantial, significantly outperforming its predecessor.
In a real-world example, the Solana Explorer experienced a 26% size reduction on the homepage after migrating to the new Web3.js, demonstrating the practical impact of these improvements.
Other changes integrated
The engineer added that the new RPC (Remote Procedure Call) API has been revamped to be more concise, with a focus on simplicity and cancelability while the new RPC transport is customizable, allowing developers to implement strategies like fallback mechanisms for handling different RPC endpoints.
Key management in the new Web3.js leverages native JS crypto keys, offering improved performance and leak resistance. The presentation highlighted the advantages of this approach, emphasizing the protection of private key content even in the event of unintentional logging.
Transaction builders have been unified, simplifying the process of constructing transactions with functional transforms. TypeScript integration plays a crucial role in providing developers with early detection of common errors, ensuring a smoother development process.
Looking ahead, he said that the Web3.js team is actively working on code generation tools for programs, promising an API that aligns more closely with developers’ objectives and desires.
This initiative aims to deliver tailored solutions for various programs, extending the benefits of Web3.js to a broader spectrum of applications.
Developers were encouraged to explore the technology preview, provide feedback, and participate in the migration process. Steven shared his willingness to offer one-on-one assistance to those undertaking the migration, emphasizing a collaborative approach to refining the Web3.js library.