SIGBlockchain / project_aurum

SIG Blockchain blockchain project in Go
https://acm.cs.uic.edu/sigblockchain
MIT License
7 stars 1 forks source link

JSON marshaling of a block #345

Closed Vineet77 closed 4 years ago

Vineet77 commented 4 years ago

Package Context: internal/block Branch Context: block_json

We will be converting a Block to a JSONBlock. A JSONBlock is a struct ) than can be easily marshaled into a JSON by the json.Marshal function.

Create a Marshal pointer receiver function for an Aurum block. The function should return a the struct created above. Numerical values and string to do not have to be changed, but any byte slices must be hex encoded into strings.

The whole point is to turn the Block struct into a struct that can be easily marshaled into a JSON. The unit test TestMarshal (in block_test.go) must pass.

Resources: https://www.json.org/ https://en.wikipedia.org/wiki/Marshalling_(computer_science)

kastolars commented 4 years ago

Completed