For the complete documentation index, see llms.txt. This page is also available as Markdown.

Recover a locked account

If your account is locked due to conflicting transactions at the same nonce, you can recover it by calling the recovery precompile. For background on why accounts get locked and how the recovery protocol works, see Local Ordering.

Steps

  1. Call pod_getRecoveryTargetTx(account) on the full node to get the target transaction to recover to.

  2. Send a transaction to the recovery precompile at 0x50d0000000000000000000000000000000000003, calling recover(txHash, nonce) with the values from step 1.

The protocol will finalize the target transaction chain, recover your account state, and increment the nonce. You can then send a new transaction with the next nonce.

import { ethers } from "ethers";

const provider = new ethers.JsonRpcProvider("https://rpc.podtestnet.dev");
const wallet = new ethers.Wallet(PRIVATE_KEY, provider);

const RECOVERY = "0x50d0000000000000000000000000000000000003";
const abi = ["function recover(bytes32 txHash, uint64 nonce) public"];
const recovery = new ethers.Contract(RECOVERY, abi, wallet);

// 1. Get the recovery target for the locked account
const { txHash: targetTxHash, nonce } = await provider.send("pod_getRecoveryTargetTx", [wallet.address]);

// 2. Call the recovery precompile
const tx = await recovery.recover(targetTxHash, nonce);
await tx.wait();

Last updated