0

I encountered a issue that eth_getProof returns wrong storage key and proof. This is a bash script which could reproduce the issue. And after some tests, I found increasing the interval between thoes requests will be helpful to reduce the number of the appearance of the issue.

API_KEY="Your Alchemy Api Key"
# response0_0 and response0_1 have same parameters, while response1_0 has a different parameter.
# Api eth_getProof should return two different result for response0_1 and response1_0, but it didn't in fact.
response0_0=$(curl https://eth-goerli.g.alchemy.com/v2/$API_KEY -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"eth_getProof","params":["0x449337bbe404cae0ba82f3451661af7481f37aac",["0x0000000000000000000000000000000000000000000000000000000000000000"],"0x7af32e"],"id":1}' 2>/dev/null)
response0_1=$(curl https://eth-goerli.g.alchemy.com/v2/$API_KEY -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"eth_getProof","params":["0x449337bbe404cae0ba82f3451661af7481f37aac",["0x0000000000000000000000000000000000000000000000000000000000000000"],"0x7af32e"],"id":1}' 2>/dev/null)
response1_0=$(curl https://eth-goerli.g.alchemy.com/v2/$API_KEY -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"eth_getProof","params":["0x449337bbe404cae0ba82f3451661af7481f37aac",["0x0000000000000000000000000000000000000000000000000000000000000001"],"0x7af32e"],"id":1}' 2>/dev/null)

if [[ "$response1_0" == "$response0_1" ]]; then
  echo "reponse1_0 should not equal to response0_1"
fi

1 Answer 1

0

It looks like you're trying to use the eth_getProof method from the Ethereum JSON-RPC API to retrieve storage proofs for a contract on the Goerli Ethereum testnet. The eth_getProof method returns a Merkle proof that can be used to verify the inclusion of a key-value pair in the contract's storage.

The issue you're encountering is that the eth_getProof method is returning the same result for two different requests with different storage keys. This is likely a bug in the implementation of the eth_getProof method on the Goerli Ethereum testnet.

To resolve this issue, you could try using a different Ethereum testnet or a different JSON-RPC API endpoint that provides the eth_getProof method. Alternatively, you could try using a different method from the Ethereum JSON-RPC API to retrieve storage proofs for your contract, such as eth_storageAt.

It's also worth noting that storage proofs are not supported on all Ethereum networks and may not be available on all JSON-RPC API endpoints. If you're unable to find a suitable solution for your use case, you may need to consider using a different approach for verifying the inclusion of key-value pairs in a contract's storage.

1
  • Thanks for your advice. This issue is so weird that I think other people may encounter likewise. Dec 5, 2022 at 0:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.