Skip to content

Instantly share code, notes, and snippets.

Last active July 19, 2023 08:21
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Mempool unblocker
// NOTE THIS IS A HARDHAT SCRIPT. NEEDS A hardhat.config.json file.
const { ethers } = require("hardhat")
async function main() {
const provider = new ethers.providers.JsonRpcProvider(process.env.SEPOLIA_RPC_URL)
const gasPrice = await provider.getGasPrice()
const sk1 = process.env.PRIVATE_KEY
const sk2 = process.env.SECOND_PRIVATE_KEY
if (!sk1 || !sk2) {
throw Error(`sk1 or sk2 not defined: "${sk1}" and "${sk2}"`)
const DEV1 = new ethers.Wallet(sk1, provider)
const DEV2 = new ethers.Wallet(sk2, provider)
const nonce = await provider.getTransactionCount(DEV1.address, "latest")
console.log("clearing nonce ", nonce)
const tx = {
from: DEV1.address,
to: DEV2.address,
value: ethers.utils.parseUnits("0.0000000001", "ether"),
gasPrice: gasPrice,
gasLimit: ethers.utils.hexlify(1000 * 100), // 10000 gwei
try {
const transaction = await DEV1.sendTransaction(tx)
console.log("transaction : ", transaction)
} catch (error) {
console.log("\nError in sending Tx: ", error)
throw error
Copy link

This gist was prepared in connection with this blog:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment