Awesome
<p align="center"> A library that enables next-generation UX and DX via putting an ethereum node in the browser and solidity in javascript </p>tevm-monorepo
Tevm enables next generation UX for users while providing delightful DX for developers. It's like sticking an RPC node in your web app and making Solidity contracts a first class citizen.
Some things you can do with Tevm.
- Estimate gas with no loading spinners
- Remove latency from many JSON-RPC requests
- Add optimistic updates to your UI
- Run arbitrary solidity code in the browser for code reuse
- Cut latency of some calls in half with a typesafe scripting api
- Use JSON-RPC methods like debug_traceCall even if the underlying RPC does not support it
- And much more
Here is a code example of what Tevm looks like
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 able to fork a network similar to anvil in the browser and execute contract calls. You will also notice Tevm Bundler allows us to import contract abis directly from solidity contracts. These powerful primitives are the key to Tevm.
Join Telegram
Visit Docs (under heavy construction) for docs, guides, API, and more! 📄
Contributing 💻
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.
License 📄
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.
<a href="./LICENSE"><img src="https://user-images.githubusercontent.com/35039927/231030761-66f5ce58-a4e9-4695-b1fe-255b1bceac92.png" width="200" /></a>