Skip to content

Latest commit

 

History

History
113 lines (84 loc) · 4.01 KB

File metadata and controls

113 lines (84 loc) · 4.01 KB

ProductTimestamp

Current Version: 0.2.0

Changelog

0.2.0

  • Draft of ProductTimestamp based on ArticleTimestamp 0.2.0.

Creating the hash

The hash that is put into the blockchain is generated by hashing a JSON object containing properties and attributes. Currently, the hashing algorithm used is SHA-256.

{
  "type": "ProductTimestamp",
  "version": "0.2",
  "name": "My Blog Title",
  "description": "Lorem Ipsum",
  "date": "2019-07-08T08:38:23+0000"  
}

The SHA-256 hash of the minified JSON example is 647d99fe02f7e044054e3878d7a47e96c16c3e8ec6b81728762587870b2b36c3. This hash needs to be posted to the blockchain. The transaction id of the transaction that is included in the blockchain, which contains this hash, needs to be saved together with the used properties and attributes.

Properties

Properties are required fields for every ProductTimestamp.

type - Text, The type used, in this case ProductTimestamp

version - Text, The version of the type used, in this case 0.2.0

name - Text, Name of the product

description - Text, The product description

date - String, ISO 8601, the last date of the item being modified in the source before timestamping it

Attributes

Attributes can be included, but are optional. Only items included in the standard can be added to the JSON object, in alphabetical order, after the last property. If the value of an attribute is empty, it should not be included in the object.

productId - The product identifier, such as ISBN. For example: isbn:123-456-789.

image - Text, Image URL

previousVersion - Text, SHA256. The hash of the previous version of the current post.

price - Text

url - Text

Including into DOM

It should be clear how and what data was used when generating the hash. We are using JSON-LD to declare the variables that were used for creating the JSON object and include our generated hash and information of the blockchain which contains this hash.

With the included information in the JSON-LD object, third-parties can compare their and your results themselves.

A ProductTimestamp can contain other objects of the same type, which are referred to as revisions. The parent object always contains information about the most recent version of the product.

<script type="application/ld+json">
{
  "@context": {
    "@type": "ProductTimestamp",
    "@version": "0.2"
  },
  "blockchain": "eos",
  "transactionId": "77ac208d9a01d0cf40345786da28accd2795f5a6a6cf3692168a2a71ca165708",
  "hash": "8A258E516081C36B866812E49495628CBDC1DD4126DB321A28AE95EE55B83BAB",
  "name": "My Blog Title",
  "description": "Lorem Ipsum dolor sit amet",
  "date": "2019-07-08T08:38:23+0000",
  "previousVersion": "2DAD3812C721EF4A21541CCF1DB7C54BA1643294162B038ACDE8CF1CE7DA511B",
  "revisions": [
    {
      "@context": {
        "@type": "ProductTimestamp",
        "@version": "0.2.0"
      },
      "blockchain": "eos",
      "transactionId": "a4ce94cc4c0adda8075ac133b4de884a282e3de4ee1734d808a2e9737e06f5a1",
      "hash": "2DAD3812C721EF4A21541CCF1DB7C54BA1643294162B038ACDE8CF1CE7DA511B",
      "name": "My Blog Title",
      "description": "Lorem Ipsum",
      "date": "2019-07-08T08:38:23+0000",
      "previousVersion": "3BD952F0459160463C502C86DA7ABD80A857207F8A1ED2D3B7A38B438CA0D071"
    },
    {
      "@context": {
        "@type": "ProductTimestamp",
        "@version": "0.2.0"
      },
      "blockchain": "eos",
      "transactionId": "b5832cb36421e0c2a49e4250b906021b340c07e24ce4c22156cf7d7cbf9a1254",
      "hash": "3BD952F0459160463C502C86DA7ABD80A857207F8A1ED2D3B7A38B438CA0D071",
      "name": "My Blog Title",
      "description": "Lorem",
      "date": "2019-07-08T08:38:23+0000",
    }
  ]
}
</script>

Including to blockchain

The implementation will differ per blockchain. Please include the following fields.

hash - String, SHA-256 hash of the product previousTransactionId - Optional, String - Blockchain Transaction Id with hash of the previous revision.

Optionally you can include a memo including an url to enhance the user experience.