Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ethereumjs/tx

Package Overview
Dependencies
Maintainers
4
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ethereumjs/tx

Implementation of the various Ethereum Transaction Types

  • 5.4.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
787K
increased by7.5%
Maintainers
4
Weekly downloads
 
Created

What is @ethereumjs/tx?

@ethereumjs/tx is a library for creating, signing, and serializing Ethereum transactions. It is part of the EthereumJS suite of tools and is widely used for handling Ethereum transactions in a programmatic way.

What are @ethereumjs/tx's main functionalities?

Creating a Transaction

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

const { Transaction } = require('@ethereumjs/tx');
const txData = {
  nonce: '0x00',
  gasPrice: '0x09184e72a000',
  gasLimit: '0x2710',
  to: '0x0000000000000000000000000000000000000000',
  value: '0x00',
  data: '0x00'
};
const tx = Transaction.fromTxData(txData);

Signing a Transaction

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

const { Transaction } = require('@ethereumjs/tx');
const { privateToAddress, toBuffer } = require('ethereumjs-util');
const privateKey = Buffer.from('your_private_key', 'hex');
const txData = { /* transaction data */ };
const tx = Transaction.fromTxData(txData);
const signedTx = tx.sign(privateKey);

Serializing a Transaction

This feature allows you to serialize a transaction into a format that can be sent over the network or stored for later use.

const { Transaction } = require('@ethereumjs/tx');
const txData = { /* transaction data */ };
const tx = Transaction.fromTxData(txData);
const serializedTx = tx.serialize();

Other packages similar to @ethereumjs/tx

Keywords

FAQs

Package last updated on 15 Aug 2024

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