I would like to read the state of a pallet using web3 clients (Metamask, Truffle). Let's suppose the pallet has exposed the function getValue()
.
I have not installed either EVM and Ethereum pallet because I don't need to be fully EVM compatible.
I was thinking about the following flow as a possible approach:
1
+------------------------+
| Web3 Client |
| (Metamask, Truffle) |
+------------------------+
|
2 v
+------------------------+
| Server implements |
| EVM JSON-RPC |
+------------------------+
|
3 v
+------------------------+
| RPC Substrate Client |
+------------------------+
|
4 v
+------------------------+
| Substrate Node |
+------------------------+
1. The Web3 client would perform the reading request. In this step, I would also need to implement the getValue()
function in Solidity so it could be called from the client, as it needs the ABI to perform the request.
2. The RPC Server would implement the endpoint, so the request would be redirected when getValue()
was instantiated.
3. The Substrate RPC client would connect to the Substrate node.
4. The Substrate node would return the result.
Does this approach make sense? Is there something similar that has already been implemented? Or is there any library that I could use?