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 if directly imported from accounts package and used. Network access is required to get the accountnonce
andchainId
to sign the transaction, so use Web3.eth.accounts.signTransaction for signing transactions.:
web3.eth.accounts.privateKeyToAccount("0x348ce564d427a3311b6536bbcff9390d69395b06ed6c486954e971d960fe8709");
> {
address: '0xb8CE9ab6943e0eCED004cDe8e3bBed6568B2Fa01',
privateKey: '0x348ce564d427a3311b6536bbcff9390d69395b06ed6c486954e971d960fe8709',
sign,
signTransaction,
encrypt,
}
Get an Account object from the privateKey