> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dynamic.xyz/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Using RPC Providers

<Card title="Recommended: JavaScript SDK with React Hooks" icon="react" color="#4779FE">
  For new React apps, we recommend the JavaScript SDK with React Hooks (`@dynamic-labs-sdk/react-hooks`) instead of the legacy React SDK documented here. The JS SDK comes with many benefits such as a much smaller bundle size and other optimizations. Use the [React quickstart (JavaScript SDK)](/javascript/reference/react-quickstart) to get started.
</Card>

<Note>This guide is currently React only.</Note>

## Summary

You can access RPC providers via SDK utilities to make RPC calls to EVM and Solana, including convenience methods that do not require going through a wallet.

Each provider will use the RPC configured in the Dashboard if present,
otherwise they fall back to public RPCs urls. You can see the public URL by checking on the network in the dashboard.

## Dashboard Configuration

To enter your provider url for a given network:

1. Go to the [Chains & Networks](https://app.dynamic.xyz/dashboard/chains-and-networks) page in your Dashboard.
2. Click on the chain to open the details tab
3. Click the down down arrow to expand a network
4. Enter your Provider Url
5. Click the test button to check url

## Overriding RPC URLs in code

### EVM

You can override RPC URLs via SDK utilities and network override settings. See the SDK Tabs below for the specific API names and usage.

The following example demonstrates overriding RPC URLs for Ethereum mainnet and Polygon using SDK utilities within the corresponding SDK Tab.

```TypeScript theme={"system"}
const rpcUrlOverrides = {
    "1": ["https://eth.customrpc.com"],
    "137": ["https://polygon.customrpc.com"]
}

const App = () => (
  <DynamicContextProvider
    settings={{
      environmentId: 'REPLACE_WITH_YOUR_ENV_ID',
      overrides: {
        evmNetworks: (networks) => overrideNetworkRpcUrl(networks, rpcUrlOverrides),
      }
    }}
  >
    <Home />
  </DynamicContextProvider>
);

export default App;
```

### SVM (sdk v4.8.0+)

You can override RPC URLs for SVM networks via SDK utilities and network override settings. See the SDK Tabs below for the specific API names and usage.

The following example demonstrates overriding RPC URLs for Solana mainnet and Eclipse using SDK utilities within the corresponding SDK Tab.

```TypeScript theme={"system"}
const rpcUrlOverrides = {
    "101": ["https://sol.customrpc.com"],
    "201": ["https://eclipse.customrpc.com"]
}

const App = () => (
  <DynamicContextProvider
    settings={{
      environmentId: 'REPLACE_WITH_YOUR_ENV_ID',
      overrides: {
        solNetworks: (networks) => overrideNetworkRpcUrl(networks, rpcUrlOverrides),
      }
    }}
  >
    <Home />
  </DynamicContextProvider>
);

export default App;
```

## Fetching RPC Providers

You can fetch RPC providers via SDK utilities. See the SDK Tabs below for specific APIs and usage.
These utilities typically expect a selector parameter to choose EVM or Solana providers.

```typescript theme={"system"}
import { useRpcProviders } from '@dynamic-labs/sdk-react-core'
import { evmProvidersSelector } from '@dynamic-labs/ethereum-core'
import { solanaProvidersSelector } from '@dynamic-labs/solana-core'

const App = () => {
  const evmProviders = useRpcProviders(evmProvidersSelector)
  const solanaProviders = useRpcProviders(solanaProvidersSelector)
}
```

The hook returns either [EvmRpcProviderMethods](/react/reference/objects/EvmRpcProviderMethods)
or [SolanaRpcProviderMethods](/react/reference/objects/SolanaRpcProviderMethods), with the following fields:

<ParamField path="defaultProvider" type="EvmRpcProvider | SolanaRpcProvider | undefined">
  The provider for EVM or Solana Mainnet, if mainnet is enabled
</ParamField>

<ParamField path="providers" type="EvmRpcProvider[] | SolanaRpcProvider[] | undefined">
  A full list of all EVM or Solana providers that have been configured
</ParamField>

<ParamField path="getProviderByChainId" type="(chainId: number | string) => EvmRpcProvider | SolanaRpcProvider | undefined">
  A convenience method that lets you retrieve a provider for a specific Chain ID
</ParamField>

<Info>
  Check out the reference for
  [EvmRpcProvider](/react/reference/objects/EvmRpcProvider) and
  [SolanaRpcProvider](/react/reference/objects/SolanaRpcProvider)
</Info>

### Example

Below is a simple example using EVM providers to fetch an arbitrary ENS mapping:

```TypeScript theme={"system"}
import { useRpcProviders } from '@dynamic-labs/sdk-react-core'
import { evmProvidersSelector } from '@dynamic-labs/ethereum-core'

const useLogEnsMapping = () => {
  const { defaultProvider } = useRpcProviders(evmProvidersSelector)

  const mainnetProvider = defaultProvider?.provider;

  const ensAddress = mainnetProvider.resolveName('myname.eth');

  console.log('address for myname.eth', ensAddress);
}
```
