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

Lazy Account Creation

Estimate gas correctly when a transfer creates its destination account.

An EVM address may not yet have a native ledger account. The first qualifying transfer to that address can create it, which costs more gas than a transfer to an existing account.

Always call eth_estimateGas with the actual sender, recipient, value, and data. Do not hardcode 21,000 and do not permanently cache an estimate for an address.

const estimate = await provider.estimateGas({ from, to, value });
const gasLimit = (estimate * 120n) / 100n;

An estimate is state-dependent. Submit promptly, preserve a reasonable safety margin, and surface the RPC error if estimation fails. A syntactically valid vanity address is not necessarily backed by a usable ECDSA key; only send to an address the recipient controls.

Last updated