Skip to content

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.

bash
npm i @bkc-network-lib/sdk

Most applications need only @bkc-network-lib/sdk. It gives you:

  • an ethers v6 Provider and Signer that wrap EVM writes in MsgExecuteEvmCall — 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.v1 codec, gas rules, ADR-36 message signing, log paging, fee lookup.

Packages ​

PackageWhat it is
@bkc-network-lib/sdkOne import for BKC: ethers Provider/Signer, codec, chain constants, helpers. Start here.
@bkc-network-lib/stargateCosmos SDK client — accounts, bank, staking, governance, broadcasting
@bkc-network-lib/proto-signingProtobuf (Direct) signing and the ML-DSA-65 wallets
@bkc-network-lib/aminoAddress, public key and signature encoding
@bkc-network-lib/cryptoHashing, ML-DSA-65, HD/HKDF derivation, keystore encryption
@bkc-network-lib/tendermint-rpcCometBFT RPC client
@bkc-network-lib/encodinghex, base64, bech32, utf8
@bkc-network-lib/mathSafe integers and decimals for token amounts
@bkc-network-lib/utilsAssertions and small helpers
@bkc-network-lib/stream · socket · json-rpcTransport 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:

ts
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:

js
// 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 ​

ts
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").

BKC testnet is unaudited. Do not hold value on it.