Socket
Socket
Sign inDemoInstall

ethereumjs-tx

Package Overview
Dependencies
Maintainers
3
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ethereumjs-tx

An simple module for creating, manipulating and signing ethereum transactions


Version published
Weekly downloads
203K
decreased by-5.16%
Maintainers
3
Weekly downloads
 
Created

What is ethereumjs-tx?

The ethereumjs-tx package is a JavaScript library for creating, signing, and serializing Ethereum transactions. It is part of the ethereumjs suite of tools and is widely used for interacting with the Ethereum blockchain at a low level.

What are ethereumjs-tx's main functionalities?

Creating a Transaction

This feature allows you to create a new Ethereum transaction by specifying parameters such as nonce, gas price, gas limit, recipient address, value, and data.

const Tx = require('ethereumjs-tx').Transaction;
const txParams = {
  nonce: '0x00',
  gasPrice: '0x09184e72a000',
  gasLimit: '0x2710',
  to: '0x0000000000000000000000000000000000000000',
  value: '0x00',
  data: '0x00',
};
const tx = new Tx(txParams);

Signing a Transaction

This feature allows you to sign a transaction using a private key. The transaction must be signed before it can be sent to the Ethereum network.

const privateKey = Buffer.from('your_private_key', 'hex');
tx.sign(privateKey);

Serializing a Transaction

This feature allows you to serialize a signed transaction into a format that can be sent over the network. The serialized transaction is typically represented as a hexadecimal string.

const serializedTx = tx.serialize();
console.log(serializedTx.toString('hex'));

Other packages similar to ethereumjs-tx

Keywords

FAQs

Package last updated on 25 Jul 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc