Write
Bạn có thể thực hiện "giao dịch" tương tác với Hợp đồng thông minh khi bạn cần cập nhật một số trạng thái trong hợp đồng.
Import the web3 and @kaiachain/web3js-ext packages to add kaia features on web3
Define sender's address and private key
Set up the provider with the specified kairos testnet URL. A provider in web3 is a read-only abstraction to access the blockchain data.
Also, you can change the provider URL from kairos to quicknode
Create a sender's account using web3.eth.accounts.privateKeyToAccount
Define contract Abi and address to interact with
Create a contract instance using Web3.eth.Contract
with defined contractAbi and address. You can read and write the contract through this instance
Get the number before update
Create a transaction object that increment the number
Sign the transaction with sender account
Send the transaction to network and wait for the receipt
Get the number after update