A library that enables next-generation UX and DX via putting an ethereum node in the browser and solidity in javascript
Tevm tools include an Ethereum devnet that can run in the Browser and Node.js along with a solidity bundler that allows you to import solidity directly into TypeScript files. All built on top of the viem API.
// import solidity directly into typescript
import { ERC20 } from '@openzeppelin/contracts/token/ERC20/ERC20.sol'
import { createMemoryClient, http } from 'tevm'
import { optimism } from 'tevm/common'
// create a anvil-like devnet directly in TypeScript
const client = createMemoryClient({
common: optimism,
fork: {transport: http('https://mainnet.optimism.io')()}
})
// execute the EVM locally in the browser, node.js, deno and Bun
const balance = await client.readContract(
ERC20
.withAddress('0x4200000000000000000000000000000000000042')
.read
.balanceOf('0xd8da6bf26964af9d7eed9e03e53415d37aa96045')
)
Tevm is modular, easy to pick up, and built on top of viem.
Tevm consists of the following modular tools:
- Tevm Devnet
- Tevm Contracts
- Tevm Bundler
Visit Docs (under heavy construction) for docs, guides, API, and more! 📄
Contributions are encouraged, but please open an issue before making any major changes to ensure your changes will be accepted.
See CONTRIBUTING.md for contributing information.
Most files are licensed under the MIT license. Some files copied from ethereumjs inherit the MPL-2.0 license. These files are individually marked at the top and are all in the @tevm/state
, @tevm/blockchain
, and other packages that wrap ethereumjs libraries.