Create wallets
## Set up wallet contracts Clone the wallet contracts from the and install the libraries. ## Create wallets 1. Create a file. 2. Copy/paste the JavaScript code
Set up wallet contracts
Clone the wallet contracts from the zkevm-contracts repository and install the npm libraries.
git clone https://github.com/0xPolygonHermez/zkevm-contracts.git
cd zkevm-contracts
npm iCreate wallets
-
Create a
wallets.jsfile.cd zkevm-contracts nano wallets.js -
Copy/paste the JavaScript code below.
const ethers = require("ethers"); async function main() { const arrayNames = [ "## Deployment Address", "\\n\\n## Trusted sequencer", "\\n\\n## Trusted aggregator", ]; for (let i = 0; i < arrayNames.length; i++) { const wallet = ethers.Wallet.createRandom(); console.log(arrayNames[i]); console.log(`Address: ${wallet.address}`); console.log(`PrvKey: ${wallet.privateKey}`); console.log(`mnemonic: "${wallet.mnemonic.phrase}"`); const keystoreJson = await wallet.encrypt("password"); console.log(`keystore: $`{keystoreJson}``); } } main().catch((e) => { console.error(e); process.exit(1); }); -
Generate the wallets.
node wallets.js | tee wallets.txt
Prepare environment variables
-
Edit the environment variables file.
cp .env.example .env # copies .env.example file into .env nano .env # opens .env file for editing -
Set the following variables.
MNEMONIC="..." # from wallets.txt Deployment Address mnemonic INFURA_API_KEY="..." # your API Key from Infura account ETHERSCAN_API_KEY="..." # your Etherscan API key -
Send 1 Sepolia ETH to the deployment address wallet listed in
wallets.txt.
Edit deployment configuration
-
Open the
deploy-parameters.jsonfile.cd zkevm-contracts/deployment/v2 cp deploy_parameters.json.example deploy_parameters.json nano deploy_parameters.json -
Edit the following parameters to match the generated wallet parameters.
trustedSequencer: trusted sequencer address inwallets.txt.trustedAggregator: trusted aggregated address inwallets.txt.admin: deployment address inwallets.txt.zkEVMOwner: deployment address inwallets.txt.timelockAddress: deployment address inwallets.txt.initialZkEVMDeployerAddress: deployment address inwallets.txt.zkEVMDeployerAddress: deployment address inwallets.txt.emergencyCouncilAddress: deployment address inwallets.txt.deployerPvtKey: deployment private key inwallets.txt.
-
Open the
create_rollup_parameters.jsonfile.cd zkevm-contracts/deployment/v2 cp create_rollup_parameters.json.example create_rollup_parameters.json vim create_rollup_parameters.json -
Edit the following parameters to match the rollup parameters
trustedSequencer: trusted sequencer address inwallets.txt.adminZkEVM: deployment address inwallets.txt.
Deploy & verify contracts
cd back to zkevm-contract root directory and run the deployment scripts.
-
Install Hardhat:
cd .. npm i @openzeppelin/hardhat-upgrades -
Deploy Polygon zkEVM deployer
npx hardhat run deployment/v2/2_deployPolygonZKEVMDeployer.ts --network sepoliaYou should see output that looks like this:
####################### polygonZkEVMDeployer deployed on: 0xB1A5BA61fBAD71Ba52d70B769d6A994c01b40983 -
Verify deployer
npx hardhat run deployment/v2/verifyzkEVMDeployer.js --network sepoliaYou should see ouput that looks like this:
The contract 0xB1A5BA61fBAD71Ba52d70B769d6A994c01b40983 has already been verified. https://sepolia.etherscan.io/address/0xB1A5BA61fBAD71Ba52d70B769d6A994c01b40983#code -
Prepare testnet
npx hardhat run deployment/testnet/prepareTestnet.ts --network sepoliaYou should see output that looks like this:
####################### pol deployed to: 0x2B2Ef864542EA38657221393B0A18215e5c3fc7eAnd now if you go to sepolia scan, you should also see that under your account, there's a new
PolErc-20 token created with the balance of19,900,000tokens.
Last updated on
Install dependencies
Open a terminal window and run the following commands to install the required software. ## Install base dependencies ## Install Docker ## Install Node/npm ## In
Configure node deployment
## Set up 1. Create some working directories. The following commands take care of directory placements where non-obvious. 2. Populate the directories by fetchin