Dear Community,
Just a heads-up—Ankr has discontinued their public RPCs. To ensure a smooth experience, we’ve partnered with Infura to provide an approach that abstracts away the entire chain configuration and seamlessly leverages Infura’s API under the hood with Web3Auth SDK.
Required Action
Please update your SDK to the latest version (v9.7.0 or higher) and use the following snippet as a drop-in replacement:
import { WEB3AUTH_NETWORK, getEvmChainConfig } from "@web3auth/base";
// Get custom chain configs for your chain from https://web3auth.io/docs/connect-blockchain
const clientId = "" // Your Web3Auth client ID
const chainConfig = getEvmChainConfig(0xaa36a7, clientId)!;
const privateKeyProvider = new EthereumPrivateKeyProvider({
config: {
chainConfig,
},
});
We’re merging these updates to our examples repository as well.
Important Reminder
As a reminder, please avoid relying on public RPCs in production, as they can be shut down at any time (refer to our documentation at Connecting Blockchains with Web3Auth | Documentation | Web3Auth for best practices).
If you encounter any issues or have questions about implementing these changes, please respond in this thread.
Thank you for your understanding.
2 Likes
hey, @maharshi
I updated Web3Auth to version 9.7.0 and changed my chainConfig
by using getEvmChainConfig(0xaa36a7)
. However, I am now encountering the following error when initializing Web3Auth:
‘Error initializing Web3Auth:’, { [Error: JSON Parse error: Unexpected character: <]
cause:
{ stack: ‘Stack trace is not available.’,
message: ‘JSON Parse error: Unexpected character: <’ },
code: -32603,
data:
{ cause:
{ stack: ‘Stack trace is not available.’,
message: ‘JSON Parse error: Unexpected character: <’ } } }
const chainConfig = getEvmChainConfig(0xaa36a7)!;
const initWeb3Auth = async () => {
try {
const ethereumPrivateKeyProviderInstance = new EthereumPrivateKeyProvider(
{
config: {
chainConfig,
},
},
);
const web3authInstance = new Web3Auth(WebBrowser, EncryptedStorage, {
clientId: web3AuthConfig.clientId,
redirectUrl,
network: web3AuthConfig.network,
loginConfig: { ...
},
},
});
await web3authInstance.init();
if (web3authInstance.privKey) {
await ethereumPrivateKeyProviderInstance.setupProvider(
web3authInstance.privKey,
);
setProvider(ethereumPrivateKeyProviderInstance);
}
setEthereumPrivateKeyProvider(ethereumPrivateKeyProviderInstance);
setWeb3Auth(web3authInstance);
} catch (error) {
console.error('Error initializing Web3Auth:', error);
}
};
type or paste code here
1 Like
Hey @develop
Can you please pass the Web3Auth client ID along with the chain ID?
const clientId = "" // Your Web3Auth client ID
const chainConfig = getEvmChainConfig(0xaa36a7, clientId)!;
at first…
i think, need to clientId in getEvmChainConfig function

1 Like
I needed to add the clientId
like this. After doing that, it worked fine:
getEvmChainConfig(0xaa36a7, clientId)!
2 Likes
Yes, previously we did not have a check for it, now we have a validation in place. I am in talks with the engg team to get the parameter to be marked mandatory for no confusion.
Got it. Thank you for your quick response
1 Like