forked from cerc-io/stack-orchestrator
1881554ae0
* Initial version
* Update readme
* Build op-geth container
* Add optimism go code containers
* Add optimism contracts container
* Update optimism contracts container build
* Add fixturenet-optimism-contracts service to deploy L1 contracts
* Add fixturenet-optimism op-node and op-geth
* Avoid reading addresses from a file when sending balances
* Fixes for running op-geth container
* Fix image name and command in optimism-contracts service
* Add a healthcheck to lighthouse bootnode to avoid failing eth txs
* Avoid using hardhat ethers to send balances from an account
* Update script to send balance to L1 bridge proxy contract
* Implement op-node container
* Wait for a finalized L1 block to exist
* Fix for running op-batcher
* Add a todo for restart support
* Integrate optimism-contracts service and update instructions
* Update clean-up to remove docker volumes
* Update volume access permissions
* Add a todo to replace foundry usage with web3 js
* Add known issues
* Fix README
* Fix indentation
* Update known issues
---------
Co-authored-by: David Boreham <david@bozemanpas.com>
Co-authored-by: David Boreham <david@bozemanpass.com>
Co-authored-by: nabarun <nabarun@deepstacksoft.com>
Former-commit-id: fc522140ba
29 lines
1.0 KiB
TypeScript
29 lines
1.0 KiB
TypeScript
import fs from 'fs'
|
|
|
|
import { task } from 'hardhat/config'
|
|
import { hdkey } from 'ethereumjs-wallet'
|
|
import * as bip39 from 'bip39'
|
|
|
|
task('rekey-json', 'Generates a new set of keys for a test network')
|
|
.addParam('output', 'JSON file to output accounts to')
|
|
.setAction(async ({ output: outputFile }) => {
|
|
const mnemonic = bip39.generateMnemonic()
|
|
const pathPrefix = "m/44'/60'/0'/0"
|
|
const labels = ['Admin', 'Proposer', 'Batcher', 'Sequencer']
|
|
const hdwallet = hdkey.fromMasterSeed(await bip39.mnemonicToSeed(mnemonic))
|
|
|
|
const output = {}
|
|
|
|
for (let i = 0; i < labels.length; i++) {
|
|
const label = labels[i]
|
|
const wallet = hdwallet.derivePath(`${pathPrefix}/${i}`).getWallet()
|
|
const addr = '0x' + wallet.getAddress().toString('hex')
|
|
const pk = wallet.getPrivateKey().toString('hex')
|
|
|
|
output[label] = { address: addr, privateKey: pk }
|
|
}
|
|
|
|
fs.writeFileSync(outputFile, JSON.stringify(output, null, 2))
|
|
console.log(`L2 account keys written to ${outputFile}`)
|
|
})
|