-3

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

Falko
  • 17,076
  • 13
  • 60
  • 105
learner
  • 1
  • 4

1 Answers1

0

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.

Yserbius
  • 1,375
  • 12
  • 18
  • Thank you Yserbius. My doubts is , I always store the above data to a variable called "studentMarks". so get the student's latest mark , should i take the last block always . Right? also If i want to reduce 100 marks from 300 . I must create anew block and save it to "studentMarks". Right – learner Feb 18 '18 at 08:18
  • Sounds about right. Are you following a tutorial? What is uour code based on? – Yserbius Feb 18 '18 at 17:53