Skip to Content
Ethereum Cookbook
book

Ethereum Cookbook

by Manoj P R
August 2018
Intermediate to advanced
404 pages
11h 19m
English
Packt Publishing
Content preview from Ethereum Cookbook

How to do it...

We are now going to learn how to manage accounts and send transactions:

  1. To view the list of accounts available in the connected node, use the following command:
// v0.2x.xweb3.eth.accounts;// v1.x.xweb3.eth.getAccounts().then(console.log);
  1. To create an account using the web3 object, run the following command. Starting from 1.x.x, web3.js includes added support for account management:
// For v1.x.xweb3.eth.accounts.create();web3.eth.accounts.create("<random entropy>");

The create function accepts an entropy as input for randomness. If not specified, it will generate a random hex of 32 bytes by using web3.utils.randomHex(32) and will use it as the entropy input. This method will return the new address, private key, and methods ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Building Ethereum Dapps

Building Ethereum Dapps

Roberto Infante
Ethereum For Dummies

Ethereum For Dummies

Michael G. Solomon

Publisher Resources

ISBN: 9781789133998Supplemental Content