Skip to Content

Connect an app

How any app finds Kannuki's extension, connects, signs in with both keys, pays, asks for QoreChain transactions (send, swap, stake, contract calls) and calls contracts from ordinary EVM code.

With the extension installed, an app can use Kannuki the way apps use any wallet: find it, connect, ask it to sign. The person answers each request in the extension's own window, which names the site. Try every call on the live example.

  1. 1Your device

    The app asks

    Through window.kannuki, or the Ethereum provider Kannuki announces.

  2. 2Your device

    The extension checks

    It knows which site is asking from Chrome, not from the page.

  3. 3Your device

    You decide

    Its own window shows the site and exactly what is asked. Closing it declines.

  4. 4QoreChain

    QoreChain

    Every transaction is signed with both keys and checked like any other.

The app never holds a key. It gets an address after Connect, and one answer per request after that.
The live example: Kannuki connected, the kinds of request an app can make, the code for each
The live example at kannuki.xyz/connect: the wallet it found, what it can ask for, the code for each, and the result.

Three ways in

Your app already speaksUseWhat you get
Nothing yetwindow.kannuki.request({ method, params })Everything on this page
QoreChain's own wallet (signAndBroadcast)window.kannuki.nativeenable, getKey and signAndBroadcast with the same request shape; the result has txHash and code
Ethereum wallets (viem, wagmi, ethers)The EIP-1193 provider, found through EIP-6963Connect, switch network, sign in, send contract calls

Find it

// The way any EVM app fills its wallet list (EIP-6963). Kannuki announces itself as rdns "xyz.kannuki".
window.addEventListener('eip6963:announceProvider', (e) => {
  if (e.detail.info.rdns === 'xyz.kannuki') provider = e.detail.provider
})
window.dispatchEvent(new Event('eip6963:requestProvider'))

// Or directly. It can appear a moment after the page starts:
const kannuki = window.kannuki // { isKannuki: true, version: '2', request(), native, ethereum }
window.addEventListener('kannuki#initialized', () => { /* it is there now */ })

Kannuki never takes over window.ethereum, so it doesn't fight other wallets for it.

Requests

MethodAsks the person?Returns
kannuki_connectYes, once per site{ name, qor1, evm, pqcPublicKey, network }
kannuki_accountsNoThe same object if this site is connected, otherwise null
kannuki_signMessage { message }Yes, every time{ signed, signature, pqcSignature, publicKey, pqcPublicKey }
kannuki_send { to, amount, memo? }Yes, every time{ status: 'included' | 'unknown', hash } or { status: 'refused', reason }
kannuki_signAndBroadcast { messages, memo?, gasLimit? }Yes, every time{ status: 'included', hash, height, gasUsed }, { status: 'unknown', hash }, { status: 'failed', hash, reason } or { status: 'refused', reason }
kannuki_switchNetwork { network }Yes, unless already there{ network: 'testnet' | 'mainnet' }
kannuki_disconnectNotrue

A declined request rejects with { code: 4001 }; a request from a site that isn't connected with { code: 4100 }; an unsupported method with { code: 4200 }; a chain that isn't QoreChain with { code: 4902 }; no wallet yet with { code: 4900 }.

The extension's approval windows: connect, sign in, a transaction request, a contract call
What the person sees: the site's address, exactly what is asked, and two buttons. An account that isn't protected yet can't be asked to sign a transaction.

Sign in with both keys

kannuki_signMessage signs this exact text, returned as signed:

Kannuki signed message
Site: https://example.org

Sign in to example.org

The heading and the site's own address are part of what's signed, so a signature made for one site fails on another, and it can never be a transaction. Two signatures come back over the same bytes:

  • signature: key one, secp256k1 over sha256(signed), compact hex.
  • pqcSignature: key two, ML-DSA-87 over signed, hex.

Check both, then check that pqcPublicKey is the key QoreChain has registered for the account (GET /qorechain/pqc/v1/account/{qor1}). A phished seed phrase can produce the first signature, never the second.

