From 8abe7af88ffad8815db436e12f13cdbc9dd45f60 Mon Sep 17 00:00:00 2001 From: Mudassir Shabbir Date: Wed, 4 Dec 2024 13:56:49 +0500 Subject: [PATCH 1/2] feat: add VStorage as readonly query --- main/guides/getting-started/contract-rpc.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/main/guides/getting-started/contract-rpc.md b/main/guides/getting-started/contract-rpc.md index 1dc7bd3e4..6736b456b 100644 --- a/main/guides/getting-started/contract-rpc.md +++ b/main/guides/getting-started/contract-rpc.md @@ -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 From 7f50eb6436a8b10a7da3923a480678990b29fd41 Mon Sep 17 00:00:00 2001 From: Mudassir Shabbir Date: Fri, 13 Dec 2024 10:48:40 +0500 Subject: [PATCH 2/2] chore: update based on comments --- main/guides/getting-started/contract-rpc.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/guides/getting-started/contract-rpc.md b/main/guides/getting-started/contract-rpc.md index 6736b456b..6406d21e2 100644 --- a/main/guides/getting-started/contract-rpc.md +++ b/main/guides/getting-started/contract-rpc.md @@ -49,8 +49,8 @@ message MsgWalletSpendAction { ::: 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. +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