I'm trying to store user data ( name, national identity number, birthday,etc.) by converting all data into hash and store it in the input field of block in the Blockchain. But , the problem is that how can I know data I am trying to store is already existed in the blockchain cause I want to prevent data duplicate . I am running my blockchain on local private network using geth. By the way, is my data storing method okay or should I change to use smart contract for storing data.
It should be OK to use a transaction's input field to store data, but you will have some limitations:
- It is not indexed so data there cannot be easily queried. You can create and maintain an external index though.
- It is unmodifiable. Once a transaction is mined it cannot be modified.
One possible solution in Ethereum is to use a smart contract to store and query data.