Skip to content

OffchainLabs/arbitrum-docs / .agents/skills/arbitrum-best-practices

arbitrum-best-practices

Verified

Arbitrum L2 development best practices. Use when implementing bridges, Orbit chains, SDK integrations, or debugging cross-chain transactions. Triggers on Arbitrum, L2, rollup, bridge, retryable, Orbit, Nitro, or cross-chain contexts.

rules/gas-l1-data-costs.md

View on GitHub
---
title: Account for L1 Data Costs in Gas Estimates
impact: MEDIUM
impactDescription: prevents failed transactions
tags: gas, l1, estimation, nitro
---

## Account for L1 Data Costs in Gas Estimates

Arbitrum transactions pay two gas components: L2 execution and L1 data posting. Standard `estimateGas` only returns L2 costs—ignoring L1 data costs causes transaction failures.

**Incorrect (L2-only estimation):**

```typescript
// Bad: Only estimates L2 execution gas
const gasLimit = await provider.estimateGas({ to, data })
// Missing L1 data posting costs - tx may fail
```

**Correct (include L1 component):**

```typescript
// Good: Use NodeInterface for complete estimate
const nodeInterface = NodeInterface__factory.connect(
  '0x00000000000000000000000000000000000000C8',
  provider
)
const { gasEstimateForL1 } = await nodeInterface.gasEstimateL1Component(
  to, false, data
)
const totalGas = l2Gas + gasEstimateForL1
```

L1 costs scale with calldata size and L1 gas prices. During L1 congestion, add a 50% buffer to L1 estimates (they're more volatile than L2).

For gas mechanics, see [Gas and Fees](https://docs.arbitrum.io/how-arbitrum-works/gas-fees).
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall