【发布时间】:2021-07-06 13:06:06
【问题描述】:
我有一个关于org.hyperledger.fabric.shim.ChaincodeStub.delState(String key) 如何影响分类帐的具体问题。
我知道区块链上的数据几乎永远不会被删除,但是根据文档here,有一个delState方法,
Records the specified key to be deleted in the writeset of the transaction proposal.
The key and its value will be deleted from the ledger when the transaction is validated and successfully committed.
据我了解,账本有两个组成部分——区块链和世界状态。这个操作对这两个组件有什么影响?
【问题讨论】:
-
对应key的State值被擦除,记录留在区块链上。
-
例如,如果你在
user_myeongkil键中插入一个100的状态值,然后执行DelState,那么user_myeongkil中的no value是user_myeongkil键中的StateDB保留最新值。在blockchain(数据结构)中,user_myeongkil中包含100值的记录和user_myeongkil的值已被删除的记录被链接到块。 -
@myeongkilkim 在这种情况下是否仍然可以读取区块链文件并检索与该密钥相关的任何信息?
-
是的。如果单独看结果,输入(key, data)的记录和删除(key, data)的记录仍然存在,最新状态值为none。