Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serialization support? #13

Open
adamcypher opened this issue Aug 22, 2019 · 3 comments
Open

Serialization support? #13

adamcypher opened this issue Aug 22, 2019 · 3 comments

Comments

@adamcypher
Copy link

Is there a good way to serialize and deserialize the merkle tree?

encoding/gob seems to fail

@cbergoon
Copy link
Owner

@adamgering do you have the specific error?

I see a couple potential problems. There is a circular reference between the node and the tree structs that might be causing a problem. We can probably get around this with custom encode/decode functions.

The second likely issue is that the hash function is stored on the MerkleTree type to allow it to be configurable. Since we cannot serialize a function in Go maybe this should be handled at the application level.

Cam

@pocockn
Copy link

pocockn commented Jun 17, 2020

@cbergoon Did you get any further with this issue? I'm trying to serialize and deserialize the tree but I'm getting the circular reference error you mentioned. Great library!

@cbergoon
Copy link
Owner

@pocockn unfortunately I haven't looked into it much more. I will try to spend some time on it this weekend - if the reference can't be removed I'm thinking maybe an intermediate form that would omit the reference and be recalculated. As for the hash function being dynamic we could potentially change this to only support the std lib hash types; this way we do not need the function but just an indicator of which to use.

Haven't thought it all the way through yet so if you have suggestions feel free to share.

Cam

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants