JavaScript SDK (bkc-lib)
bkc-lib is the JavaScript client stack for BKC — a fork of CosmJS 0.39 with ML-DSA-65 signing and EVM-over-Cosmos support, published under the @bkc-network-lib npm scope.
npm i @bkc-network-lib/sdkMost applications need only @bkc-network-lib/sdk. It gives you:
- an ethers v6
ProviderandSignerthat wrap EVM writes inMsgExecuteEvmCall— see ethers signer; connectBkcWallet()for browser dApps — see Browser dApps & wallets;- the Cosmos side: ML-DSA wallets,
SigningStargateClient, bank, staking, governance — see Cosmos side; - chain helpers: address conversion, the
bkc.bkc.v1codec, gas rules, ADR-36 message signing, log paging, fee lookup.
Packages
| Package | What it is |
|---|---|
@bkc-network-lib/sdk | One import for BKC: ethers Provider/Signer, codec, chain constants, helpers. Start here. |
@bkc-network-lib/stargate | Cosmos SDK client — accounts, bank, staking, governance, broadcasting |
@bkc-network-lib/proto-signing | Protobuf (Direct) signing and the ML-DSA-65 wallets |
@bkc-network-lib/amino | Address, public key and signature encoding |
@bkc-network-lib/crypto | Hashing, ML-DSA-65, HD/HKDF derivation, keystore encryption |
@bkc-network-lib/tendermint-rpc | CometBFT RPC client |
@bkc-network-lib/encoding | hex, base64, bech32, utf8 |
@bkc-network-lib/math | Safe integers and decimals for token amounts |
@bkc-network-lib/utils | Assertions and small helpers |
@bkc-network-lib/stream · socket · json-rpc | Transport plumbing for the RPC client |
cosmwasm, ledger-amino, faucet and faucet-client remain in the repository but are not published: BKC runs an EVM rather than x/wasm, and no Ledger app implements ML-DSA-65.
Use the scoped packages only
Upstream publishes @cosmjs/crypto@0.39.0 too. A dependency that asks for @cosmjs/* gets the upstream package, which has no ML-DSA-65 — every import resolves and every BKC symbol is undefined at runtime. Use @bkc-network-lib/* everywhere and never mix the two scopes.
@bkc-network-lib/sdk/core — no transport
Wallets and other code that already has a keyring and an RPC layer can import the chain-specific pieces without ethers or the Stargate client:
import { MsgExecuteEvmCall, makeEvmCallMessage, bkcChain, mldsa65Sizes } from "@bkc-network-lib/sdk/core";It depends only on @bkc-network-lib/crypto, @bkc-network-lib/encoding and @bufbuild/protobuf, and carries the chain constants, address conversions (with EIP-55), the MsgExecuteEvmCall codec, the gas rules, ML-DSA-65 sizes, the HKDF salt and ADR-36 signing.
Environments
- Node.js 22+
- Modern browsers and browser extensions (Chromium, Firefox, Safari)
- ES2022, no WebAssembly: cryptography is pure JavaScript (
@noble/*,@scure/bip39), which is what lets it run inside an extension.
Bundling for the browser
Webpack 5 no longer polyfills Node built-ins; tell it not to:
// webpack.config.js
plugins: [new webpack.ProvidePlugin({ Buffer: ["buffer", "Buffer"] })],
resolve: {
fallback: { buffer: false, crypto: false, events: false, path: false, stream: false, string_decoder: false },
},Chain constants
import { bkcChain, evmCallTypeUrl } from "@bkc-network-lib/sdk";
bkcChain.bech32Prefix; // "bkc"
bkcChain.denom; // "bkc" (18 decimals)
bkcChain.evmChainId; // 262144
bkcChain.baseGasLimit; // 600000n — Cosmos gas before the EVM budget
bkcChain.isSimulable; // false
evmCallTypeUrl; // "/bkc.bkc.v1.MsgExecuteEvmCall"bkcChain.gasPrice (66,666,666,667) is a stale default — about 13,000× the chain minimum — and is used whenever you omit a gas price. Pass the network's minimum explicitly: GasPrice.fromString("5000000bkc").
