이 페이지는 영문에서 기계 번역되었으므로 오역이나 어색한 표현이 있을 수 있습니다. 따라서 정확한 정보는 영어 원문을 참조하시기 바랍니다. 또한 잦은 업데이트로 인해 일부 콘텐츠는 영문이 그대로 남아있을 수 있습니다. Crowdin에서 이 페이지의 번역을 개선하는 데 동참하여 도움을 주세요. (Crowdin translation page, Contributing guide)
Write
컨트랙트의 일부 상태를 업데이트해야 할 때 스마트 컨트랙트와 상호작용하는 **"트랜잭션"**을 만들 수 있습니다.
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
Define smart contract address to interact with
Define gas price and gas limit for contract transactions
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
Get the current number stored in the contract before writing
Increment the number stored in the contract by calling counter.increment().send()
Get the updated number stored in the contract after writing