0

I want to do simple blockchain implementation on golang, i have mongodb database with user info (Name, cardID, etc.) i want to store several information inside blockchain, and to put it inside another database BoltDB. But idk how to make this data immutable I mean how to make changes visible, for example I insert one user with (Name: Jhon, CardId: '777845') inside blockchain and after some time another guy will change this User's fileds (Name: 'Jhon', CardId: '1111'), and inside my blockchain it still will be (Name: Jhon, CardId: '777845')

  • A blockchain's data is immutable by definition. What are you trying to do that's not working? – Raghav Sood Aug 23 '18 at 6:59
  • I have one database (MongoDb) from that db I am fetching New coming users, and store it 'in a blockchain' another DB (BoltDb) -> i did it exactly like here github.com/Jeiwan/blockchain_go, my issue is it possible to check for changes in mongodb. if someone will change data inside MongoDb, but i have already stored this data inside my second db, i want to see what have changed – CreatingDED Aug 23 '18 at 7:10
  • A blockchain has nothing to do with mongodb. As long as your data is in the chain, it is not possible to retroactively edit it. You can add new blocks with other data, but the existing blocks are immutable. You should be able to compare the data in existing blocks with the data in your mongodb to check if it has changed – Raghav Sood Aug 23 '18 at 7:17
0

A blockchain is not intrinsically immutable. What prevents malicious people propagating altered data in the blockchain is that all nodes validate received blocks.

In particular they check the checksums and they check the signatures match the public keys. They check the references (hashes of prior blocks) and they examine the length of competing branches to decide which blocks to trust.

The integrity depends on there being a large number of nodes with no central trusted authority and with no one person or organisation controlling a majority of the computing power.

If you only have a handful of nodes, the blockchain may not be inherently trustworthy.

  • so to validate if changes happend i have to iteratete through each block inside blockchain and calculate hash again? – CreatingDED Aug 23 '18 at 10:10
  • @CreatingDED: Essentially yes. You can cache stuff locally and securely for later reuse. – RedGrittyBrick Aug 23 '18 at 10:12
  • @CreatingDED That is not the only way to do it, but that is one way to do it. You want, somehow, to arrange it such that every machine relying on the data to be immutable verifies that every proposed change to the data is permitted by the system's rules such that no honest node that correctly executes the system's rules itself can ever be tricked into accepting data that is not valid according to the system's rules. – David Schwartz Aug 24 '18 at 23:23

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