Skip to content

Hobby implementation of EVM opcodes in TypeScript [2018]

License

Notifications You must be signed in to change notification settings

0x31/ts-ethereum-vm

Repository files navigation

Typescript EVM (Ethereum Virtual Machine)

Note

This was a hobby project from 2018. It's a basic implementation of the most common EVM op-codes, implemented based on the Ethereum yellow paper at the time. Although there are some limited unit tests, I primarily used the legacy rpc-tests repository to test it's conformance. There's no p2p code or node implementation.

The OpCode behaviour is implemented in operations.ts.

Example

Deploying the following code (first compiled by solc):

pragma solidity ^0.4.11;

contract C {
  uint256 a;

  function add(uint256 b, uint256 c) public {
      a = b + c;
  }
  
  function getA() public view returns (uint256) {
      return a;
  }
}

and calling it:

add(2, 3);

will output the following state (note the storage is set to 101, 5 in binary):

Preview

References

About

Hobby implementation of EVM opcodes in TypeScript [2018]

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published