KardiaChain JS SDK
  • Overview
  • Getting Started
  • Guides
    • Connecting to KardiaChain
      • Front-end
      • Back-end
    • Working with wallet
    • Sending your first transaction
    • Smart Contract: decentralize application
    • KRC20 tokens
    • KAI Chain module
    • Utilities
  • Reference
    • KardiaClient
    • Account
    • Transaction
    • KAI Chain
    • Smart contract
    • KRC20
    • Objects reference
Powered by GitBook
On this page
  • Using Chrome extension
  • Using MetaMask

Was this helpful?

  1. Guides
  2. Connecting to KardiaChain

Front-end

PreviousConnecting to KardiaChainNextBack-end

Last updated 3 years ago

Was this helpful?

Front-end of DApp usually connect to blockchain using web browser's extension. In this case, KardiaChain Wallet Chrome extension

Using Chrome extension

  1. Install the extension at

  2. After enabled, the extension will inject a web3 provider at window.kardiachain. This provider will be used by DApp to interact with blockchain

  3. Connect to the provider:

import Web3 from 'web3';

if (window.kardiachain) {
    window.web3 = new Web3(window.kardiachain);
    if (window.kardiachain.isKaiWallet) {
        window.kardiachain.enable();
    }
    
    // Send a transaction using web3 instance
    window.web3.eth.sendTransaction({
        from: 'YOUR_WALLET_ADDRESS',
        to: 'RECEIVER_ADDRESS',
        value: '1000000000000000'
    })
    .on('transactionHash', function(hash){
        ...
    })
    .on('receipt', function(receipt){
        ...
    })
    .on('confirmation', function(confirmationNumber, receipt){ ... })
    .on('error', console.error);
}

Using MetaMask

Note: this is available only after Galaxias hardfork

Network parameters:

  • Network name: KardiaChain Mainnet

  • Chain ID: 24

  • Symbol: KAI

For detail on using window.web3, please follow web3

If you're not familiar with adding custom network to MetaMask, please read .

RPC URL:

Block explorer URL:

For detail on connecting to MetaMask, please follow .

https://chrome.google.com/webstore/detail/kardiachain-wallet/pdadjkfkgcafgbceimcpbkalnfnepbnk
document
this article
https://rpc.kardiachain.io/
https://explorer.kardiachain.io/
this document