Coin98
English
English
  • Coin98
  • Products
    • Coin98 AI Wallet
    • Coin98 Telegram Wallet
      • How to create a Coin98 Telegram Wallet
      • General Settings
      • How to invite friends on Coin98 Telegram Wallet
      • How to create/import a hot wallet on Coin98 Telegram Wallet
      • How to activate a wallet on Coin98 Telegram Wallet
      • How to manage blockchains on Coin98 Telegram Wallet
      • How to use Watch-only Wallet
      • How to retrieve Seed Phrase/Private key on Coin98 Telegram Wallet
      • How to buy cryptocurrency by fiat on Coin98 Telegram Wallet
      • How to Send a Token
      • How to Receive tokens
      • How to swap natively on Coin98 Telegram Wallet
      • How to contact Live Chat on the Coin98 Telegram Wallet
    • Coin98 Super Wallet
      • Mobile
        • Coin98 Super Wallet V15 UI Overview
        • Getting Started
          • How to download and install Coin98 Super Wallet
          • General Settings
          • How to automatically update Coin98 Super Wallet
          • How to manage notifications on Coin98 Super Wallet
          • How to create or import a Multichain Wallet to Coin98 Super Wallet
          • How to buy cryptocurrency by fiat on Coin98 Super Wallet?
          • How to add a contact on Coin98 Super Wallet
          • FAQs
            • What is the difference between Private Key and Seed phrase?
            • Do I have to backup every time my Wallet updates?
            • Does Coin98 Super Wallet hold my funds?
            • I can't find an answer to my question. Where do I find an answer?
        • Wallet Management
          • How to activate a wallet on Coin98 Super Wallet
          • How to show Seed Phrase / Private key
          • How to import Multi-chain wallets to Coin98 Super Wallet
          • How to switch a single-chain wallet to another chain wallet on Coin98 Super Wallet
          • How to use Seed Phrase Recover Tool
          • How to Refresh a Multichain Wallet
          • How to connect Hardware Wallet on Coin98 Super Wallet
          • How to use Watch-only Wallet
          • How to rename/remove Wallet
          • FAQ: Why did I recover a wallet but my balance shows 0 and the addresses are changed?
        • Social Wallet
          • How to upgrade a social wallet to Ramper Core V2 on Coin98 Super Wallet
          • How to create a Social Wallet
          • How to restore a Social Wallet
          • How to manage a Social Wallet
        • Zen Card Wallet
          • How to Create a Zen Card Wallet
          • How to Restore a Zen Card Wallet
          • Migrate Hot Wallets to Zen Card
          • How to Manage Zen Card
          • How to Setup and Manage a Profile for eCard
          • How to Redeem Zen Gift
          • How to Use Zen Card
          • FAQs
        • Asset Management
          • How to connect your account from an exchange platform to Coin98 Super Wallet
          • How to manage blockchains on Coin98 Super Wallet
          • How to add Custom Network on Coin98 Super Wallet
          • How to withdraw tokens from Binance to Coin98 Super Wallet
          • How to create a send request for someone
          • How to Send a Token
          • How to send a token to multiple addresses
          • How to add a Custom Token on Coin98 Super Wallet
          • How to Receive (Deposit) a Token
          • How to hide/unhide tokens on Coin98 Super Wallet
          • How to create a token using Token Issuer
          • How to create a portfolio on Coin98 Super Wallet
          • How to track portfolio on Coin98 Super Wallet
          • FAQs
            • Balances Not Loading or Showing on my wallet
            • Why can't I send USDT to other wallets?
        • NFTs
          • How to create a NFT using NFT Issuer
          • How to Receive (Deposit) an NFT
          • How to Send NFT
          • How to send multiple NFTs to an address
          • How to list an NFT on Marketplace
          • NFTverse
          • How to buy NFT in Coin98 Super Wallet
        • SwapX
          • How to swap tokens natively on SwapX
          • How to convert tokens on SwapX?
          • FAQs
            • Why did my transaction fail?
            • What is gas setting
            • Why did I have to pay gas fees for a failed transaction?
            • What is slippage tolerance
            • What is inverse rate
            • What is Unlimited approval?
            • What is Transaction Deadline
            • FAQs
        • Futures
          • How to use Futures on Coin98 Super Wallet
        • OneID
          • OneID Profile: Log in with OneID, Manage Profile and Get OneID Referral Link
          • How to link a wallet to a OneID on Coin98 Super Wallet
          • How to use OneID on Coin98 Super Wallet
          • How to perform KYC Verification on Coin98 Super Wallet
        • Stake Master
          • How to unstake Coin98 Staking V1
          • How to use Coin98 PowerPool on Coin98 Super Wallet
          • How to use Dynamic Rate Staking on Coin98 Super Wallet
        • Coin98 Messenger
          • How to change Messenger settings
          • How to start new conversation in Coin98 Messenger
          • How to create a request for someone to send their tokens
          • Cypheus Assistant Bot
          • How to set up a Lucky Gift
          • How to receive a Lucky Gift
          • How to set up a Quiz Gift
          • How to receive a Quiz Gift
          • How to contact Coin98 Live Support via Coin98 Messenger
        • Third party platforms and dApps
          • How to use multichain dApp browser on Coin98 Super Wallet
          • How to use Faucet on Coin98 Super Wallet
          • How to manage connections of the wallet
          • How to use Super Connect
        • Coin98 Vault
          • How to use Coin98 Vault on Coin98 Super Wallet
          • How to claim NFT on NFT Privileges
        • Security & Privacy
          • What to do when your wallet has been hacked?
          • How to use Cloud Backup on the Coin98 Super Wallet
          • How to revoke token allowances using Wallet Approval
          • How to use Clear Clipboard on Coin98 Super Wallet?
      • Extension
        • Getting Started
          • How to install Coin98 Extension
          • General Settings
          • How to update Coin98 Extension
          • How to create or import a Multichain Wallet to Coin98 Extension
          • How to buy cryptocurrency by fiat on Coin98 Extension?
          • Get Started with Coin98 Extension: Set a password and Create your new wallet
          • How to change your Coin98 Extension Password
        • Wallet Management
          • How to activate a wallet on Coin98 Extension
          • How to show Seed Phrase / Private key
          • How to switch a single-chain wallet to another chain wallet on Coin98 Extension
          • How to Refresh a Multichain Wallet
          • How to connect Hardware Wallet on Coin98 Extension
          • How to use Watch-only Wallet
          • How to rename/remove Wallet
        • Social Wallet
          • How to create a Social Wallet
          • How to restore a Social Wallet
        • Asset Management
          • How to manage blockchains on Coin98 Extension
          • How to add Custom Network on Coin98 Extension
          • How to Send a Token
          • How to send a token to multiple addresses
          • How to add a Custom Token on Coin98 Extension
          • How to Receive (Deposit) a Token
        • Swap
          • How to swap natively on Coin98 Extension
        • Bridge
          • How to convert tokens on Bridge?
        • Security & Privacy
          • How to use Cloud Backup on the Coin98 Extension
    • Zen Card
      • How to use Zen Card with Coin98 Super Wallet
      • Legal
        • PRIVACY POLICY
        • TERMS OF USE
      • FAQs
    • Coin98 Vault
      • How to claim Vault on Coin98 Super Wallet
      • How to claim Vault with Coin98 Extension
      • How to create Vault to distribute tokens
    • Coin98 Staking
      • How to stake C98 on Coin98 Super Wallet
      • How to stake C98 on Coin98 Staking website
      • Fixed Rate Staking
    • Coin98 Token
      • Why is the C98 token issued on Ethereum, BNB Chain, Solana, Polygon and Viction?
      • How can I get Coin98 (C98) Token?
      • Where to trade C98
      • Where can I store my C98
      • Can I get back the money when I sent C98 to the contract address?
      • How to convert C98 token on Coin98 Super Wallet
    • Coin98 Terminals
      • Token Issuer
        • How to use Token Issuer on Coin98 Super Wallet
        • How to use Token Issuer on Coin98 Extension
      • Multisender
        • How to use Multisend
    • Coin98 Markets
      • How to use Coin98 Markets
    • Single Chain Wallet
      • Ancient8 Wallet
        • How to migrate social wallet to V2
        • Terms of Service
        • Privacy Policy
        • Developer Guide
  • Audits
    • Coin98 Token
    • Coin98 Staking
    • Coin98 Vault
    • 🐞BUG BOUNTY
  • Developer Guide
    • Coin98 Adapter
      • Setup Coin98 Adapter for Next.js
      • Setup Coin98 Adapter for React
      • Hooks
        • useWallet
        • useWalletModal
      • Example
    • Coin98 Connect Integration
    • Bitcoin Dapps Integration
    • Ethereum DApps Integration
    • EthereumPoW DApps Integration
    • BNB Chain DApps Integration
    • Kucoin Chain DApps Integration
    • Solana DApps Integration
    • Near DApps Integration
    • Cosmos DApps Integration
      • Keplr Override
        • Basic API
        • Use with CosmJs
        • Use with SecretJS
        • Suggest Chain
    • Secret Network DApps Integration
      • Keplr Override
        • Basic API
        • Use with CosmJs
        • Use with SecretJS
        • Suggest Chain
    • KAVA DApps Integration
      • Keplr Override
        • Basic API
        • Use with CosmJs
        • Use with SecretJS
        • Suggest Chain
    • Persistence DApps Integration
      • Keplr Override
        • Basic API
        • Use with CosmJs
        • Use with SecretJS
        • Suggest Chain
    • Terra DApps Integration
      • Terra Station Override
    • Ronin DApps Integration
    • Arbitrum DApps Integration
    • Optimism DApps Integration
    • Boba Network DApps Integration
    • Harmony DApps Integration
    • Klaytn DApps Integration
    • Fantom DApps Integration
    • Celo DApps Integration
    • Gnosis Chain DApps Integration
    • GateChain DApps Integration
    • Polygon DApps Integration
    • Viction DApps Integration
    • Avalanche DApps Integration
    • OKExChain DApps Integration
    • Heco DApps Integration
    • Aurora DApps Integration
    • Cronos DApps Integration
    • Bittorrent DApps Integration
    • PlatON Network DApps Integration
    • Moonbeam DApps Integration
    • Kardia DApps Integration
    • Aptos Dapps Integration
    • Sui DApps Integration
    • Sei DApps Integration
      • Keplr Override
        • Basic API
        • Use with CosmJs
        • Use with SecretJS
        • Suggest Chain
    • Osmosis DApps Integration
      • Keplr Override
        • Basic API
        • Use with CosmJs
        • Use with SecretJS
        • Suggest Chain
    • Injective DApps Integration
      • Keplr Override
        • Basic API
        • Use with CosmJs
        • Use with SecretJS
        • Suggest Chain
    • Oasis network DApps Integration
    • Evmos DApps Integration
      • Keplr Override
        • Basic API
        • Use with CosmJs
        • Use with SecretJS
        • Suggest Chain
    • Juno network DApps Integration
      • Keplr Override
        • Basic API
        • Use with CosmJs
        • Use with SecretJS
        • Suggest Chain
    • Agoric DApps Integration
      • Keplr Override
        • Basic API
        • Use with CosmJs
        • Use with SecretJS
        • Suggest Chain
    • Archway (Testnet) DApps Integration
      • Keplr Override
        • Basic API
        • Use with CosmJs
        • Use with SecretJS
        • Suggest Chain
    • Stargaze DApps Integration
      • Keplr Override
        • Basic API
        • Use with CosmJs
        • Use with SecretJS
        • Suggest Chain
    • Umee DApps Integration
      • Keplr Override
        • Basic API
        • Use with CosmJs
        • Use with SecretJS
        • Suggest Chain
    • Stride DApps Integration
      • Keplr Override
        • Basic API
        • Use with CosmJs
        • Use with SecretJS
        • Suggest Chain
    • Deeplink
    • Kujira DApps Integration
      • Keplr Override
        • Basic API
        • Use with CosmJs
        • Use with SecretJS
        • Suggest Chain
    • Mantle DApps Integration
    • DApps Integration
      • EVM-compatible DApps Integration
    • Ethereum Coin98 Telegram Wallet SDK Bot Integration
      • Ethereum Coin98 Telegram Wallet SDK Bot Integration For React
      • Ethereum Coin98 Telegram Wallet SDK Bot Integration For Vanilla Javascript
  • Ton SDK Integration Guide For Partners
  • Legal
    • Coin98 Super Wallet
      • Terms of Service
      • Privacy Policy
    • Coin98 Telegram Game
      • Terms of Use
      • Privacy Policy
  • Coin98 Links and Communities
    • Official Coin98 Links
    • Official Communities
  • BRAND ASSETS & GUIDLINES
    • Brand Assets & Guidelines
