From c60a2a6fed34f56b8f4da08ba4081cbe19c3835b Mon Sep 17 00:00:00 2001 From: hodlbank Date: Fri, 3 Aug 2018 19:56:19 +0000 Subject: [PATCH] Allow user to specify "random" as privateKey configuration. In such case embark generates some random privateKey for the account. --- lib/utils/accountParser.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/utils/accountParser.js b/lib/utils/accountParser.js index f407cf54b..1399108cd 100644 --- a/lib/utils/accountParser.js +++ b/lib/utils/accountParser.js @@ -47,6 +47,12 @@ class AccountParser { if (accountConfig.balance) { hexBalance = AccountParser.getHexBalance(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;