Comparing files

Learn how to compare files, to verify the authenticity of the files.

🚧

Prerequisites

You need to have at least added a file before continuing.

One of the biggest features of Keeper is its capacity to verify the authenticity of a file. After adding a file, you can easily compare a local file to the one on the blockchain. Keeper will give you the accuracy of the match and also the difference between the local file and the file on the blockchain.

In Keeper, there are three ways to compare files:

  • Compare a file to the latest version of a file stored in the blockchain
  • Compare a file to the original version of a file stored in the blockchain
  • Compare a file to a specific version of a file stored in the blockchain

When you do a comparison, you can also generate a difference file, which will have all the difference between the files of the comparison. The file will have the following content:

Color

Meaning

Red text

  • The content is different

Yellow text

  • The content is the same, but it is not in the same position

🚧

Requirements

You need your API key to perform the actions on this page.
You also need the Keeper Admin Role.


Comparing files

Compare a file by performing a standard POST call with your API key in the header. Your API key must be valid for this to work. If you don't have an API key, follow this short tutorial to get one.

When you compare a file, you can specify if you want to generate a file which contains the difference between the two files. This can be done by setting the parameter generateDiffFile to true.

Compare a file to the latest version of a file stored in the blockchain

Most of the time, you would want to compare a file to the latest version of the file stored on the blockchain.

Let's try it out!

curl -X POST \
  http://api.mantleblockchain.com/keeper/{{PRODUCT_ID}}/files/{{FILE_ID}}/compare/latest \
  -H 'Accept: text/plain, application/json, text/json' \
  -H 'Content-Type: multipart/form-data' \
  -H 'x-api-key: {{API_KEY}}' \
  -F 'file={{FILE_TO_COMPARE}}' \
  -F 'generateDiffFile={{GENERATE_DIFF_FILE}}'

Replace the following parameters:

{{PRODUCT_ID}}: Your Product id
{{FILE_ID}}: The ID of the file on the blockchain that you want to compare its the latest version
{{API_KEY}}: The API key of the person signing the contract
{{FILE_TO_COMPARE}}: The file you want to use for the comparison
{{GENERATE_DIFF_FILE}}: A boolean to specify if you want to generate a file with the difference between the two files

👍

Congratulations!

You've compared a file to a latest version of the original file stored on the blockchain in Keeper!

Compare a file to the original version of a file stored in the blockchain

Sometimes, you may want to compare a file to the original version of the file stored on the blockchain.

Let's try it out!

curl -X POST \
  http://api.mantleblockchain.com/keeper/{{PRODUCT_ID}}/files/{{FILE_ID}}/compare/original \
  -H 'Accept: text/plain, application/json, text/json' \
  -H 'Content-Type: multipart/form-data' \
  -H 'x-api-key: {{API_KEY}}' \
  -F 'file={{FILE_TO_COMPARE}}' \
  -F 'generateDiffFile={{GENERATE_DIFF_FILE}}'

Replace the following parameters:

{{PRODUCT_ID}}: Your Product id
{{FILE_ID}}: The ID of the file on the blockchain that you want to compare its original version
{{API_KEY}}: The API key of the person signing the contract
{{FILE_TO_COMPARE}}: The file you want to use for the comparison
{{GENERATE_DIFF_FILE}}: A boolean to specify if you want to generate a file with the difference between the two files

👍

Congratulations!

You've compared a file to the original version of the original file stored on the blockchain in Keeper!

Compare a file to the specific version of a file stored in the blockchain

With Keeper, you can also compare a file to a specific version of the file stored on the blockchain.

Let's try it out!

curl -X POST \
  http://api.mantleblockchain.com/keeper/{{PRODUCT_ID}}/files/{{FILE_ID}}/versions/compare/{{VERSION_ID}} \
  -H 'Accept: text/plain, application/json, text/json' \
  -H 'Content-Type: multipart/form-data' \
  -H 'x-api-key: {{API_KEY}}' \
  -F 'file={{FILE_TO_COMPARE}}' \
  -F 'generateDiffFile={{GENERATE_DIFF_FILE}}'

Replace the following parameters:

{{PRODUCT_ID}}: Your Product id
{{FILE_ID}}: The ID of the file on the blockchain that you want to compare its version
{{VERSION_ID}}: The ID of the version of the file on the blockchain that you want to compare with
{{API_KEY}}: The API key of the person signing the contract
{{FILE_TO_COMPARE}}: The file you want to use for the comparison
{{GENERATE_DIFF_FILE}}: A boolean to specify if you want to generate a file with the difference between the two files

👍

Congratulations !

You've compared a file to a specific version of the original file stored on the blockchain in Keeper!