Powered by GitBook
On this page
  • To detect Coin98 Extension with Bitcoin
  • Connecting to Coin98 Wallet
  • Methods
  • requestAccounts
  • getAccounts
  • getNetwork
  • switchNetwork
  • getPublicKey
  • getBalance
  • sendBitcoin
  • signMessage
  • pushTx
  • signPsbt
  • signPsbts
  • pushPsbt
  • Events
  • accountsChanged
  • networkChanged
  1. Developer Guide

Bitcoin Dapps Integration

Welcome to Coin98 Extension Wallet Developer Guide. This documentation contains guides for developers to get started developing on Coin98 Extension Wallet.‌

To detect Coin98 Extension with Bitcoin

To detect whether your browser is running Coin98 Extension, please use:

if (typeof window.coin98?.bitcoin !== 'undefined') {
  console.log('Coin98 Wallet is installed!');
}

Connecting to Coin98 Wallet

"Connecting" or "logging in" to Coin98 Wallet effectively means "to access the user's Bitcoin account(s)".

You should only initiate a connection request in response to direct user action, such as clicking a button. You should always disable the "connect" button while the connection request is pending. You should never initiate a connection request on page load.

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

coin98.bitcoin.requestAccounts()

Methods

requestAccounts

coin98.bitcoin.requestAccounts()

