question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom RPC return wrong chainId.

See original GitHub issue

Trying to connect to custom RPC returns wrong chainId. I am calling the following method:

const provider = new WalletConnectProvider({
      bridge,
      qrcode,
      infuraId,
      rpc,
      chainId,
      qrcodeModalOptions
    });

with params:

bridge: "https://bridge.walletconnect.org"
chainId: 43113
infuraId: "INFURA_ID"
qrcode: true
qrcodeModalOptions: undefined
rpc: {43113: "https://api.avax-test.network/ext/bc/C/rpc"}

and the returned chainId in the provider is 1 (Mainnet). Any suggestions how to connect? This is not happening with other networks, just the Avalanche.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
avadexcommented, Jun 12, 2021

any news on this?

can confirm. happens on android wallet. with metamask, alphawallet, tokenpocket

2reactions
ochikovcommented, Jul 1, 2021

Wallets always control the chainId. The RPC map only exists to route requests that are not for signing. Please prompt users to change the chain on their wallet

If they change it, again the chainId written in the provider is wrong and no kind of transactions can be made.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom RPC incorrectly inserts chainId(4-rinkeby ... - GitHub
Describe the bug To Reproduce Steps to reproduce the behavior: Set Custom RPC URL to https://api.myetherwallet.com/eth Add some extra custom ...
Read more >
How to fix MetaMask - RPC Error: Expected 0x-prefixed ...
Fixing error thrown when adding a custom network to MetaMask. ... Expected 0x-prefixed, unpadded, non-zero hexadecimal string 'chainId'.
Read more >
The endpoint returned a different chain ID: 0x539 (Ganache)
I am trying to connect Metamask to ganache by creating a custom RPC with the following details: New RPC URL ...
Read more >
Automatically adding a blockchain to Metamask with Javascript
FUSE blockchain details const chainId = '0x7a'; const rpcURL ... MetaMask - RPC Error: Chain ID returned by RPC URL does not match....
Read more >
ChainID - Could not fetch chain ID. Is your RPC URL correct?
Network name: Binance Smart Chain New RPC URL: https://bsc-dataseed1.binance.org:443 ChainID: 56 Symbol: BNB Block Explorer: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found