GIRRONA BLOCKCHAIN
  • Introducing Girrona Blockchain
    • How does Girrona work?
  • Concept Of Girrona
    • Intro. to Dapps
    • ACCOUNTS & Keys
    • Hash Types
    • Deploys and the Deploy Lifecycle
    • Global State
    • Smart Contracts
    • Call Stacks
    • Contracts and Session Code
  • DESIGN
    • Overview
    • Network Design
    • Network Communication
    • Highway Consensus
    • Reading and Writing Data
  • Economics
    • Overview of Girrona Economics
    • Consensus Economics
    • Runtime Economic
    • Gas & Resources
  • Staking
    • Staking Concept
    • Staking vs Delegating
    • Delegation Details
  • TOKENOMICS
    • Girrona Tokenomics
    • Road Map
  • GIRRONA LIQUIDITY LOCKER
    • Introducing Girrona Liquidity Locker
  • ABOUT US
    • COMMUNITY
Powered by GitBook
On this page
  • Using the Girrona JSON-RPC​
  • Using the Casper Rust API​
  1. DESIGN

Reading and Writing Data

PreviousHighway ConsensusNextOverview of Girrona Economics

Last updated 1 year ago

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

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.

​
​