Klaytn Wallet API or SDK

I have planned to implemented Wallet functionality like Kaikas into my app.

For basic function, I will add some feature like Create New Wallet, Import using Keystore or Private Key.

For creating new wallet, I can try to use “createAccount” method
For import using keystore, I can use “decrypt” method
For import using Private Key, I can use “singleKeyring” method

My questions is,…
How Kaikas able to import/recover all accounts from a user using seed phrase ? How it works and how can I implement it ?

1 Like

Hi, =)

First, you can read BIP-39 to understand how that works.
And you should use separate library to create a mnemonic or recover the accounts from that.
Maybe you can take a look Metamask code to figure out how they implement that and how they use libraries for that also.
And what i want to say is caver does not support any functions for that, so you need to use other library.

And i recommend to use the functions supported in same version of the Caver (before common architecture which is ~v1.4.0 and after common architecture which is v1.5.0~).
Your question seems to be a mix of these two versions of functionality.
Account concept including private key in caver-java is a function supported by previous versions of common architecture(~v1.4.0).
In versions of the common architecture and later(v1.5.0~), the term Keyring is used for an object containing the private key(s), and Account is an object containing a public key used when a user updates an account key.

So if you want to import an account use private key string, you can use caver.wallet.keyring.createFromPrivateKey to create a keyring.
(And if you need to add to in-memory wallet, you can use caver.wallet.add)

And yes, if you want to use keystore, then you can use caver.wallet.keyring.decrypt.

You can take a look Klaytn Docs.
Also there is a documentation for before common architecture (~v1.4.0).
I hope my reply is helpful to you.



Hi, Jamie

Firstly, Thank you for the explanation
I found it is quite confusing to get the right information on the internet about Klaytn or Caver SDK.

So, your short explanation has adding more light to my confusion.

Anyway, while waiting for your response I already solved it.
As you said,
For Keystore, I used caver.wallet.keyring.decrypt
For Private Key, I used caver.wallet.keyring.createFromPrivateKey
While for Create New Wallet, I ended up using “generate”.

While for my main question, I will look more as your instruction.

Thank you

1 Like