LayerHopDocsLaunch app (opens in a new tab)

Gas station

Send a little native gas to up to 10 chains from one transaction, so a wallet can transact on chains it has never used. Off by default on each deployment.

Arriving on a new chain with tokens but no gas is a dead end: the wallet can't even approve a swap. The gas station refuels up to 10 chains with their native gas token from one transaction on the chain the user already has funds on. It runs at app.layerhop.com/gas.

The gas station is off unless the deployment sets GAS_STATION_ENABLED=1; while it's off every /v1/gas/* route answers FORBIDDEN. The source is Gas.zip: one deposit, split evenly across the chains you pick, usually delivered within seconds. LayerHop takes no fee on refuels; Gas.zip's own fee is part of the quote.

Quote a refuel#

Terminal
curl -X POST https://api.layerhop.com/v1/gas/quote \
  -H "content-type: application/json" \
  -d '{"srcChain":"base","sender":"0xYourWallet","destinations":[{"chain":"arbitrum","usd":2},{"chain":"optimism","usd":2},{"chain":"bsc","usd":2}]}'

The quote (good for about 60 seconds) has:

  • tx: one transaction on srcChain, paid in its native token (value = depositWei). Send it from sender.
  • destinations: what each chain receives (expectedWei of its native token, its USD value, and the usual seconds).
  • fees: ourFeeBps: 0 and providerFeeUsd (the deposit minus what's delivered).
  • simulation: an eth_call of tx from sender. ok: false usually means the wallet doesn't hold enough for the deposit plus the network fee.

Before returning tx we decode it and check it is a deposit(chains, to) call on Gas.zip's deposit contract with exactly your destinations, your recipient and the quoted value. A mismatch is a PROVIDER_ERROR, never a transaction to sign. Gas.zip's own numbers are checked too: its price of the native token must be within 3% of LayerHop's price feed (the deposit is sized from it, and can't be worth more than the USD you asked for plus 3%), and each destination's Gas.zip chain id comes from a table LayerHop keeps, not from Gas.zip's live list (a chain whose id changed is not offered until we check it). Without a price of our own, or with prices apart, the quote is a PROVIDER_ERROR; try again shortly.

Rules#

  • 1 to 10 destinations, all different, none equal to srcChain.
  • One amount for all: Gas.zip splits a single deposit evenly, so every destination takes the same usd.
  • Between $0.50 and $50 per chain, within Gas.zip's own limits (GET /v1/gas/chains lists both, per chain).
  • Pay with the source chain's native token (srcToken may be omitted or name the native token).
  • recipient defaults to the sender.

Destinations Gas.zip can't serve right now (e.g. out of liquidity) make the quote fail with NO_ROUTE, naming them; drop them and quote again.

Watch it arrive#

  • GET /v1/gas/status/{txHash}: the deposit's outbound transfers per chain; status becomes filled once every one is confirmed.
  • GET /v1/gas/balances?address=…&chains=arbitrum,optimism: native balances, for comparing before and after. The app does both every few seconds after the user signs.

Any refuel can also be looked up with the transfer tracker.

Last updated