Giter Club home page Giter Club logo

raw-tx's Introduction

Ethereum Raw Transaction Signing Script

๐Ÿ‘ฎโ€โ™‚๏ธ Sanity checks License: WTFPL

Two scripts to generate and execute a signed raw transaction with ethers.

Installation

It is recommended to install pnpm through the npm package manager, which comes bundled with Node.js when you install it on your system. It is recommended to use a Node.js version >= 20.0.0.

Once you have npm installed, you can run the following both to install and upgrade pnpm:

npm install -g pnpm

After having installed pnpm, simply run:

pnpm install

.env File

Create a .env file in the root directory and place the private key of your wallet used for signing in the variable PRIVATE_KEY and the RPC provider for the transaction in the variable RPC_PROVIDER. Example:

PRIVATE_KEY=abc123abc123abc123abc123abc123abc123abc123abc123abc123abc123abc1
RPC_PROVIDER=https://rpc.ankr.com/eth_goerli

Generate a Signed Raw Transaction

Configure the placeholder payload in sign according to your needs and run:

pnpm generate

This will print all raw transaction details to your terminal. Use the output signedTx.serialized to broadcast a transaction e.g. with services like pushTx. You can also use the automatically saved serialised signed transaction in signed_serialised_transaction.json (in the scripts/out directory) via pnpm execute as explained in the next section.

Execute a Signed Raw Transaction

Configure your RPC provider in execute according to your needs and run:

pnpm execute

If the transaction is successful, it saves a file transaction_receipt.json or in case of a failure a file transaction_error.json in the scripts/out directory.

raw-tx's People

Contributors

pcaversaccio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

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.