privateKeyToAccount
Callable
Parameters
privateKey: Bytes
String or Uint8Array of 32 bytes
optionalignoreLength: boolean
if true, will not error check length
Returns Web3Account
A Web3Account object
The
Web3Account.signTransaction
is not stateful here. We need network access to get the accountnonce
andchainId
to sign the transaction. Use Web3.eth.accounts.signTransaction instead.privateKeyToAccount("0x348ce564d427a3311b6536bbcff9390d69395b06ed6c486954e971d960fe8709");
> {
address: '0xb8CE9ab6943e0eCED004cDe8e3bBed6568B2Fa01',
privateKey: '0x348ce564d427a3311b6536bbcff9390d69395b06ed6c486954e971d960fe8709',
sign,
signTransaction,
encrypt,
}
Get an Account object from the privateKey