Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Runtime API to create a proof of a leaf of a child storage trie up to the child trie root #3439

Open
vimukthi-git opened this issue Aug 19, 2019 · 1 comment
Labels
J0-enhancement An additional feature request.

Comments

@vimukthi-git
Copy link

In centrifuge chain we store our data in child storage for a given date. Eg:

set_child_storage(aGivenDate, id, val)

Then someone would ask the chain for a proof of the val up to the root of the child trie. A user of the chain would store this proof to later prove that the val existed on chain at a certain time.

// this function doesn't exist at https://substrate.dev/rustdocs/v1.0/sr_io/index.html
// a user of the chain would store this proof to later prove that the `val` existed on chain at a certain time
proof = child_storage_proof(aGivenDate, id)

Then we would like to delete the items in the storage after a given period, say 1 month, while storing the root of the child trie on chain for proving existence of data at a later time.

// store this root onchain
root = child_storage_root(aGivenDate) 
// delete data
clear_child_storage(aGivenDate)

Would it be possible to expose the child_storage_proof(aGivenDate, id) api in sr_io?

cc @thiolliere @cheme

@rphmeier rphmeier added the J0-enhancement An additional feature request. label Aug 19, 2019
@rphmeier
Copy link
Contributor

rphmeier commented Aug 19, 2019

Child-trie state proofs would be generally useful, with broad applications for moving data off-chain especially when combined with APIs for off-chain workers to maintain that data & submit proofs back to chain for sections needed for some computation, although that would be a stretch goal.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
J0-enhancement An additional feature request.
Projects
None yet
Development

No branches or pull requests

2 participants