Hash
The Hash envelope allows storing a document hash on the blockchain. It does not store the document.
By storing the document hash, a user can implement file tampering prevention, allowing other users to be able to validate that the document contents are equal to the original.
Creating a new Hash envelope to be stored on chain, can be achieved by adding a specific output object of type hash and add it to the createTransaction outputs argument.
This output type requires the following properties:
Property | Type | Description |
data (required) | Uint8Array | Raw file contents. Used to generate the hash. Not stored on chain. |
algorithm (required) | String | Hashing algorithm. It can be either 'SHA-256' or 'SHA-512'. |
sign (optional) | Boolean | Specify true if the envelope is going to be signed. If this is the case, a signing key needs to be specified. See: key property below. |
encrypt(optional) | Boolean | Specify true if the envelope is going to be encrypted. If this is the case, an encryption key needs to be specified. See: key property below. |
key (required only if encrypt or signis true) | String | JWK | ES256 Public key of the receiver, either as JWK or as uncompressed hex string |
metadata(optional) | Object | Any extra information to store within mintBlue. Not stored on chain. |
The following OP_RETURN arguments are created when a Hash envelope is published on a Blockchain transaction.
Index | Description | Value |
0 | Protocol ID | "hash" |
1 | Envelope | Serialized JWE/JWS |
2 | Receiver key | Public key of the receiver |
๏ปฟ