0

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.

0

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.

2
  • Thanks a lot for your answer. Could you answer me one more question please? As I mentioned in this post, when user try to store data into blockchain, how can I notify and reject to store his data in blockchain if that data already exists in blockchain ? Is it possible? Oct 19 '20 at 18:00
  • @MayThanzin It depends on the storage solution you choose. It is easy if you use a smart contract, you can use a mapping to index stored your data, if it already exists you can reject any change, or require some permissions in order to modify it.
    – Ismael
    Oct 19 '20 at 20:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.