Private Key & Keystore File
Other than ZilPay, dApp developers can allow their users to interact with their dApp using other wallet choices such as a private key or keystore file. However, we do recommend to use browser add-on such as ZilPay for key management.
Import via Private Key
The following code snippet illustrates on how To import your account from a private key
Import via Keystore File
The following code snippet illustrates how to import your account from an encrypted JSON keystore file and retrieve the private from the encrypted
Interacting with dApp
After importing the account using zilliqa-js/crypto
module, the subsequent steps for doing anything are similar to the previous example.
In the code snippet below, we call the setHello()
transition of the Hello World
Contract using a private key.
info
If you wish to use keystore instead of a private key, you can replace the zilliqa.wallet.addByPrivateKey(privkey)
with the code snippet above.