OpenViSTAI · Agents · Blockchain · Crypto
Menu
Security & Custody

BIP38

BIP38 is an MIT-licensed JavaScript library that implements the BIP38 standard for encrypting and decrypting Bitcoin and other cryptocurrency private keys. Its API takes private-key data and a passphrase for encryption, or an encrypted key and passphrase for decryption, and is documented for Node.js and browser projects using Browserify.

Independent OpenViST project profile, based on linked sources.

BIP38 — OpenViST project profile in Security & Custody.
OpenViST project illustration. See the linked sources for product details.
Understand the project

Practical overview

When it fits

Use it when a JavaScript project needs BIP38 encryption or decryption and can provide the key and passphrase inputs expected by its API.

Who it is for

  • JavaScript developers building Bitcoin wallet software.
  • Developers creating command-line or browser-based key conversion tools.
  • Teams adding BIP38 encryption to a wallet backup workflow.

Documented uses

  • Encrypt private-key data with a passphrase using BIP38.
  • Decrypt a BIP38-encrypted key with its passphrase.
  • Integrate BIP38 key handling into a JavaScript application.
Before you choose

Requirements & limits

  • The package is installed through npm and is licensed under MIT.
  • The README documents both synchronous and asynchronous methods; asynchronous methods trade speed for opportunities to free the event loop.
  • Examples use the separate wif package to decode or encode WIF strings around the BIP38 calls.
  • The library handles the BIP38 operation, not the full wallet, user interface, or backup workflow.

Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.

Source-based practical guide

Encrypt a private key with BIP38

Install the JavaScript package and use its documented API to encrypt a decoded WIF private key.

Before you start

  • Node.js or a browser using Browserify.
  • The bip38 package and the wif package.
  • A WIF private key and a passphrase.

Steps

  1. Install BIP38 with the command below.

    Documented command
    npm install --save bip38
  2. Load bip38 and wif, then decode the WIF string with wif.decode(myWifString).

  3. Pass decoded.privateKey, decoded.compressed, and a passphrase to bip38.encrypt(...).

  4. Use the returned encrypted key string as the BIP38-encrypted output.

Expected outcome

The API returns an encrypted key string; the README example returns a BIP38-formatted key beginning `6P`.

Guide limitations

  • The README describes asynchronous methods as slower; their performance trade-off depends on the application, with no recommendation provided.
  • This recipe covers the documented encryption call; it does not provide a key-storage or backup procedure.
Source-based practical guide

Decrypt a BIP38 key and encode it as WIF

Use the documented BIP38 API to decrypt an encrypted key and encode the result as WIF.

Before you start

  • Node.js or a browser using Browserify.
  • The bip38 package and the wif package.
  • A BIP38-encrypted key and its passphrase.

Steps

  1. Install BIP38 with the command below.

    Documented command
    npm install --save bip38
  2. Load bip38 and wif, then call bip38.decrypt(encryptedKey, passphrase); the API also accepts an optional progress callback and scrypt parameters.

  3. Pass decryptedKey.privateKey and decryptedKey.compressed to wif.encode(0x80, ...).

  4. Use the returned WIF string as the encoded private key.

Expected outcome

The API returns decrypted key data, which the documented WIF call converts back to a WIF string.

Guide limitations

  • The README's example shows a progress callback reporting status.percent; it does not specify behavior for an incorrect passphrase.
  • This recipe covers decryption and WIF encoding, not secure handling or storage of the decrypted key.
Evidence and transparency

Sources & review

Source record details
Source availability
Active
Sources checked
14 October 2026
Original website title
bitcoinjs/bip38 · Official homepage title · retained in its source language