Skip to content

A library that enables next-generation UX and DX via putting an ethereum node in the browser and solidity in javascript

License

Notifications You must be signed in to change notification settings

evmts/tevm-monorepo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A library that enables next-generation UX and DX via putting an ethereum node in the browser and solidity in javascript

CI NPM Version Tevm Downloads Tevm Bundler Downloads Minzipped Size

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.

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.