1

I'm trying to create a custom RPC node, but first I want to understand what's in a metamask request from an RPC node. From the following api call below using CURL, we can see that you need to pass in an API key into infura.io, but how does metamask do it where it doesn't need an API key in the chrome extenstion?

Metamask uses: https://mainnet.infura.io/v3/ in the settings. But it doesn't require a api key. How is it bypassing this?

https://piyopiyo.medium.com/how-to-get-ethereum-balance-with-json-rpc-api-provided-by-infura-io-6e5d22d25927

curl -i -X POST \
-H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","method":"eth_getBalance","params":["0xF02c1c8e6114b1Dbe8937a39260b5b0a374432bB","latest"],"id":1}' \
"https://mainnet.infura.io/YOUR_API_KEY"

1 Answer 1

3

MetaMask also uses the ProjectID for Infura URL, it just doesn't display it in network settings. How to check it:

  • open the Metamask extension in a tab: by clicking on "Expand view" in menu under 3dots.
  • open Fiddler2 traffic monitor
  • refresh the metamask tab
  • you will see the actual infura URL metamask communicates with (it includes the project ID)

  • open developer tools in metamask tab
  • refresh the page
  • open the text search over the resources, or CTRL+SHIFT+F
  • paste the project ID into the search you copied from infuras URL in Fiddler
  • you will see the ProjectID is hardcoded in common-3.js (as for now)
2
  • is there a free version just as good as fiddler network monitor? Mar 1, 2023 at 19:44
  • Fiddler Classic is free (windows). For Mac CharlesProxy is good.
    – tenbits
    Mar 1, 2023 at 20:47

Your Answer

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

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