JoshOrndorff / recipes

A Hands-On Cookbook for Aspiring Blockchain Chefs
GNU General Public License v3.0
376 stars 186 forks source link

Write a recipe on using off-chain indexing #398

Open jimmychu0807 opened 3 years ago

jimmychu0807 commented 3 years ago

Either create a recipe of this, or write a guide in the Runtime section of developer guide.

Extracted notes from @tomusdrw:

To use indexing data from Runtime:

sp_io::offchain_index::set(&b"my_key", &"my_value".encode());

Data in Off-chain DB can be either read by Off-chain workers (local storage API) or via RPC, using offchain_localStorageGet method.