Skip to content

bug: eth_gasPrice returns stale baseline — ERC-20 approve() rejects with "replacement transaction underpriced" without ≥30% gas price premium #87

@osr21

Description

@osr21

Summary

When building a token swap DApp on Arc Testnet using viem, every ERC-20 approve() call fails with "replacement transaction underpriced" unless the caller manually fetches the live gas price and applies at least a 30% upward bump before submitting.

This is separate from #80 (gasLimit override) — the issue here is specifically gasPrice (EIP-1559-style replacement threshold) not gasLimit.

Steps to reproduce

  1. Connect to Arc Testnet via createPublicClient / createWalletClient with viem
  2. Call walletClient.writeContract({ functionName: "approve", ... }) without an explicit gasPrice
  3. Transaction is submitted but immediately rejected by the node with:
    replacement transaction underpriced
    

Workaround

Fetch the live gas price and apply a 30% premium before every write:

const networkGasPrice = await publicClient.getGasPrice();
const gasPrice = (networkGasPrice * 130n) / 100n;

await walletClient.writeContract({
  ...
  gasPrice, // must be explicit
});

This applies to every ERC-20 write on Arc Testnet — approve(), transfer(), etc.

Environment

  • Network: Arc Testnet (Chain ID 5042002)
  • RPC: https://rpc.testnet.arc.network
  • viem v2.48.11
  • Observed: May 2025

Impact

Any DApp that submits ERC-20 transactions without an explicit gas price premium will silently fail. The error message does not indicate that the solution is a gas price bump — it looks like a nonce/mempool collision.

Suggested fix

The node should either (a) honor MetaMask/viem default gas price estimates without rejection, or (b) document that a minimum gas price premium is required for all Arc Testnet transactions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions