Looking for a JavaScript Sapling address validator

Would someone know of a JavaScript validator for Sapling’s bech32 addresses?

Or, why might a BTC bech32 decoder complain that a Sapling address has ‘non-zero padding’:

https://github.com/bitcoinjs/bech32/blob/master/index.js#L144

Thanks!

I do not know of any javascript validators for Zcash/Sapling addresses.

The BTC decoder is likely to complain because of changes in the format (such as address size) when compared to Zcash.

There is a lot of very technical documentation - starting with the protocol specification

The section you are asking about is around 5.6 → 5.6.4 which should lead you to ZIP-173.
https://zips.z.cash/zip-0173

Which will list the details zcash takes to use bech32. It also includes a reference encoder/decoder from zcashd source in bech32.cpp

1 Like

Thanks for the swift reply! With some details from the ZIP, I was able to get validation working with the existing BTC library. :smiley:

2 Likes