Connect the current account.

Parameters

none

Returns

Promise returns string[] : Address of current account.

Example

try {
  let accounts = await window.coin98?.bitcoin.requestAccounts();
  console.log('connect success', accounts);
} catch (e) {
  console.log('connect failed');
}
> connect success ['tb1qrn7tvhdf6wnh790384ahj56u0xaa0kqgautnnz']

getAccounts

coin98.bitcoin.getAccounts()

Get address of current account

Parameters

none

Returns

  • Promise - string: address of current account

Example

try {
  let res = await window.coin98?.bitcoin.getAccounts();
  console.log(res)
} catch (e) {
  console.log(e);
}
> ["tb1qrn7tvhdf6wnh790384ahj56u0xaa0kqgautnnz"]

getNetwork

coin98.bitcoin.getNetwork()

get network

Parameters

none

Returns

  • Promise - string: the network. livenet and testnet

Example

try {
  let res = await window.coin98?.bitcoin.getNetwork();
  console.log(res)
} catch (e) {
  console.log(e);
}

> 0

switchNetwork

coin98.bitcoin.switchNetwork(network)

switch network

Parameters

  • network - string: the network. livenet and testnet

Returns

none

Example

try {
  let res = await window.coin98?.bitcoin.switchNetwork("livenet");
  console.log(res)
} catch (e) {
  console.log(e);
}

