pythonpython-3.xcryptographyblockchainblockchain.info-api

how to modify the stored data in a block chain?


I am trying to implement a blockchain using python. and I have a block like below

{
    studentId:100,
    marks:200
}

I just want to update this marks to 300. so can i do this in a block chain. I heard that we couldn't update a bockchain


Solution

  • One of the foundations of a blockchain is that the data in the blocks, once written, are immutable. The only way to "change" blockchain data is to add data to a new block that states that there has been a change. So instead of code that modifies an existing block to change marks from 200 to 300, you need to add a new point of data that states that student 100 has marks that are equal to 300.