bs58
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
base-x | 4.0.0 | 3.94 kB | MIT | prod |
The bs58 is a JavaScript component used to compute base 58 encoding, a type of encoding typically utilized in cryptocurrencies such as Bitcoin. This package is specifically designed to facilitate processes involving Base 58 encoding and decoding in any JavaScript-based environments.
To use bs58, it is first necessary to install the package using npm install command as follows:
npm i --save bs58
Once installed, you can use bs58 for encoding and decoding purposes in your JavaScript code. Here are some examples demonstrating the usage:
To encode
const bs58 = require('bs58')
const bytes = Uint8Array.from([
0, 60, 23, 110, 101, 155, 234,
15, 41, 163, 233, 191, 120, 128,
193, 18, 177, 179, 27, 77, 200,
38, 38, 129, 135
])
const address = bs58.encode(bytes)
console.log(address)
// => 16UjcYNBG9GTK4uq2f7yYEbuifqCzoLMGS
To decode
const bs58 = require('bs58')
const address = '16UjcYNBG9GTK4uq2f7yYEbuifqCzoLMGS'
const bytes = bs58.decode(address)
console.log(Buffer.from(bytes).toString('hex'))
// => 003c176e659bea0f29a3e9bf7880c112b1b31b4dc826268187
Please note that to use this module in the browser, Browserify can be installed and run to bundle the package for browser usage.
The documentation for the bs58 JavaScript package can be found within the README file in the GitHub repository accessible at the URL git+https://github.com/cryptocoinjs/bs58.git. The README file provides detailed information on how to install and use the bs58 package, including code examples for encoding and decoding processes.