Coder Social home page Coder Social logo

hardhat-otb's Introduction

Hardhat plugin for translate opcodes to bytecode

You can translate contract bytecode to opcodes and watch what is in the stack.

Installation

Step 1: Install the package

npm i @sovaslava/hardhat-otb

Step 2: Add to your hardhat.config.ts file

import "@sovaslava/hardhat-otb";

Usage

--help:

npx hardhat otb --help

result:

Usage: hardhat [GLOBAL OPTIONS] otb --file <STRING> [--stack <STRING>]

OPTIONS:

  --file        path to file with opcodes
  --stack       write stack into other file

otb: Opcodes to bytecode

converting mnemonic opcodes into bytecode string:

Prepare text file with opcodes, each opcode with args in separated line. Let it be opcodes.txt. You can choose any other name:

PUSH1 0x42
PUSH1 0
MSTORE
PUSH1 32
PUSH1 0
RETURN
npx hardhat otb --file opcodes.txt

In console you can see bytecode:

604260005260326000f3

--stack feature:

default value for --stack option - false

npx hardhat otb --file opcodes.txt --stack true

the otb-*.txt file will be created in the project directory:

PUSH1 0x42            | [ 0x42 ]
PUSH1 0x00            | [ 0x00 ][ 0x42 ]
MSTORE                |
PUSH1 0x32            | [ 0x32 ]
PUSH1 0x00            | [ 0x00 ][ 0x32 ]
RETURN                |

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.