> ## 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 Ethers

<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>

The SDK and above ships with Viem by default as it is much lighter than Ethers and is generally more performant.

We have also made viem a peerDependency to avoid bundling it multiple times, as other packages such as wagmi also need it.

For the above reason, viem will be installed as a peerDependency when you install the SDK with npm, even if you want to use Ethers.

<Warning>
  If you are using yarn instead of npm, even if you want to use Ethers, you will need to install viem manually:

  ```bash theme={"system"}
  yarn i viem
  ```
</Warning>

Dynamic only supports version v6+ of Ethers. In order to use it, simply import the ethers methods you need from `@dynamic-labs/ethers-v6` directly in the component where you are using them.

```bash theme={"system"}
npm i @dynamic-labs/ethers-v6
```

```jsx theme={"system"}
import { useDynamicContext } from '@dynamic-labs/sdk-react-core'
import { getWeb3Provider,getSigner, } from '@dynamic-labs/ethers-v6'

const { primaryWallet } = useDynamicContext()

const provider = await getWeb3Provider(primaryWallet)
const signer = await getSigner(primaryWallet)

// do your thing

```
