run this script with 5 private key to run all these scripts at one time use npm parallel shell script
Created
October 26, 2022 07:08
-
-
Save ImHukam/750fc1b9807bf67fc484c743509fefea to your computer and use it in GitHub Desktop.
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
const { ethers, Wallet } = require('ethers'); | |
const fetch = require("node-fetch"); | |
const sleep = ms => new Promise(res => setTimeout(res, ms)); | |
const privatekey = '<private key here>'; | |
// const provider = new ethers.providers.JsonRpcProvider('https://public.zkevm-test.net:2083'); | |
const wallet = new ethers.Wallet(privatekey, provider); | |
const signer = wallet.connect(provider); | |
async function call() { | |
const recipient = "receiver addresss" | |
const gasPrice = parseInt((5) * 1e9); //only for testing | |
async function tx_call() { | |
const tx = { | |
from: wallet.address, | |
to: recipient, | |
value: ethers.utils.parseUnits('0.0001', 'ether'), | |
gasPrice: gasPrice, | |
gasLimit: ethers.utils.hexlify(21000), | |
// nonce: provider.getTransactionCount(wallet.address, 'latest') | |
}; | |
const t = await signer.sendTransaction(tx); | |
await t.wait(); | |
console.log('Block_tx:',(await provider.getTransactionReceipt(t.hash)).blockNumber) | |
console.log('tx hash:', t.hash); | |
} | |
tx_call(); | |
} | |
call(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment