This page uses machine translation from English, which may contain errors or unclear language. For the most accurate information, please see the original English version. Some content may be in the original English due to frequent updates. Help us improve this page's translation by joining our effort on Crowdin. (Crowdin translation page, Contributing guide)
Public Account Key
AccountKeyPublic is used for accounts having one public key. If an account has an AccountKeyPublic object, the transaction validation process is done like below:
Import necessary classes from the Web3j and kaia libraries(web3j-ext
).
Create a Web3j instance with the specified BAOBAB_URL
Also, you can change the default provider. For example, using the alchemy provider.
Load a credential from the public key's key pair and get its address
Define any message to sign
Set the block number to be the latest block in the kaia network
Sign the message with using KlaySignatureData.signPrefixedMessage
Recover the address and compare it to the original address
Shut down the Web3j instance