How to use ethereumjs-wallet with web3

“Returned error: unknown account”
const account = web3.eth.accounts.privateKeyToAccount(privateKey);
web3.eth.accounts.wallet.add(account);
const amountAdj = (amount * 10 ** contractDecimal).toFixed(0)
const recipientAddr = web3.utils.toChecksumAddress(payee)
const senderAddr = web3.utils.toChecksumAddress(sender)
const boolResult = await contract.methods.transfer(
recipientAddr,
amountAdj
)
.send({from: senderAddr, gas: 2000000})
web3.eth.accounts.wallet.add
({
privateKey: pk,
address: addr
});

--

--

--

Engineer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Use Stylify to Dynamically Generate CSS Based on What You Write

Robust Frontend Development With Aliases

Node JS vs Express.js vs Koa.js

JavaScript Array

Making 3D Holographic Illusion using Pepper’s Ghost Pyramid

Create you own moment.js or time ago localized date format i.e 3 months ago.

Material-UI: React Framework

Register Now: https://www.kundaliniyoga.edu.in/s/store

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Victor Yeo

Victor Yeo

Engineer

More from Medium

Difference Between Blockchain & Distributed Ledger

How to use a Merkle Tree for large whitelist mints

Turning IP Ownership Into an Investment: Can Technology Help?

How does the Starton blockchain Relayer work ?