Read
You can call functions in Smart Contract via "Call" RPC API. What you can call here is limited to view functions that is not changing any states in the Contract.
Import necessary classes from the Web3j and kaia libraries(web3j-ext
).
Connect to the Kaia blockchain using Web3j and specify the URL
Create KlayCredentials using the private key
Specify the address of the contract
Define gas price and gas limit for the transaction
Create a gas provider with static gas price and gas limit
Load the contract using contact address, Web3j instance, credentials, and gas provider. You can read and write the contract through this instance
Call the counter.number().send()
function of the contract to retrieve the stored value