Is there a way to filter ethereum json-rpc methods to only allow read calls, not writing? ie, filter out
If you want to do it inside the node, you will need to override some of frontiers RPC handlers. For example, you can see the
EthApi implementation here:https://github.com/paritytech/frontier/blob/master/client/rpc/src/eth.rs. You could proceed in either of two ways:
- Copy this code and change some methods eg
sendRawTransactionto behave as you like.
- Write your own struct that wraps the one I linked. For methods you want to enable, you can call into the wrapped original. And for methods you want to block, you can just return immediately with no action or error.