Skip to main content

Quick Start

Install Kaia Wallet

To develop using Kaia Wallet, you’re first going to want to get Kaia Wallet installed on your development machine.

  • You can download Kaia Wallet for Chrome here

Once you have it running, you should find that new browser tabs have window.klaytn object available in the console. Via klaytn object, you can interact with Kaia Wallet.

Kaia Object in Console

Basic Interactions

Caver Browser Detection

The first thing your app will want to do is to verify whether the user is using Kaia Wallet or not, which can be done by following typeof window.klaytn !== 'undefined'

Running a testnet

In the top left menu, you can select the network that you are currently connected to. By choosing Kairos Testnet you can connect to Kaia's testnet.

You can use testnet for free. You get free test KLAY from Kairos Kaia Wallet, by clicking on the KLAY Faucet menu.

Detecting Kaia Wallet

If you want to differentiate Kaia Wallet from other Kaia-compatible browsers, you can use klaytn.isKaikas.

Connecting to Kaia Wallet

"Connecting" or "logging in" to Kaia Wallet means you can get access to user's Kaia accounts. You should only initiate a connection request in response to direct user action, such as clicking a button. You should never initiate a connection request on page load.

We recommend that you provide a button to allow the user to connect Kaia Wallet to your BApp. Clicking this button should call the following method.

klaytn.enable() //or window.klaytn.enable()

This will trigger the following pop-up. If the user hits the connect button, the method will resolve.

Connection Request

This promise-returning function resolves with an array of hex-prefixed Kaia addresses, which can be used as general account references when sending transactions.

Over time, this method is intended to grow to include various additional parameters to help your site request all the setup it needs from the user during setup.

Since it returns a promise, if you’re in an async function, you may log in like this:

const accounts = await klaytn.enable()
const account = accounts[0] // We currently only ever provide a single account,
// but the array gives us some room to grow.

Getting User State

Users can choose which network to connect. klaytn.networkVersion tells you which network the user is currently connected to, (mainnet: 8217, testnet: 1001) and klaytn.selectedAddress gives you the account address the user is logged in.

Accessing Accounts

Once the user has connected to Kaia Wallet, you can access the user's account via klaytn.selectedAddress. Also, if you’d like to be notified when the address changes, you can subscribe via

klaytn.on('accountsChanged', function(accounts) {
// Your code
})

Now you are ready to make transactions.