The One Question bounty closes Thursday 10 December.

Join in
We Them Media logo We Them Media Support us

Interacting with Web3: Frontend Development in Cohort X

The picture loads from YouTube. The player loads only when you press Play. Turn on captions in the player if you need them.

A student gives a frontend week update, saying Web3 frontends use React or Vue but connect to a smart contract through its ABI and address. They cover wallet connect buttons, providers and signers, listening to contract events, and batching reads with Multicall.

Not by We Them Media Channel: Web3Bridge. Published Thursday 2 May 2024.

Titles are the owner’s. It plays from their channel.

Transcript

This transcript may contain errors. This video belongs to Web3Bridge. Letters mark each change of speaker.

These are the speakers’ own words. We have not checked their claims.

0:07 A: This week, to give you guys updates on Frontend Week.

0:09 B: Web3 frontend is similar to regular Web2 frontend in that we use the same technologies- React, Vue, and the like.

0:16 C: A dApp is a decentralized application, you know, and this particular decentralized application has- assists You know, structure the frontend and then the smart contract serving as the backend.

0:32 B: What makes Web3 frontend different from Web2 frontend is how it connects to the backend. So in Web3, we make use of a DeBlockchain, right? And instead of performing CRUD operations or making use of like GraphQL to make requests to the backend, we make use of contract ABIs and contract addresses.

0:52 A: Before we can interact with the smart contracts using the frontend, we need a toolkit. Well, there are many kinds of toolkits you can use for that. There's RainbowKit, there's WalletConnect, and so on. A number of things made frontend a little different from traditional frontend here in Web3. One was the fact that because we don't have the typical account creations, right, we use things that are called providers and signers. So basically a signer is something that helps users sign transactions, something like your Connect Wallet, like your MetaMask. And a provider is basically an interface that allows people to communicate with the blockchain. We have libraries like Web3.js, like Ethers.js, and so on.

1:32 D: In our dApp, we made use of events to listen to events emitted when there was- if there's an interaction. If you're interacting with your frontend, you need your API, you need your URL, your RPC URL, and some other things. And to be able to even connect to a specific network, you need it- you need the specific chain ID you want to be con- you want to connect to, or a range of chain IDs you want to switch in between. And this, this is the reason why on every front-end website that has to do with Web3 or Web3 associated, you notice a connect button. Once you click it, it pops up a modal to sign a transaction, to probably change your network or do something. That is where you are connecting your button is initiating a button connect, and from there we will get the API of the smart contract. So for us to be able to interact directly with the functions embedded in the smart contract,

2:32 C: this wallet connection actually helps to identify who is actually connected to this particular dApp. Now, for us to actually read data from the smart contract, we need the JSON-RPC. Which actually does not require signing of transactions.

2:47 E: Redux Multicall, which is used to request for a lot of data from the blockchain at once and delivers it to the frontend.

2:56 F: If you use Multicall, you can just bash all those calls to those addresses into one call, which is called like a Multicall. So you just use the Multicall address, pass in all those addresses that you want to pass into it, Then you call the function at once instead of like calling the balanceOf function in like hundreds of addresses.

3:16 A: Connecting your frontend application to your frontend libraries to the blockchain, right? We use something that is called the APIs, right? Every contract that has been deployed onto the blockchain has something that is called an API. That API helps us create an instance of that particular contract on our frontend and interact with it. By the use of what I just said, providers and signers.

More from this hub

Something wrong, or a video you want off this page? Write to wethem.xyz@gmail.com and it is fixed or taken down within 48 hours.