Split hash functions to hash.h, add tx metadata hash