> 0

getPublicKey

coin98.bitcoin.getPublicKey()

Get publicKey of current account.

Parameters

none

Returns

  • Promise - string: publicKey

Example

try {
  let res = await window.coin98?.bitcoin.getPublicKey();
  console.log(res)
} catch (e) {
  console.log(e);
}
> 03cbaedc26f03fd3ba02fc936f338e980c9e2172c5e23128877ed46827e935296f

getBalance

coin98.bitcoin.getBalance()

Get BTC balance

Parameters

none

Returns

  • Promise - Object:

    • confirmed - number : the confirmed satoshis

    • unconfirmed - number : the unconfirmed satoshis

    • total - number : the total satoshis

Example

try {
  let res = await window.coin98?.bitcoin.getBalance();
  console.log(res)
} catch (e) {
  console.log(e);
}

> {
    "confirmed":0,
    "unconfirmed":100000,
    "total":100000
  }

sendBitcoin

coin98.bitcoin.sendBitcoin(toAddress, satoshis, options)

Send BTC

Parameters

  • toAddress - string: the address to send

  • satoshis - number: the satoshis to send

  • options - object: (optional)

    • feeRate - number: the network fee rate

Returns

  • Promise - string: txid

Example

try {
  let txid = await window.coin98?.bitcoin.sendBitcoin("tb1qrn7tvhdf6wnh790384ahj56u0xaa0kqgautnnz",1000);
  console.log(txid)
} catch (e) {
  console.log(e);
}

signMessage

coin98.bitcoin.signMessage(msg[, type])

sign message

Parameters

  • msg - string: a string to sign

  • type - string: (Optional) "ecdsa" | "bip322-simple". default is "ecdsa"

Returns

  • Promise - string: the signature.

Example

// sign by ecdsa
try {
  let res = await window.coin98?.bitcoin.signMessage("abcdefghijk123456789");
  console.log(res)
} catch (e) {
  console.log(e);
}

> G+LrYa7T5dUMDgQduAErw+i6ebK4GqTXYVWIDM+snYk7Yc6LdPitmaqM6j+iJOeID1CsMXOJFpVopvPiHBdulkE=