import { secp256k1 } from '@noble/curves/secp256k1'
import { sha256 } from '@noble/hashes/sha2'
import { hexToBytes, utf8ToBytes } from '@noble/hashes/utils'
import { pqcVerify } from '@qorechain/sdk'

const bytes = utf8ToBytes(signed.signed)
const one = secp256k1.verify(hexToBytes(signed.signature), sha256(bytes), hexToBytes(signed.publicKey.slice(2)))
const two = pqcVerify(hexToBytes(signed.pqcPublicKey), bytes, hexToBytes(signed.pqcSignature))

Kannuki's own check is sign.ts.

QoreChain transactions

kannuki_signAndBroadcast takes a list of messages, each protobuf-encoded by whatever you already use (@qorechain/sdk, cosmjs, your own encoder). value may be a Uint8Array, an array of numbers, base64 or 0x-hex.

import { msg, qorechainRegistry } from '@qorechain/sdk'

const stake = msg.staking.delegate({ delegatorAddress, validatorAddress, amount: { denom: 'uqor', amount: '1000000' } })
const any = qorechainRegistry().encodeAsAny(stake)

const result = await window.kannuki.request({
  method: 'kannuki_signAndBroadcast',
  params: { messages: [{ typeUrl: any.typeUrl, value: any.value }], memo: 'Staked from example.org' },
})
The transaction request window listing each step in plain words
The wallet decodes the bytes itself and says what each step does, with the full addresses; it never takes the app’s word for it.
The contract call window
A contract call from EVM code: what it does, the fee, and that no EVM window opens.

A site can ask for the messages whose whole effect the window can say in plain words, by exact type:

WhatMessage
Send QOR or a token/cosmos.bank.v1beta1.MsgSend
Send to another chain/ibc.applications.transfer.v1.MsgTransfer (with an empty IBC memo)
Swap/qorechain.amm.v1.MsgSwapExactIn, MsgSwapExactOut
Stake, unstake, move, claim/cosmos.staking.v1beta1.MsgDelegate, MsgUndelegate, MsgBeginRedelegate, /cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward
Lock a stake, claim its bonus/qorechain.stakingtier.v1.MsgLockDelegation, MsgClaimBonus
Move a token to the main side/cosmos.evm.erc20.v1.MsgConvertERC20 (to the account itself)
Call an EVM contract/qorechain.crossvm.v1.MsgCrossVMCall (EVM target, nothing attached, not queued)

What the extension does with them:

  • Decodes every message itself with QoreChain's registry and shows each step in plain words with its full addresses, and QoreChain's own read-back of the same bytes under Details.
  • Sets the fee from Kannuki's fixed table, with the EVM's own estimate for contract calls (the whole gas limit is charged on QoreChain); gasLimit can raise it, never lower it. A contract call that would fail isn't sent.
  • Signs with both keys and broadcasts. Several messages go in one transaction: all of them land or none does.
  • Refuses everything else before the person is asked. That covers anything about who controls the account: registering, rotating or migrating keys, EVM delegation, opening or closing an EVM window, the daily-allowance keys, permission for someone else to act (authz, fee grants), where staking rewards go; and anything that wraps other messages (proposals, MsgExec). It also refuses a message written for another account, a contract call with money attached, an IBC transfer carrying forwarding instructions, and a token conversion to someone else. The rules are in requests.ts.

Code written for QoreChain's own wallet can pass Kannuki instead:

await window.kannuki.native.enable('qorechain-diana')
const { bech32Address } = await window.kannuki.native.getKey('qorechain-diana')
const { txHash, code } = await window.kannuki.native.signAndBroadcast({ chainId: 'qorechain-diana', messages })

For EVM apps

Kannuki is an Ethereum provider for QoreChain (testnet 0x2648, mainnet 0x2649). An app built with viem, wagmi or ethers lists it as an installed wallet, connects, and sends contract calls with the code it already has.

import { createPublicClient, createWalletClient, custom, erc20Abi } from 'viem'

