Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
Trivo25 committed May 15, 2024
1 parent 6b80c05 commit 2ea2a91
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion docs/zkapps/o1js/offchain-storage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ All offchain state resides within a single Merkle Map, which is essentially a wr

Under this framework, [Actions and Reducer](zkapps/o1js/actions-and-reducer.mdx) are utilized to manage state changes, with actions dispatching state updates and reducers settling them. Additionally, a Merkle Tree is employed to maintain a provably secure commitment to the data, with the root stored on-chain.

Before users can access published state, it must first undergo settlement.
Prior to users accessing published state, it must first undergo settlement. Thanks to the design of Offchain storage, all state is recoverable from actions alone, eliminating the need for additional events or external data storage.

## Utilizing Offchain Storage

Expand Down Expand Up @@ -113,6 +113,8 @@ class MyContract extends SmartContract {
}
```

**It is important to mention that state is only available after it was settled via `settle()`!**

### Utilizing Offchain Storage

Now developers can utilize Offchain storage in any of their smart contract methods, as demonstrated below:
Expand All @@ -130,3 +132,5 @@ class MyContract extends SmartContract {
}
}
```

Currently, Offchain storage types of Field support `field.get()` and `field.set(newValue)`, while maps support `map.get(key)` and `map.set(key, newValue)`.

0 comments on commit 2ea2a91

Please sign in to comment.