Skip to main content

How do I validate that a transaction has not been tampered with?

After you simulate with Enso Quoter, send the unsigned transaction and simulationId to the validate endpoint. Sign only when valid is true and every field check passes.

J
Written by Javier Diaz

After you simulate with Enso Quoter, send the unsigned transaction and simulationId to the validate endpoint. Sign only when valid is true and every field check passes.

Definition

Validation is an integrity check, not a second price quote. It confirms that the calldata, target, sender, value, and chain ID still match the simulation the user reviewed.

How it works

  • Simulate first and keep the simulationId.

  • Immediately before signing, call validate with that ID and the unsigned transaction.data, to, from, value, and chainId.

  • valid is true only when checks.data, checks.to, checks.from, checks.value, and checks.chainId all pass. to and from are compared case-insensitively; data is compared by hash.

  • If any check fails, do not sign. Inspect the failed fields and re-simulate.

  • If you get HTTP 404, the simulation expired or the ID is invalid. Simulate again within the five-minute cache window.

How Enso does this

POST https://quoter.api.enso.build/api/v1/validate. See Validating Transactions and How It Works. This pattern is designed to catch modifications between review and signature. Quoter does not change the transaction for you.

FAQ

Can I validate without simulating first?

No. Validate requires a simulationId from a prior simulate call.

What if I only want a preview, not a tamper check?

You can read amountOut and gas from simulate alone, but you should still validate before the user signs if you relied on that preview.

Related articles

  • How do I read Quoter validation checks?

  • What happens if calldata changes after I simulate?

  • Why did Quoter return a 404 on validate?

  • Does Enso Quoter change my transaction?

  • How do I simulate or validate a transaction I built myself?

Sources

Did this answer your question?