Transaction: add fromObj() method

Converts from a user-friendly, textual JSON representation
to the internal, binary representation.

Copied from cosign.