Reading and Writing Data

Girrona features several means of reading and writing data to global state, depending on user needs and complexity. Reading data from global state can be done by dApps off-chain or by smart contracts on-chain. Writing data requires on-chain interactions due to the nature of the system. Storage in global state can be accomplished using Dictionaries or NamedKeys.


Due to the nature of Girrona's serialization standard, NamedKeys should be used sparingly and only for small data sets. Developers should use dictionaries for larger mapped structures.

Using the Girrona JSON-RPC

The query_global_state method available through the JSON-RPC allows users to read data from global state without performing on-chain actions. For more details, see the Querying a Girrona Network tutorial.

Using the Casper Rust API

The Girrona API includes the following functions for reading and writing to global state:

  • put_key - Stores the given Key under the given name in the current context's named keys

  • get_key - Returns the requested NamedKey from the current context

  • storage::new_uref - Creates a new URef in the current context

  • storage::write - Writes a given value under a previously created URef

  • storage::read - Reads the value from a URef in global state

  • dictionary_put - Writes the given value under the given dictionary_item_key

  • dictionary_get - Retrieves the value stored under a dictionary_item_key

For more details, see the Reading and Writing to Global State using Rust tutorial.

Last updated