Write
You can make a "transaction" interacting with a Smart Contract when you **need to update some state ** in the contract.
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 kaia Baobab testnet URL. A provider in web3 is a read-only abstraction to access the blockchain data.
Also, you can change the provider URL from baobab to allthatnode
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