Let's use the following strategy for calculating the metadata hash:
- Get the contents of the file at the metadata URI
- Parse them as a JSON file, and throw if it's invalid
- Extract the following keys into a new object: name, version, description, homepage (in that order)
- JSON-stringify the object above, respecting the order (make sure to preserve order if node's default doesn't do it yet)
- Calculate the sha256 of it (make sure that Solidity's sha256 yields the same result)