Registry / serialization / base58check

base58check

JSON →
library1.0.2pypypi✓ verified 85d ago

This library provides functions for Base58check encoding and decoding of binary data, commonly used in cryptocurrencies like Bitcoin. It is currently at version 1.0.2 and maintains a stable, low-cadence release cycle.

pip install base58check
INSTALL
IMPORT
SIG · BASE58CHECK
B
base58check
serializationpythonv1.0.2
Install
1.6s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.8MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 1.6s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

b58encode
import base58check encoded_data = base58check.b58encode(b'my_data')
from base58check import encode
The functions are named `b58encode` and `b58decode` within the module.
b58decode
import base58check decoded_data = base58check.b58decode('encodedstring')
from base58check import decode
The functions are named `b58encode` and `b58decode` within the module.

Demonstrates encoding a byte string and decoding it back, along with a simple example of a Bitcoin-like address encoding pattern.

import base58check # Encode binary data original_data = b"Hello, Base58Check!" encoded_string = base58check.b58encode(original_data) print(f"Encoded: {encoded_string}") # Decode a Base58Check string decoded_data = base58check.b58decode(encoded_string) print(f"Decoded: {decoded_data}") # Example with a Bitcoin-like address (simulated for demonstration) simulated_address_bytes = b'\x00' + b'\x01\x09\x66\x77\x60\x06\x95\x3D\x55\x67\x43\x9E\x5E\x39\x8E\x8B\x0D\x9C\x1C\x00\x10' # Example payload simulated_address_encoded = base58check.b58encode(simulated_address_bytes) print(f"Simulated Address: {simulated_address_encoded}")
Debug
Known issues
gotchaThe library implements Base58Check encoding/decoding, which includes a checksum. It does not provide plain Base58 encoding without the checksum. Ensure your application requires the checksum for security and integrity.
fix
Always use this library when a Base58Check checksum is required. If plain Base58 is needed, use a different library (e.g., `base58`).
affects: All versions
gotchaWhen decoding, an invalid Base58Check string (e.g., incorrect characters, wrong length, or a failed checksum) will raise a `ValueError`. It's essential to handle these exceptions gracefully.
fix
Wrap decoding calls in a `try...except ValueError` block to manage invalid input strings. For example: `try: data = base58check.b58decode(s) except ValueError: print('Invalid string')`.
affects: All versions
gotchaThe `b58encode` function accepts either a string or bytes. While it converts strings to bytes internally using UTF-8, it is generally best practice to explicitly provide `bytes` for binary data encoding to avoid potential encoding issues.
fix
Ensure your input for `b58encode` is a `bytes` object (e.g., `b'my_data'`) for clarity and to prevent unexpected behavior with non-ASCII characters if not explicitly handled.
affects: All versions
Errors
Common errors & fixes
ValueError: Invalid base58check string
Attempting to decode a string that is not a valid Base58Check format (e.g., incorrect characters, wrong length, or a failed checksum verification).
fix
Ensure the input string was originally encoded using Base58Check and is not corrupted. Implement `try...except ValueError` for robust error handling.
AttributeError: module 'base58check' has no attribute 'encode'
Trying to use `base58check.encode()` or `base58check.decode()` directly instead of the library's specific function names `base58check.b58encode()` and `base58check.b58decode()`.
fix
Correct the function call to `base58check.b58encode()` for encoding and `base58check.b58decode()` for decoding.
Upgrade
Version history
1.0.2latest on PyPI · released Apr 7, 2018
Audit
Dependencies

No dependency data recorded yet.

Agent activity
25 hits · last 30 days
node
20
OpenAI (training)
1
Resources
base58check — pip install base58check · libregistry