• Stars
    star
    212
  • Rank 186,082 (Top 4 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 11 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Base58 encoding/decoding for Bitcoin

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

More Repositories

1

secp256k1-node

Node.js binding for an Optimized C library for EC operations on curve secp256k1
JavaScript
341
star
2

base-x

Encode/decode any base
JavaScript
312
star
3

hdkey

JavaScript component for Bitcoin hierarchical deterministic keys (BIP32)
JavaScript
201
star
4

coinkey

JavaScript component for private keys, public keys, and addresess for crypto currencies such as Bitcoin, Litecoin, and Dogecoin
JavaScript
149
star
5

cryptocoin

JavaScript library for crypto currencies like Bitcoin and Litecoin.
JavaScript
140
star
6

coininfo

JavaScript component for crypto currency specific information.
JavaScript
116
star
7

keccak

Keccak sponge function family
C
86
star
8

p2p-node

Manage peer-to-peer communications for cryptocurrency implementations
JavaScript
61
star
9

ecurve

JavaScript component for Eliptic Curve Cryptography
JavaScript
58
star
10

awesome-cryptocoinjs

Useful crypto coins JavaScript libraries
58
star
11

bigi

JavaScript Big Integer library based upon Tom Wu's work.
JavaScript
49
star
12

sha256

DEPRECATED - JavaScript component to compute the SHA256 of strings or bytes.
JavaScript
47
star
13

scryptsy

Scrypt KDF is used for BIP38 (encryption of private keys) and proof of work for some crypto currencies.
JavaScript
45
star
14

stealth

Stealth addresses for Bitcoin and other crypto currencies.
JavaScript
42
star
15

ecdsa

DEPRECATED - JavaScript component to Eliptical Curve Cryptography signing and verify.
JavaScript
38
star
16

qr-encode

JavaScript component to encode strings into QR codes.
JavaScript
25
star
17

pbkdf2-sha256

DEPRECATED - Key derivation function primarily used for Scrypt
JavaScript
22
star
18

aes

A JavaScript component for the Advanced Encryption Standard (AES). Important for BIP38
JavaScript
21
star
19

eckey

A JavaScript component for Eliptical curve cryptography for crypto currencies such as Litecoin and Bitcoin
JavaScript
17
star
20

coinstring

DEPRECATED - Create and parse crypto currency addresses and wallet import formats.
JavaScript
16
star
21

scrypt

Scrypt for node and browser
C
14
star
22

binstring

DEPRECATED - Convert binary data to and from various string/integer representations
JavaScript
12
star
23

blake-hash

SHA-3 proposal Blake
C
12
star
24

btc-transaction

Create, parse, serialize Bitcoin transactions.
JavaScript
11
star
25

btc-address

JavaScript component to handle Bitcoin addresses.
JavaScript
10
star
26

crypto-hashing

JavaScript hashing libraries wrapped up into one module. Compatible with Node and the browser.
JavaScript
10
star
27

sha512

DEPRECATED - SHA 512 secure hashing algorithm
JavaScript
9
star
28

cryptocoinjs.com

CryptoCoinJS Docs
HTML
9
star
29

drbg.js

Deterministic Random Bit Generators from NIST SP 800-90A
JavaScript
8
star
30

btc-p2p

Bitcoin peer network manager
JavaScript
8
star
31

btc-blockchain

Bitcoin blockchain management
JavaScript
7
star
32

btc-script

Script support for Bitcoin
JavaScript
7
star
33

eip55

An EIP55 compatible address encoding library
JavaScript
7
star
34

coinmsg

Message signing for Bitcoin and other cryptocurrencies.
JavaScript
7
star
35

btc-scriptinterpreter

JavaScript
6
star
36

crypto-binary

Assemble and disassemble binary messages used in cryptocoin applications
JavaScript
5
star
37

p2p-manager

Manage peer connections to a P2P network
JavaScript
5
star
38

btc-opcode

Opcode support for Bitcoin.
JavaScript
5
star