Socket
Socket
Sign inDemoInstall

web3-eth-accounts

Package Overview
Dependencies
8
Maintainers
4
Versions
402
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    web3-eth-accounts

Package for managing Ethereum accounts and signing


Version published
Weekly downloads
418K
increased by3.37%
Maintainers
4
Created
Weekly downloads
 

Package description

What is web3-eth-accounts?

The web3-eth-accounts package is a part of the Web3.js library that provides functionalities for managing Ethereum accounts. It allows you to create, sign, and recover accounts, as well as sign data and transactions.

What are web3-eth-accounts's main functionalities?

Create Account

This feature allows you to create a new Ethereum account. The account object contains the address, private key, and other relevant information.

const Web3 = require('web3');
const web3 = new Web3();
const account = web3.eth.accounts.create();
console.log(account);

Sign Transaction

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

const Web3 = require('web3');
const web3 = new Web3();
const account = web3.eth.accounts.privateKeyToAccount('YOUR_PRIVATE_KEY');
const tx = {
  to: '0xRecipientAddress',
  value: '1000000000',
  gas: 2000000
};
account.signTransaction(tx).then(signed => {
  console.log(signed);
});

Recover Account

This feature allows you to recover an account address from a signed message. It is useful for verifying the authenticity of a message.

const Web3 = require('web3');
const web3 = new Web3();
const message = 'Hello, world!';
const signature = '0xSignature';
const account = web3.eth.accounts.recover(message, signature);
console.log(account);

Sign Data

This feature allows you to sign arbitrary data using an account's private key. The signed data can be used for various purposes, such as authentication.

const Web3 = require('web3');
const web3 = new Web3();
const account = web3.eth.accounts.privateKeyToAccount('YOUR_PRIVATE_KEY');
const data = 'Hello, world!';
const signature = account.sign(data);
console.log(signature);

Other packages similar to web3-eth-accounts

Readme

Source

web3.js

web3.js - Web3 Eth Accounts

ES Version Node Version NPM Package Downloads

This is a sub-package of web3.js.

web3-eth-accounts contains functionality for managing Ethereum accounts and signing.

Installation

You can install the package either using NPM or using Yarn

Using NPM

npm install web3-eth-accounts

Using Yarn

yarn add web3-eth-accounts

Getting Started

  • :writing_hand: If you have questions submit an issue or join us on Discord Discord

Prerequisites

Package.json Scripts

ScriptDescription
cleanUses rimraf to remove dist/
buildUses tsc to build package and dependent packages
lintUses eslint to lint package
lint:fixUses eslint to check and fix any warnings
formatUses prettier to format the code
testUses jest to run unit tests
test:integrationUses jest to run tests under /test/integration
test:unitUses jest to run tests under /test/unit

FAQs

Last updated on 23 May 2024

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc