OriginTrail / ot-node

OriginTrail Decentralized Knowledge Graph network node
https://origintrail.io
Apache License 2.0
206 stars 74 forks source link

How can validation the data after push to Blockchain with Fingerprint or Block number #97

Closed nbxtruong closed 6 years ago

nbxtruong commented 6 years ago

With your help. I can import XML data to Supply Chains test network. All my data from "example_gs1.xml" success import to ArangoDB and writing Fingerprint of this data to blockchain. So, How can I validation the data I imported to Blockchain with Fingerprint or Block number.

This is my first scenario: 1/ I Import data to Supply Chainins, everything success. I have Fingerprint and Block number for this data. 2/ After two years, I have the XML file contain this data from step 1, I need to validation this data from XML file still original or modified.

This is my second scenario: 1/ I setup the Supply Chains network with 5 node (node is the PC runs on many different networks). 2/ From each node I import the data for specific products (Egg or carrot) but different time. 3/ How can I get the "Chains" for specific products (Egg or carrot) from Supply Chains and validation my XML file with this data.

So how can I do that?

Thank you.

schrink commented 6 years ago

Hi,

regarding question 1, we are dealing with a slightly different scenario here. Our scenario is that you upload XML data. Once it is uploaded, it gets imported into ArangoDB and it gets replicated to several other nodes. In two years you ask for the data and some of the nodes sends it back. We provide mechanism so that what you receive back is also hashed and compared to fingerprint from two years ago, so you know for sure that who was holding the data didn't changed it and it is the same data.

Then you can export it to XML if you like, and it should be exactly the same XML. So this is the aim of our protocol and what we provide.

However, you can easily achieve what you described as well. Same input should always produce the same root hash and same fingerprint. You may create a dApp that will compare new import hash with the old one.

Regarding scenario 2, this is exactly what we are solving. You will ask a network to give you specific product, for example by some identifier (like ID, or barcode) and it should return you all the data available for that product - the trail for that product, regardless where exactly is the data. We are developing an API that will provide range of queries.

You may be interested to checkout our pilot from January 2018 http://yimi-pilot.origintrail.io/ that showcases this process.

nbxtruong commented 6 years ago

Thank you @schrink

1/ For question one, How can I get the Fingerprint. The node did not response to client after I imported XML files. 2/ Let's say I got that Fingerprint. So I need to save that Fingerprint to other database, for compare in the future? 3/ Let's say I have that Fingerprint since two year ago. It storaged in other database that I created (MongoDB). So, I have to import new XML once again (for validation) to get Fingerprint, and compare that Fingerprint with the Fingerprint two year ago? Is that true? or Do you have any better way than my way?

If I want to go the way like http://yimi-pilot.origintrail.io/, Do you have the API for that (even if It is demo only)? This website has everything I need. But, I do not know to do.

schrink commented 6 years ago

This will be ready for TestNet launch and we are preparing API documentation. Stay tuned and please reopen if you find more difficulties.