Say I have a struct like

struct AppState {
    address player1;
    address player2;
    uint256 winner;
    uint256[100] board;
    uint256 move;

Now I have a function which receives a byte encoded format of the same AppState. Basically,

function _getAppState(bytes _s) public pure {
    //deserialise _s to an AppState struct
    AppState memory state = deserialise _s
    //do stuff with state...

Is there any serialise/deserialise library available to do this?

  • So you already have it serialized? Which serialization did you use? And why do you want your own deserialization instead of trusting existing Ethereum clients? – Utgarda Sep 27 '18 at 22:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.