Within solidity smart contracts, I’ve seen a few repetitions of different data-formatting algorithms like base64 encoding/decoding, JSON, and SVG. Rather than having smart contracts re-implement this logic over and over, I think it would be helpful to document any smart contracts that already exist as standalone Library implementations for any other contract to use (and smart contracts that have some algorithm’s logic baked in that would be good candidates for someone to refactor into a standalone library), so starting here with the few I know of:
Standalone Libraries
- AVL tree (self-balancing binary search tree): Grove
0xD07cE4329B27Eb8896c51458468d98a0e4C0394C
Examples
- SVG:
MoonCatSVGs
0xB39C61fe6281324A23e079464f7E697F8Ba6968f
- PNG (cyclic redundancy check (CRC) checksums):
MoonCatAccessoryImages
0x91CF36c92fEb5c11D3F5fe3e8b9e212f7472Ec14
- Base64:
MoonCatAccessoryImages
0x91CF36c92fEb5c11D3F5fe3e8b9e212f7472Ec14
What others exist out there? A key algorithm that I’ve been thinking about trying to implement in Solidity is the DEFLATE (RFC-1951) decoder/decompression algorithm. This would allow data to be saved into a contract’s memory compressed, and then allow view functions to still be able to parse it. Does that exist anywhere out there on-chain already?