Allow user to specify "random" as privateKey configuration. In such case embark generates some random privateKey for the account.

This commit is contained in:
hodlbank 2018-08-03 19:56:19 +00:00 committed by Iuri Matias
parent c782f9b0a8
commit f84cef0932
1 changed files with 6 additions and 0 deletions

View File

@ -31,6 +31,12 @@ class AccountParser {
hexBalance = getHexBalanceFromString(accountConfig.balance, web3);
//hexBalance = getHexBalanceFromString(accountConfig.balance, web3);
}
if (accountConfig.privateKey === 'random') {
let randomAccount = web3.eth.accounts.create();
accountConfig.privateKey = randomAccount.privateKey;
}
if (accountConfig.privateKey) {
if (!accountConfig.privateKey.startsWith('0x')) {
accountConfig.privateKey = '0x' + accountConfig.privateKey;