OKX Web3 Wallet SDK is a comprehensive TypeScript/JavaScript solution for building wallet applications that support offline transactions across multiple blockchain networks. This SDK provides a unified interface for account management, transaction creation, and signing for various mainstream public blockchains.
- Multi-chain support
- Offline transaction signing
- Account generation and management
- Customizable transaction creation
- BRC20/Atomical/Runes.. support for Bitcoin
- Extensible architecture
For detailed documentation and API references, please visit our online documentation.
Try our online signing demo to see the SDK in action.
Package | Generate Address | Sign Transaction | Sign Message | Version |
---|---|---|---|---|
@okxweb3/coin-bitcoin | ✅ | ✅ | ✅ | |
@okxweb3/coin-ethereum | ✅ | ✅ | ✅ | |
@okxweb3/coin-aptos | ✅ | ✅ | ✅ | |
@okxweb3/coin-cosmos | ✅ | ✅ | ✅ | |
@okxweb3/coin-eos | ✅ | ✅ | ✅ | |
@okxweb3/coin-stacks | ✅ | ✅ | ✅ | |
@okxweb3/coin-starknet | ✅ | ✅ | ✅ | |
@okxweb3/coin-sui | ✅ | ✅ | ✅ | |
@okxweb3/coin-near | ✅ | ✅ | ✅ | |
@okxweb3/coin-tron | ✅ | ✅ | ✅ | |
@okxweb3/coin-ton | ✅ | ✅ | ✅ | |
@okxweb3/coin-cardano | ✅ | ✅ | ✅ | |
@okxweb3/coin-solana | ✅ | ✅ | ✅ | |
@okxweb3/coin-kaspa | ✅ | ✅ | ✅ |
*Note: Bitcoin support includes core functions for BRC20 ,Atomicals and Runes protocols, such as deployment, minting, transfer, and trading. This covers inscription creation, buying, selling, and other advanced operations across these Bitcoin-based token standards.
The OKX Web3 Wallet SDK is composed of three main modules:
- crypto-lib: Handles general security and signature algorithms.
- coin-base: Provides a common interface for all supported coins.
- coin-specific packages: Implement transaction creation and signing for each supported blockchain.
To use the OKX Web3 Wallet SDK, install the core packages and the specific coin packages you need:
# Core packages (required for all coins)
npm install @okxweb3/crypto-lib
npm install @okxweb3/coin-base
# coin-specific packages (install as needed)
npm install @okxweb3/coin-ethereum
npm install @okxweb3/coin-bitcoin
# ... other coin packages
To build the SDK locally and run tests:
git clone https://github.com/okx/js-wallet-sdk.git
cd js-wallet-sdk
sh build.sh
Here's a basic example of how to use the SDK with Ethereum:
const { EthWallet } = require('@okxweb3/coin-ethereum');
const privateKey = "your_private_key_here";
async function run() {
const wallet = new EthWallet();
let params = {
privateKey: privateKey
};
let address = await wallet.getNewAddress(params);
console.log('Ethereum address:', address);
let ethTxParams = {
to: "0xee7c7f76795cd0cab3885fee6f2c50def89f48a3",
value: 1,
nonce: 5,
gasPrice: "100000000000",
gasLimit: 21000,
chainId: 42,
};
let signParams = {
privateKey: privateKey,
data: ethTxParams
};
let tx = await wallet.signTransaction(signParams);
console.log('Signed transaction:', tx);
}
run();
For more detailed examples and usage instructions for each supported blockchain, please refer to the documentation in the respective coin-specific package.
We encourage everyone to use our online demo and documentation. If you encounter any issues or have suggestions, please submit them through GitHub Issues.
If you find security risks, it is recommended to feedback through the following channels and get your reward! submit on HackerOne platform https://hackerone.com/okg Or on our OKX feedback submission page > security bugs https://www.okx.com/feedback/submit
The OKX Web3 Wallet SDK is open-sourced software licensed under the MIT license.