-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: generate keys if not default key is used (#707)
- Loading branch information
1 parent
a9ba40e
commit 2d1cab5
Showing
7 changed files
with
75 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
new_prefunded_account = import_module( | ||
"../prelaunch_data_generator/genesis_constants/genesis_constants.star" | ||
) | ||
|
||
IMAGE = "wealdtech/ethereal:latest" | ||
|
||
|
||
def get_accounts(plan, mnemonic, num_of_keys=21): | ||
PRE_FUNDED_ACCOUNTS = [] | ||
plan.print("mnemonic: {0}".format(mnemonic)) | ||
for current_key in range(num_of_keys): | ||
private_key = plan.run_sh( | ||
name="run-ethereal-private-key", | ||
image=IMAGE, | ||
description="Running ethereal to derive private keys of key {0}".format( | ||
current_key | ||
), | ||
run="private_key=$(/app/ethereal hd keys --seed=\"{0}\" --path=\"m/44'/60'/0'/0/{1}\" | awk '/Private key/{{print substr($NF, 3)}}'); echo -n $private_key".format( | ||
mnemonic, current_key | ||
), | ||
) | ||
eth_address = plan.run_sh( | ||
name="run-ethereal-eth-address", | ||
image=IMAGE, | ||
description="Running ethereal to derive eth address of key {0}".format( | ||
current_key | ||
), | ||
run="eth_addr=$(/app/ethereal hd keys --seed=\"{0}\" --path=\"m/44'/60'/0'/0/{1}\" | awk '/Ethereum address/{{print $NF}}'); echo -n $eth_addr".format( | ||
mnemonic, current_key | ||
), | ||
) | ||
|
||
PRE_FUNDED_ACCOUNTS.append( | ||
new_prefunded_account.new_prefunded_account( | ||
eth_address.output, private_key.output | ||
) | ||
) | ||
|
||
plan.print("PRE_FUNDED_ACCOUNTS: {0}".format(PRE_FUNDED_ACCOUNTS)) | ||
|
||
return PRE_FUNDED_ACCOUNTS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters