Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a Box Describing VStorage as readonly Contract State Query #1256

Merged
merged 2 commits into from
Dec 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions main/guides/getting-started/contract-rpc.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,24 @@ message MsgWalletSpendAction {

## Querying VStorage

::: tip VStorage as Contract State Query Mechanism
To expose contract state for query, where smart contracts on Ethereum and other chains use readonly
or [view query methods](https://docs.soliditylang.org/en/latest/contracts.html#view-functions), Agoric smart contracts write to storage nodes so that
clients can query them.

Smart contracts on the Agoric chain can write data to VStorage, which acts as a publicly accessible
storage layer. This data is available for anyone to query, similar to the functionality of a getter
API on other blockchains. It is cost-effective, meaning developers and users can fetch data
from VStorage without incurring any extravagant fees.

For instace, if a smart contract manages educational records, it can publish any relevant information
to VStorage through a `chainStorage` API, and anyone can query this data to verify the authenticity of
the records. This approach is illustrated in the [dapp-ed-cert](https://github.com/agoric-labs/dapp-ed-cert).
Agoric’s approach replaces direct readonly APIs with a public and cost-effective VStorage mechanism,
enabling developers to create dynamic and responsive dApps while keeping the blockchain interactions
efficient and economical.
:::

[VStorage](https://github.com/Agoric/agoric-sdk/tree/master/golang/cosmos/x/vstorage#readme) (for "Virtual Storage") is a key-value store that is
read-only for clients of the consensus layer.
From within the JavaScript VM, it is accessed via a `chainStorage` API with a node at each
Expand Down
Loading