Bitcoin-Compatible Chain Wallet Integration via Injected Provider API

·

Integrating cryptocurrency wallets into decentralized applications (DApps) is a critical step in delivering seamless user experiences on blockchain networks. The OKX Injected Provider API enables developers to connect DApps with Bitcoin-compatible chains through the OKX Wallet extension and mobile app. This powerful JavaScript-based interface allows for secure interactions such as account access, transaction signing, balance retrieval, and advanced operations like inscription management and PSBT handling.

Whether you're building a decentralized exchange (DEX), NFT marketplace, or BRC-20 token platform, this API streamlines wallet integration while maintaining high security standards and user control.

Core Functionality Overview

The OKX Injected Provider API exposes a set of methods that allow DApps to interact directly with the user’s wallet environment. These functions are accessible under the okxwallet.bitcoin namespace and support both extension (minimum version 2.77.1) and mobile app (minimum version 6.51.0) environments, with certain features limited to specific platforms.

Key capabilities include:

👉 Discover how easy it is to integrate advanced Bitcoin functionality into your DApp.

Connecting & Retrieving Account Information

connect()

Establishes a connection between your DApp and the user's OKX Wallet.

okxwallet.bitcoin.connect();

Returns a promise resolving to an object containing:

This method is ideal for initializing wallet sessions securely.

requestAccounts() and getAccounts()

Both methods retrieve the connected account’s address. While requestAccounts() prompts user consent (ideal for first-time connections), getAccounts() silently returns the current address if already connected.

Note: Available from extension version 2.77.1+.

getPublicKey()

Fetches the public key of the currently connected account—essential for verifying signed messages or enabling secure communication protocols.

Network & Balance Management

getNetwork()

Retrieves the active network name (e.g., "mainnet"). Currently, testnet is not supported.

Requirement: Extension version 2.77.1 or higher.

getBalance()

Obtains the BTC balance in satoshis with detailed breakdown:

Minimum versions: App 6.51.0+, Extension 2.77.1+

Inscription & NFT Operations

With the rise of Ordinals and BRC-20 tokens, managing inscriptions has become vital.

getInscriptions()

Lists all inscriptions owned by the current account.

Parameters:

Returns metadata including:

Platform Note: Some fields are not supported in mobile apps yet.

sendInscription() vs transferNft()

FeaturesendInscriptiontransferNft
Batch Transfer❌ No✅ Yes
Supported ProtocolsOrdinals, AtomicalsOrdinals, Atomicals
Platform AvailabilityExtension onlyExtension only

Use transferNft when sending multiple NFTs or BRC-20 tokens efficiently.

Inscribe & Mint BRC-20 Tokens

inscribe()

Initiates a transfer inscription for BRC-20 tokens using type 51.

mint()

Supports batch minting across multiple inscription types:

Returns detailed transaction data including commit/reveal hashes, fees, and size—critical for monitoring on-chain activity.

👉 Start building next-gen Bitcoin DApps with full BRC-20 and NFT support.

Transaction Handling & Signing

Sending Bitcoin

Two primary methods:

sendBitcoin(toAddress, satoshis, options)

Sends BTC with optional fee rate customization.

send({ from, to, value, satBytes, memo, memoPos })

Advanced version supporting OP_RETURN memos. Must specify memoPos if including a memo.

PSBT Support

Partially Signed Bitcoin Transactions (PSBTs) enable multi-signature and hardware wallet compatibility.

signPsbt(psbtHex[, options])

Signs a single PSBT. Options allow:

Auto-finalization defaults to true on newer versions.

signPsbts(psbtHexs[, options])

Batch version for signing multiple PSBTs simultaneously.

pushPsbt(psbtHex) vs sendPsbt(txs, from)

While both push PSBTs to the network:

Event Listeners for Real-Time Updates

accountChanged

Emitted when users switch accounts within OKX Wallet (app v6.51.0+). If the new account has whitelisted your DApp, the connection persists with updated public key delivery.

accountsChanged

Triggered whenever the exposed account list changes—useful for UI synchronization and session management.

Available from app 6.51.0+ and extension 2.77.1+.

Frequently Asked Questions

What is the OKX Injected Provider API?

It’s a JavaScript interface embedded in websites via the OKX Wallet extension or app, allowing DApps to securely request account access, sign transactions, and interact with Bitcoin-compatible blockchains.

Which Bitcoin features does this API support?

Full support for BTC transfers, BRC-20 tokens, Ordinals/NFT inscriptions, PSBT signing, memo inclusion via OP_RETURN, and real-time event listening.

Is testnet supported?

No. Currently, only mainnet operations are supported through the OKX Wallet provider.

Can I use this API on mobile?

Yes—but some methods like splitUtxo, inscribe, and mint are available only in the extension. Mobile support requires app version 6.51.0 or higher for most advanced features.

How do I handle Taproot addresses in PSBTs?

When creating PSBTs involving Taproot inputs, ensure each input includes its corresponding public key. Use the disableTweakSigner option if you need raw private key signing instead of tweaked signatures.

What are the differences between sendPsbt and pushPsbt?

sendPsbt supports batch transactions and enriches transaction history with type labels (e.g., BRC-20 sends), whereas pushPsbt handles single transactions with minimal metadata.


With robust tooling for account management, asset transfer, and advanced Bitcoin scripting, the OKX Injected Provider API empowers developers to build feature-rich DApps on Bitcoin-compatible chains.

👉 Unlock full Bitcoin integration potential—start coding today.