const wallet = createWalletClient({ chain: qoreTestnet, transport: custom(provider) })
const reader = createPublicClient({ chain: qoreTestnet, transport: custom(provider) })
const [address] = await wallet.requestAddresses()

const hash = await wallet.writeContract({
  account: address, address: fUSD, abi: erc20Abi, functionName: 'approve', args: [spender, 1_000000n],
})
await reader.waitForTransactionReceipt({ hash })
MethodWhat Kannuki does
eth_requestAccounts, eth_accountsConnect (asks once), then the account's 0x address
eth_chainId, net_versionThe network the wallet is on
wallet_switchEthereumChain, wallet_addEthereumChainSwitches between QoreChain's two networks (asks); any other chain gets 4902
personal_signSigns with key one, as EVM apps expect. The window says it is one key. It can't move anything on QoreChain's native side; a contract that accepts a key-one signature on its own is outside what the second key protects (what it doesn't cover). A sign-in message written for another site is refused
eth_sendTransaction with data, no valueA contract call (see below)
eth_sendTransaction with value, no dataA QOR payment to that address, signed with both keys. Refused when the address is a contract (its code would never run), and when the request names another network or account
eth_call, eth_getBalance, eth_getLogs, eth_estimateGas, …Passed to QoreChain's public EVM endpoint
eth_getTransactionReceipt, eth_getTransactionByHashAnswered by Kannuki for the calls it sent

Events: accountsChanged, chainChanged, connect.

How a contract call is sent

On QoreChain an EVM transaction is signed by key one alone, and an account with a registered second key can only send one while its EVM window is open. An open window is exactly what someone holding the 12 words could use, so Kannuki never opens one for an app.

Instead it sends the same call on QoreChain's native lane (MsgCrossVMCall): a native transaction, signed by both keys, that calls the contract as the account's own 0x address. The contract sees the same msg.sender; the chain checks both signatures; no window exists at any point.

What follows from that:

  • The hash an app gets back is 0x + the native transaction's hash. QoreChain's EVM endpoint has no receipt under it, so Kannuki answers eth_getTransactionReceipt itself (status, block, gas; logs is empty). Use a client whose transport is the provider, as above, and waiting for the receipt works.
  • A call that carries QOR (value and data together) and publishing a contract both need a window, so Kannuki refuses them with 4200 and says why.
  • An approval is answered only to the page load that asked: if the tab has moved on, the answer is dropped.
  • Before asking the person, Kannuki runs the EVM's own gas estimate. If the call would fail it says so and won't send it, because the fee would be charged anyway.
  • Contract calls are on testnet. QoreChain has MsgCrossVMCall switched off on mainnet today.

Payments

kannuki_send asks for a QOR transfer on the network the wallet is on. The extension shows the amount, the recipient, the fee and the network, and signs it with both keys like any other Kannuki transaction. An account whose second key isn't registered yet can't be asked to pay: the window says so.

Connected sites

A site stays connected until it calls kannuki_disconnect or the person removes it in the extension under Connected sites. Either way the site's open pages get accountsChanged with an empty list.

A site is connected to one account: the one that was open when the person pressed Connect. If they open another account in the wallet, the site gets accountsChanged with an empty list, eth_accounts and kannuki_accounts answer as if nobody is connected, and signing requests are refused with 4100. Ask to connect again and the approval window offers the account that is open now; going back to the first account brings it back on its own. A site never learns of an account the person didn't show it, and the address it shows is always the one that signs.

The approval window checks this again at the moment of signing, against what is stored then: a window left open while the site is disconnected, or connected to another account, turns into "This site isn't connected" and answers 4100. Removing the wallet from the browser removes every connection with it.

Where the code is

PieceFile
What the page gets (window.kannuki, the provider, the EIP-6963 announcement)provider.content.ts
Routing: who is asking, what needs approval, read calls, receiptsbackground.ts
The approval windowapprove.tsx
Reading a request: decoding, the never-list, fees, contract callsrequests.ts
Shapes and error codesprotocol.ts
The live exampleconnect-demo.tsx

On this page