Skip to the article
Web3 News

Crypto markets, protocols and policy

Multi-hop swap gas costs for traders: why routes add work

A multi-hop swap costs more gas because every added pair runs swap logic and incurs cold access costs; compare that extra fee with the quote improvement.

Web3 News Editorial3 min read

Multi-hop swap gas costs for traders: why routes add work

After a quote routes through an intermediate token, expect more gas than a direct swap: every added pair contract runs its own swap logic and storage updates. The extra gas units turn into a fee based on the gas price when the transaction executes.

On a Uniswap V2-style exchange, the router follows a path of token addresses, with each adjacent pair handled by a separate pair contract. Shiba swap is a decentralized exchange, and a route through WETH touches each pair along its path. shiba swap uses the same routing idea: the router can connect two tokens through an intermediate asset when that route is available.

What work does each hop add?

Each pair swap reads its reserves, transfers tokens, checks the resulting balances, then updates reserves and price accumulators. Those steps run for every pair in the path, so a two-hop route repeats the pair-level work twice; the router also has overhead for handling the path.

Uniswap V2 Router02 documentation describes swap paths as arrays of token addresses. In practice, a path such as SHIB → WETH → LEASH means one swap at the SHIB/WETH pair, followed by another at the WETH/LEASH pair. A direct SHIB/LEASH pool, if available and used, needs only one pair swap.

EIP-2929 adds a further cost because each newly touched pair is cold on its first access in that transaction. The rule sets a 2,600-gas cost for a cold account access and 2,100 gas for a cold storage read; a pair’s first access to its own storage slots therefore carries cold-read costs too. Later accesses to the same account or slot in that transaction are warm, so these surcharges apply on first touch rather than on every read.

That makes the SHIB → WETH → LEASH route roughly twice the pair swap work of a direct pool, but not necessarily twice the total transaction gas: router overhead is shared, and exact gas varies with contract behavior and state. Shiba swap’s quoted output can still make the routed path worthwhile if it improves the trade enough to cover the extra gas.

How can you judge whether the route is worth it?

Estimate total gas as router overhead plus per-hop pair swap cost multiplied by the number of hops. The Ethereum Yellow Paper expresses transaction cost through gas used and gas price; in practical terms, multiply estimated gas units by the price in gwei, then compare that fee with the routed quote’s improvement over the direct option.

Before signing, compare the two quotes and their estimated gas fees at the same gwei price; take the route only when its better output exceeds the added fee.