Use raw bytes instead of strings as the leaf type
I'm using Merkly at the moment in a Solidity smart contract project, as merkle trees have a lot of uses in Blockchain. Libraries like eth-abi will deliver encoded objects as bytes that can then be used in smart contract calls. For this reason, I have a bit of trouble using Merkly as it stands, as these raw byte arrays are not always convertible to utf-8 and merkly uses the default string encoding function (utf8) and doesn't allow for it to be tweaked. Of course another feature option would be to allow for custom string encoding, but I think it might be easier and more flexible to just accept leafs as bytes instead of or in addition to strings.
I have pretty amateur Python experience but since I need this feature for myself anyways, I may push a pull request in case anyone else comes across this issue in the future
You're important to us:
- You're using our lib <3
- Dealing with raw bytes is really better when it comes to solidity
I've implemented lib with raw bytes in the past, but I thought it would be more accessible to leave it as strings. It seems that reality has shown us that we need raw bytes.
I'll analyze your PR #76, and put it into production.
Thanks for contributing!