How to make data inside blockchain immutable

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')

CreatingDED

Posted 2018-08-23T06:57:25.000

Reputation: 3

Question was closed 2018-09-12T15:45:56.340

A blockchain's data is immutable by definition. What are you trying to do that's not working?Raghav Sood 2018-08-23T06:59:58.480

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 https://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 2018-08-23T07:10:02.083

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 changedRaghav Sood 2018-08-23T07:17:16.527

Answers

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.

RedGrittyBrick

Posted 2018-08-23T06:57:25.000

Reputation: 4 815

so to validate if changes happend i have to iteratete through each block inside blockchain and calculate hash again?CreatingDED 2018-08-23T10:10:41.627

@CreatingDED: Essentially yes. You can cache stuff locally and securely for later reuse.RedGrittyBrick 2018-08-23T10:12:45.300

@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 2018-08-24T23:23:54.087