You can read about Protocol Consolidation.
Protocol consolidation happens at compile time. You can disable or enable from mix config as mentioned in docs.
When it is enabled (by default) - it will link protocols with their implementations at compile time to optimise invocations. So when you are trying it in iex - it has no effect as protocol consolidation already happened.
Two solutions:
- disable protocol consolidation using mix config (not recommended) - Section 16.6 don’t go by title read the content in linked section in this book - https://www.elixircryptobot.com/.
- define all these encoders in files and compile the project (recommended)
No problem with the code or library or project - its working as it is supposed to be.