Source link
Learn how to interact with the ZKsync Layer 2 provider using the web3-plugin-zksync! In this tutorial, we explore how to initialize the ZKsync L2 provider, query token balances, and create, sign, and send transactions. This step-by-step guide will help you get hands-on with ZKsync and Web3.js, enabling you to start building and testing your applications on Layer 2.
Stay tuned for more advanced tutorials on ZKsync, Web3.js, and blockchain development!
Here are the essential links to help you get started:
• Web3.js Plugin for ZKsync: You can find the official plugin repository here: https://github.com/ChainSafe/web3-plugin-zksync?ref=blog.chainsafe.io
• Examples for Using the Plugin: I’ve also prepared a dedicated repository with all the code examples from this tutorial and more, which you can access here: https://github.com/avkos/example-web3-plugin-zksync?ref=blog.chainsafe.io
• ZKsync Web3.js Documentation: For more detailed information and resources, check out the official documentation here: https://sdk.zksync.io/js/web3js?ref=blog.chainsafe.io
date : 2024-10-08 14:57:57
views : 24
likes : 2
rating :
Here is a summary of the transcript in 300 words:
In this video, a Web 3 DeFi tech editor sets up a local ZKSync (ZK) environment and explores working with the ZKSync L2 provider using Web3.js plugin. The editor starts by initializing a new project and installing the Web3.js plugin.
The editor creates a new folder for the project and sets up the ZKSync L2 provider, which is an extended Web3.js instance. They then add their wallet to the provider and use the Web3.js method to add a new wallet to the account.
The editor demonstrates how to get the balance of Ether (ETH) and rc20 token balance using both the eth.getBalance()
and getTokenBalance()
methods. They also show how to use the populateTransaction()
method to create a new transaction and then sign it using the private key
.
The editor then uses the sendTransaction()
method to send the signed transaction to the blockchain and retrieve the transaction hash. They use the waitForTransactionReceipt()
method to wait for the transaction to be mined and retrieve the receipt, which includes information such as the transaction hash, block hash, and gas used.
The editor concludes by summarizing the steps they took to prepare an account, populate and sign a transaction, and send it to the blockchain using the ZKSync L2 provider and Web3.js plugin. This video provides a good overview of the basics of working with the ZKSync L2 provider and Web3.js plugin.