OpenViSTAI · Agents · Blockchain · Crypto
Menu
Developer Tools

BECH32

BECH32 is a TypeScript library for encoding and decoding Bech32 and Bech32m strings compatible with Bitcoin BIP173 and BIP350. It includes conversion between byte data and the format’s word representation.

Independent OpenViST project profile, based on linked sources.

BECH32 — OpenViST project profile in Developer Tools.
OpenViST project illustration. See the linked sources for product details.
Understand the project

Practical overview

When it fits

Use it when an application needs focused Bech32 or Bech32m encoding, decoding, or byte-to-word conversion.

Who it is for

Developers building Bitcoin wallets or applications that need to handle Bech32 or Bech32m data.

Documented uses

  • Decode a Bech32 or Bech32m string to obtain its prefix and words.
  • Convert byte data into words and encode it with a selected prefix.
  • Handle both Bech32 and Bech32m formats in an application.
Before you choose

Requirements & limits

  • The README demonstrates separate Bech32 and Bech32m interfaces for encoding and decoding.
  • The README warns that increasing the BIP173 90-character limit reduces checksum effectiveness and recommends not exceeding 1,023 characters.

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

Decode a Bech32 or Bech32m string

Retrieve the prefix and word data from a Bech32 or Bech32m string using the corresponding library object.

Before you start

  • The bech32 library is available to the JavaScript code.
  • A Bech32 or Bech32m string to decode.

Steps

  1. Import bech32 and bech32m from the bech32 package.

  2. Call bech32.decode(string) for a Bech32 value, or bech32m.decode(string) for a Bech32m value.

  3. Use the returned prefix and words fields.

Expected outcome

The decode call returns an object containing the string's prefix and word array, as shown in the project examples.

Guide limitations

  • The examples do not document error handling or validation behavior for invalid inputs.
Source-based practical guide

Convert bytes to words and encode them as Bech32 or Bech32m

Convert byte data to the library's word representation and encode it with a chosen prefix.

Before you start

  • The bech32 library is available to the JavaScript code.
  • Byte data to encode.

Steps

  1. Import bech32 and bech32m from the bech32 package.

  2. Convert the byte data with bech32.toWords(bytes); the README demonstrates this with a UTF-8 Buffer.

  3. Encode the resulting words with bech32.encode(prefix, words) or bech32m.encode(prefix, words), according to the desired format.

Expected outcome

The selected encoding method returns an encoded string; the project example demonstrates both formats with prefix `foo`.

Guide limitations

  • BIP173 imposes a 90-character limit. If extending the LIMIT parameter, checksum effectiveness decreases as length increases.
  • The project strongly recommends not exceeding 1023 characters, where the module can guarantee detecting only one error.
Evidence and transparency

Sources & review

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