> For the complete documentation index, see [llms.txt](https://lasper-blockchain.gitbook.io/girrona-blockchain/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lasper-blockchain.gitbook.io/girrona-blockchain/design/reading-and-writing-data.md).

# 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`.

NOTE

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[​](https://docs.casper.network/concepts/design/reading-and-writing-to-the-blockchain/#using-the-casper-json-rpc) <a href="#using-the-casper-json-rpc" id="using-the-casper-json-rpc"></a>

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[​](https://docs.casper.network/concepts/design/reading-and-writing-to-the-blockchain/#using-the-casper-rust-api) <a href="#using-the-casper-rust-api" id="using-the-casper-rust-api"></a>

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.