// verify by ecdsa
import { verifyMessage } from "@unisat/wallet-utils";
const pubkey = "026887958bcc4cb6f8c04ea49260f0d10e312c41baf485252953b14724db552aac";
const message = "abcdefghijk123456789";
const signature = "G+LrYa7T5dUMDgQduAErw+i6ebK4GqTXYVWIDM+snYk7Yc6LdPitmaqM6j+iJOeID1CsMXOJFpVopvPiHBdulkE=";
const result = verifyMessage(pubkey,message,signature);
console.log(result);

> true

> AkcwRAIgeHUcjr0jODaR7GMM8cenWnIj0MYdGmmrpGyMoryNSkgCICzVXWrLIKKp5cFtaCTErY7FGNXTFe6kuEofl4G+Vi5wASECaIeVi8xMtvjATqSSYPDRDjEsQbr0hSUpU7FHJNtVKqw=

pushTx

coin98.bitcoin.pushTx(options)

Push Transaction

Parameters

  • options - Object:

    • rawtx - string: rawtx to push

Returns

  • Promise - string: txid

Example

try {
  let txid = await window.coin98?.bitcoin.pushTx({
    rawtx:"0200000000010135bd7d..."
  });
  console.log(txid)
} catch (e) {
  console.log(e);
}

signPsbt

coin98.bitcoin.signPsbt(psbtHex[, options])

Sign PSBT

This method will traverse all inputs that match the current address to sign.

Parameters

  • psbtHex - string: the hex string of psbt to sign

  • options

    • autoFinalized - boolean: whether finalize psbt after signing, default is true

    • toSignInputs - array:

      • index - number: which input to sign

      • address - string: (at least specify either an address or a publicKey) Which corresponding private key to use for signing

      • publicKey - string: (at least specify either an address or a publicKey) Which corresponding private key to use for signing

      • sighashTypes - number[]: (optionals) sighashTypes

Returns

  • Promise - string: the hex string of signed psbt

Example

try {
  let res = await window.coin98?.bitcoin.signPsbt(
    "70736274ff01007d....",
    {
        autoFinalized:false,
        toSignInputs:[
          {
            index: 0,
            address: "tb1q8h8....mjxzny",
          },
          {
            index: 1,
            publicKey: "tb1q8h8....mjxzny",
            sighashTypes: [1]
          },
          {
            index: 2,
            publicKey: "02062...8779693f",
          }
        ]
    }
  );
  console.log(res)
} catch (e) {
  console.log(e);
}

signPsbts

coin98.bitcoin.signPsbts(psbtHexs[, options])

Sign Multiple PSBTs at once

This method will traverse all inputs that match the current address to sign.

Parameters

  • psbtHexs - string[]: the hex strings of psbt to sign

  • options - object[]: the options of signing psbt

    • autoFinalized - boolean: whether finalize psbt after signing, default is true

    • toSignInputs - array:

      • index - number: which input to sign

      • address - string: (at least specify either an address or a publicKey) Which corresponding private key to use for signing

      • publicKey - string: (at least specify either an address or a publicKey) Which corresponding private key to use for signing

      • sighashTypes - number[]: (optionals) sighashTypes

Returns

  • Promise - string[]: the hex strings of signed psbt

Example

try {
  let res = await window.coin98?.bitcoin.signPsbts(["70736274ff01007d...","70736274ff01007d..."]);
  console.log(res)
} catch (e) {
  console.log(e);
}

pushPsbt

coin98.bitcoin.pushPsbt(psbtHex)

Push transaction

Parameters

  • psbtHex - string: the hex string of psbt to push

Returns

  • Promise - string: txid

Example

try {
  let res = await window.coin98?.bitcoin.pushPsbt("70736274ff01007d....");
  console.log(res)
} catch (e) {
  console.log(e);
}

Events

accountsChanged

coin98.bitcoin.on('accountsChanged', handler: (accounts: Array<string>) => void);
coin98.bitcoin.removeListener('accountsChanged', handler: (accounts: Array<string>) => void);

The accountsChanged will be emitted whenever the user's exposed account address changes.

networkChanged

coin98.bitcoin.on('networkChanged', handler: (network: string) => void);
coin98.bitcoin.removeListener('networkChanged', handler: (network: string) => void);

The networkChanged will be emitted whenever the user's network changes.

PreviousCoin98 Connect IntegrationNextEthereum DApps Integration

Last updated 1 year ago