Processing

Revoke a Risky Token Approval

A stale or malicious token approval lets a spender drain funds. This guide lists an address's approvals, then builds and simulates a revoke transaction so you cut the allowance to zero safely. Applies to ERC-20 approvals on eth.

开始之前
  • The address whose approvals you want to review.
  • An API key with C2 access for data, build and simulate.

1List current approvals

Call the approvals endpoint to see every spender and its allowance. Flag unlimited allowances to unknown contracts.

curl "https://api.1st-node.com/v1/data/eth/address/0x8f2c.../approvals" \
  -H "Authorization: Bearer sk_live_..."
> {"approvals":[{"token":"0xdac1...","spender":"0x7a1d...",
>  "allowance":"unlimited"}]}

2Build a revoke transaction

Build an approve call setting the allowance to zero for the risky spender. The build endpoint returns the raw payload to sign.

curl -X POST https://api.1st-node.com/v1/tx/eth/build \
  -H "Authorization: Bearer sk_live_..." \
  -d '{"from":"0x8f2c...","to":"0xdac1...","amount":"0"}'
> {"raw":"0x02f8...","gas_limit":"46000"}

3Simulate then broadcast

Simulate to confirm the allowance drops to zero and there is no revert, then sign and broadcast the revoke.

curl -X POST https://api.1st-node.com/v1/tx/eth/simulate \
  -H "Authorization: Bearer sk_live_..." \
  -d '{"raw":"0x02f8..."}'
> {"success":true,"revert_reason":null}

常见问题

How do I find risky approvals?

List approvals for the address and flag unlimited allowances or unknown spender contracts. Those are the entries to revoke first.

Why simulate a revoke?

Simulation confirms the allowance resets to zero and the call will not revert or fall short on gas, so the revoke lands the first time.

继续阅读

充值、拿密钥、上线。

自助开通。支持加密货币或银行卡。按额度计费——重型原语更贵,简单调用很便宜。

获取 API 密钥