Skip to content

Commit c2d1108

Browse files
authored
Merge pull request #1256 from Agoric/ms/vstorage-as-readonly-API
Adding a Box Describing VStorage as readonly Contract State Query
2 parents 537427b + 7f50eb6 commit c2d1108

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

main/guides/getting-started/contract-rpc.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,24 @@ message MsgWalletSpendAction {
4747

4848
## Querying VStorage
4949

50+
::: tip VStorage as Contract State Query Mechanism
51+
To expose contract state for query, where smart contracts on Ethereum and other chains use readonly
52+
or [view query methods](https://docs.soliditylang.org/en/latest/contracts.html#view-functions), Agoric smart contracts write to storage nodes so that
53+
clients can query them.
54+
55+
Smart contracts on the Agoric chain can write data to VStorage, which acts as a publicly accessible
56+
storage layer. This data is available for anyone to query, similar to the functionality of a getter
57+
API on other blockchains. It is cost-effective, meaning developers and users can fetch data
58+
from VStorage without incurring any extravagant fees.
59+
60+
For instace, if a smart contract manages educational records, it can publish any relevant information
61+
to VStorage through a `chainStorage` API, and anyone can query this data to verify the authenticity of
62+
the records. This approach is illustrated in the [dapp-ed-cert](https://github.com/agoric-labs/dapp-ed-cert).
63+
Agoric’s approach replaces direct readonly APIs with a public and cost-effective VStorage mechanism,
64+
enabling developers to create dynamic and responsive dApps while keeping the blockchain interactions
65+
efficient and economical.
66+
:::
67+
5068
[VStorage](https://github.com/Agoric/agoric-sdk/tree/master/golang/cosmos/x/vstorage#readme) (for "Virtual Storage") is a key-value store that is
5169
read-only for clients of the consensus layer.
5270
From within the JavaScript VM, it is accessed via a `chainStorage` API with a node at each

0 commit comments

Comments
 (0)