Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
mobile: add toString & rlp/json encoding for protocol types #14454
This PR adds support for marshaling base consensus types (headers, blocks, transactions and receipts) to/from RLP and JSON. These are useful if a mobile client wants to interact with some third party service requiring these data structures without needing to write the encoders in Java/Swift (which will go stale with any data structure modification).
The PR also makes all base types implement the stringer interface so the consensus types can just be printed to console for debugging purposes.
@ligi Souped up the PR. It can encode/decode all consensus types to/from RLP/JSON.
Tiny white lie, encoding/decoding JSON for entire blocks doesn't work as it needs a follow up fix for the Go types package to support that since currently it does not directly. Will do that eventually.
@karalabe Very cool - can't wait to try it out - will do once it hits maven-central. Hope the increased complexity does not delay the merge too much - my main use-case seemed already covered by the single digit lines change before ;-)