Is it possible for DApps to write 'updatable' data onto a blockchain ?

eric22eric22 Member Posts: 12
hi, i'm creating a DApp and have a question about ethereums blockchain(s) - my DApp uses data that doesn't need to be stored forever, is it possible for DApps to write 'updatable' data onto a blockchain ? it seems to me that it would work in theory, that it doesn't conflict with proof of work, as long as only some data is classified as 'updatable'

the DApp is similar to a peer-2-peer-lending-DApp.

smart-contract example:
node A writes a contract with node B to lend 100XYZ. node B repays 40XYZ. this decreases the debt to 60XYZ. time passes. node B repays the rest. the contract deletes itself and all data.
Post edited by eric22 on

Comments

  • eric22eric22 Member Posts: 12
    question answered in another channel:

    Indeed this is easy. Contracts keep data in a key:value storage which is only writable by that contract so deleting the value associated (or, usually, rewriting a value to default of 0x0) for a key is very simple.
  • vaXvaX Austin, TXMember Posts: 78 ✭✭✭
    eric22 said:

    the contract deletes itself and all data.

    Before the contract deletes itself, how about having it generate some reputation data based upon how 'node_b' repaid the loan. That behavioral history has value.
  • VraminVramin Member Posts: 10
    I recently heard a description of the block chain (paraphrasing here) as a database that anyone can write to but no one can delete from. If it's a true ledger (like Bitcoin's blockchain) than shouldn't there always be a transaction to show that the value was moved from one contract to another versus the data and/or contract being changed or deleted? You should be able to replay the chain from genesis and get to the same end state.

    Asking purely out of curiosity, I'm too new to this to have a real position on it... just trying to clarify my understanding.
  • SmithgiftSmithgift Member Posts: 64
    @Vramin: You are essentially correct. When people colloquially say that a contract is deleted (suicide), it just means that in the latest block, that contract no longer exists. All of its previous transactions are still in the past blocks.
Sign In or Register to comment.