# @okxweb3/coin-base

> A base package for @okxweb3/coin-*

Latest version **2.0.7** (published 2026-06-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install @okxweb3/coin-base
pnpm add @okxweb3/coin-base
yarn add @okxweb3/coin-base
bun add @okxweb3/coin-base
```

## Health

**Score 55/100 (C)** — status: active.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 2.0.7 |
| Published | 2026-06-03 |
| First published | 2023-09-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 10 |
| Unpacked size | 5.1 KB |
| Known vulnerabilities | 0 (+11 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 387 |
| Author | okx |
| Maintainers | xiao.xu, moxixii, martynyan, toringona, linus.wang, debuggor, jjay98, shisilu, npm-okx |
| Keywords | wallet, web3, crypto, blockchain, sdk, transaction, signing, address, private-key |

## Links

- npm: https://www.npmjs.com/package/@okxweb3/coin-base
- Repository: https://github.com/okx/js-wallet-sdk
- Homepage: https://github.com/okx/js-wallet-sdk#readme
- Issues: https://github.com/okx/js-wallet-sdk/issues
- npm.io page: https://npm.io/package/@okxweb3/coin-base

## Dependencies (10)

- [long](https://npm.io/package/long.md) 5.2.4
- [bn.js](https://npm.io/package/bn.js.md) 4.12.3
- [typeforce](https://npm.io/package/typeforce.md) 1.18.0
- [protobufjs](https://npm.io/package/protobufjs.md) 7.5.5
- [@scure/base](https://npm.io/package/@scure/base.md) 1.2.6
- [randombytes](https://npm.io/package/randombytes.md) 2.1.0
- [@types/bn.js](https://npm.io/package/@types/bn.js.md) 4.11.6
- [bignumber.js](https://npm.io/package/bignumber.js.md) 9.1.2
- [@noble/hashes](https://npm.io/package/@noble/hashes.md) 1.7.2
- [@okxweb3/crypto-lib](https://npm.io/package/@okxweb3/crypto-lib.md) 2.0.6

## Alternatives

- [@gemini-wallet/core](https://npm.io/package/@gemini-wallet/core.md) — 515.6K weekly downloads
- [utility](https://npm.io/package/utility.md) — 416.6K weekly downloads
- [@primno/dpapi](https://npm.io/package/@primno/dpapi.md) — 7.2K weekly downloads
- [pi-readseek](https://npm.io/package/pi-readseek.md) — 3.7K weekly downloads
- [@emilia-protocol/verify](https://npm.io/package/@emilia-protocol/verify.md) — 1.1K weekly downloads

## Recent versions

- 2.0.7 (latest) — 2026-06-03
- 2.0.3-beta.0 (beta) — 2025-09-28
- 2.0.6 — 2026-01-05
- 2.0.3 — 2025-10-09
- 1.1.6 — 2025-07-30
- 1.1.5 — 2025-07-17
- 1.1.5-beta.1 — 2025-07-10
- 1.1.5-beta.0 — 2025-07-09
- 1.1.4 — 2025-06-25
- 1.1.4-beta.0 — 2025-05-22
- 1.1.3 — 2025-03-07
- 1.1.2 — 2025-02-18
- 1.1.1-beta.1 — 2025-02-10
- 1.1.0 — 2025-01-15
- 1.0.15 — 2025-01-15
- … 29 more at https://npm.io/package/@okxweb3/coin-base/versions

## README

# Installation
This is a base library on which all currencies depend. You need to install this library.
```shell
npm install @okxweb3/coin-base
```

## Provides
We provide common functionality for these chains or coins so that access to these chains is very simple.

### Supporting chains
It supports Bitcoins, Ethereum, Aptos, Near, Starknet, Sui, Zkspace, Cosmos, Eos, Flow, Polkadot, Solana, Stacks and Tron.

### Supporting functions

**1.generate a random private key**

secp256k1 curve uses the default implementation, ed25519 curve, you need to use the basic/ed25519 implementation.
```typescript
getRandomPrivateKey()
```

**2.generate private key from DerivePriKeyParams**
 ```typescript
getDerivedPrivateKey(param: DerivePriKeyParams)
```

**3. get new address by private key**
 ```typescript
getNewAddress(param: NewAddressParams)
```

**4. validate address**
 ```typescript
validAddress(param: ValidAddressParams)
```

**5.sign transaction**
```typescript
signTransaction(param: SignTxParams)
```

**6.get bip44 path**
```typescript
getDerivedPath(param: GetDerivedPathParam)
```

**7.validate private key**
```typescript
validPrivateKey(param: ValidPrivateKeyParams)
```

**8.sign message**
```typescript
signMessage(param: SignTxParams)
```

**9.verify message**
```typescript
verifyMessage(param: VerifyMessageParams)
```

**10.recover signature to public key**
```typescript
ecRecover(message: TypedMessage, signature: string)
```

**11.get address by public key**
```typescript
getAddressByPublicKey(param: GetAddressParams)
```

**12.get raw transaction for mpc**
```typescript
getMPCRawTransaction(param: MpcRawTransactionParam)
```

**13.get signed transaction for mpc**
```typescript
getMPCTransaction(param: MpcTransactionParam)
```

**14.get raw message for mpc**
```typescript
getMPCRawMessage(param: MpcRawTransactionParam)
```

**15.get signed message for mpc**
```typescript
getMPCSignedMessage(param: MpcMessageParam)
```

**16.get raw transaction for hardware**
```typescript
getHardWareRawTransaction(param: SignTxParams)
```

**17.get signed transaction for hardware**
```typescript
getHardWareSignedTransaction(param: HardwareRawTransactionParam)
```

**18.get message hash for hardware**
```typescript
getHardWareMessageHash(param: SignTxParams)
```

**19.get tx hash by raw transaction**
```typescript
calcTxHash(param: CalcTxHashParams)
```

**20.generate raw transaction data**
```typescript
getRawTransaction(param: GetRawTransactionParams)
```

**21.check signed transaction**
```typescript
validSignedTransaction(param: ValidSignedTransactionParams)
```

**22.estimate gas fee**
```typescript
estimateFee(param: SignTxParams)
```


## License

Current package is [MIT](<https://github.com/okx/js-wallet-sdk/blob/main/LICENSE>) licensed.

---
_Source: https://npm.io/package/@okxweb3/coin-base · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
