I am using IPFS-multihash method to store IPFS hash in smart contracts. For that I need to decode base58 format:
QmaozNR7DZHQK1ZcU9p7QdrshMvXqWK6gpu5rmrkPdT3L4
to binary(as hex):
1220b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9
But I am unable to use bs58 module in browser (I tried using Browserify). Can you tell me the javascript implementation for decoding and encoding in base58 so that I can implement the above method without using node_modules? Or can you tell how exactly can I use Browserify to use a node module step-by-step?
After running the first command 'bs58' folder is created in 'node_modules' folder.....there is no lib folder. Can you guide me with the exact commands I must use?
npm install --save bs58
npm install -g browserify
browserify < lib/bs58.js > lib/bs85.bundle.js
My file structure is somewhat like this:
-node_modules
-src
|___index.html
|___js
|____app.js
For me, it worked by using Base58 implementation and converting the resulting result into hex.
var MAP = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
var decoded = toHexString(from_b58(ipfsHash,MAP)).toUpperCase();
Thanks to Chris G