--- title: Getting Started with Ethers description: Connect ethers v6 to tevm@1.0.0-rc.151 through EIP-1193 authors: - "[William Cory](https://x.com/fucory)" - "[Tevm Team](https://github.com/evmts)" --- # Getting Started with Ethers.js Tevm's primary client surface is viem-compatible. Ethers v6 can use the same in-memory node through its EIP-1193 provider interface. ## Install :::code-group ```bash [npm] npm install tevm@1.0.0-rc.151 viem ethers@6 ``` ```bash [pnpm] pnpm add tevm@1.0.0-rc.151 viem ethers@6 ``` ```bash [yarn] yarn add tevm@1.0.0-rc.151 viem ethers@6 ``` ```bash [bun] bun add tevm@1.0.0-rc.151 viem ethers@6 ``` ::: ## Create a Provider `createMemoryClient()` is synchronous. Its `request` method follows EIP-1193. Pass the client directly to ethers; Tevm preserves typed RPC return values while also satisfying ethers' open-ended provider interface: ```ts import { createMemoryClient, getAddress } from 'tevm' import { BrowserProvider, Wallet, formatEther, parseEther } from 'ethers' const client = createMemoryClient() await client.tevmReady() const provider = new BrowserProvider(client, undefined, { cacheTimeout: -1, }) const signer = Wallet.createRandom().connect(provider) await client.setBalance({ address: getAddress(signer.address), value: parseEther('10'), }) console.log(formatEther(await provider.getBalance(signer.address))) ``` The negative cache timeout keeps ethers from briefly returning a cached block or balance after Tevm changes local state. ## Transactions and Mining Ethers transactions enter Tevm's txpool. With the default manual mining mode, mine before waiting for the receipt: ```ts const tx = await signer.sendTransaction({ to: '0x1111111111111111111111111111111111111111', value: parseEther('1'), }) await client.mine({ blocks: 1 }) const receipt = await tx.wait() console.log(receipt?.status) ``` `client.mine({ blocks: 1 })` is the viem test action. The equivalent Tevm action is `client.tevmMine({ blockCount: 1 })`. See [Using with Ethers](/examples/ethers) for a complete contract deployment and write example.