5.0.0 • Published 2 years ago

bs58 v5.0.0

Weekly downloads
273,391
License
MIT
Repository
github
Last release
2 years ago

bs58

build status

JavaScript component to compute base 58 encoding. This encoding is typically used for crypto currencies such as Bitcoin.

Note: If you're looking for base 58 check encoding, see: https://github.com/bitcoinjs/bs58check, which depends upon this library.

Install

npm i --save bs58

API

encode(input)

input must be a Uint8Array, Buffer, or an Array. It returns a string.

example:

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

decode(input)

input must be a base 58 encoded string. Returns a Uint8Array.

example:

const bs58 = require('bs58')

const address = '16UjcYNBG9GTK4uq2f7yYEbuifqCzoLMGS'
const bytes = bs58.decode(address)
// See uint8array-tools package for helpful hex encoding/decoding/compare tools
console.log(Buffer.from(bytes).toString('hex'))
// => 003c176e659bea0f29a3e9bf7880c112b1b31b4dc826268187

Browser

You can use this module in the browser. Install Browserify:

npm install -g browserify

then run:

browserify node_modules/bs58/index.js -o bs58.bundle.js --standalone bs58

Hack / Test

Uses JavaScript standard style. Read more:

js-standard-style

Credits

License

MIT

yours-wallet@banditbadgod/react@alebusse/account-lib@layerzerolabs/lz-solana-sdk-v2@kin-kinetic/keypair@kin-kinetic/sdk@kin-tools/keypair-compat@tyz-wallet/tyz-wallet-core-lib-cash@tyz-wallet/tyz-wallet-core-lib-doge@tyz-wallet/tyz-wallet-core-lib-ltcaiot-jsalebusseboansdomains-ui@coin98x/wallet-adapter-coin98-solana@coin98x/wallet-adapter-react@debuggor/solana-web3.jsdivvy-sdk@coral-xyz/common@thirdweb-dev/sdk@ledgerhq/live-common@bitrabbit/nuls-js@dojimanetwork/crypto@jdutchak/argosidaxisjavascriptnewbit-ecceladomain-ui@vitruvedz/3dcore-libgolos-classic-dev-jsgolos-classic-js-devbarjs@beyondcoin/beyondasset-block-explorer@zzappie/bigchaindb-driver@zxtn/lanthanumcrypto-codecdhivebcsweb3csaciost-js@pixelfactory/privatebin-cliwocode-wallet-qitmeerwocode-wallet-ubfactom-did-jssethjs@lianlian2019/blockchain_sdkjs-seth-client@ezdefi/ez-sol-wallet-adapterbitpolisjsonegramjsyounitedjsvelarisjs@coinspace/bitcore-lib-dogecoinstorjshare-clistorj-farmer-clidash-strophy-testbonfida-botaleph-ts-accountstrophy-dapi-client@aviarytech/didcomm@near~eth/nep141-erc20my-wallet-hdjsstcjsgoathighjs@safecoins/web3@nomosfinance/protocol@phantasia/metaplex-jssteem-engine-jssnowgemjssturdy-js-test@xyo-network/sdk-diviner-nodejs@xyo-network/app-xyo-nodejssolanaapipcjs-ecc@mazarine-sea/maz-keyring@streambird/streambird-embed@solcial/client@currie0612/crema-sdkwssuidogelib-jsdracula-game-sdk@superstream/corexwcjscybex-game-addon@monacoprotocol/client@mrmntte/idsbitnucleus@nautilus-js/fleet@flxxyz-foundation/js@playdapp/exchange-sol-base-jsbch-js-joey@rogerfelipe/digibyte-toolbox-jsthmeventjs@anstest/address-encoder@anstest/ui@dao-xyz/sdk-governance@dao-xyz/sdk-user@pnsdomains/ui@devdomains/ui@abaxx/a-id@creativebinary/cbsteem-js
5.0.0

2 years ago

4.0.1

7 years ago

4.0.0

7 years ago

3.1.0

7 years ago

3.0.0

9 years ago

2.0.1

9 years ago

2.0.0

10 years ago

1.2.1

10 years ago

1.2.0

10 years ago

1.1.0

10 years ago

1.0.0

10 years ago

0.3.0

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago