How to Decode Calldata Before You Sign: Etherscan and cast
Part of our guide to multisig best practices

Quick answer. To decode calldata before signing, copy the raw data from your wallet extension, not the Safe page, and decode it against the verified ABI with Etherscan or cast. Unpack every MultiSend inner call, check full addresses and raw amounts, and stop on anything unexplained.
Video transcript
The page that proposes a transaction can lie. Decode the raw bytes yourself, with your own tools, before your device signs.
On February 21, 2025, Bybit's signers approved a malicious Safe transaction. Bybit said preliminary forensic work found compromised Safe developer credentials, used to deceive them.
Calldata is a four-byte selector plus arguments in thirty-two byte words. It never says which contract runs, what native value moves, or whether it is a delegatecall.
Copy raw data from your wallet extension, not the Safe page. Pick the right chain and use the verified ABI. A four byte lookup is only a candidate.
Foundry's cast decodes against a signature you supply, but a clean decode does not check the selector. Recompute it with cast sig, then re-encode with cast calldata and compare.
Batches hide the real work. MultiSend packs inner transactions as records of 85 bytes plus data. Split them and decode each one.
Guardian's review of an Ethena Safe guard found it checked only the outer transaction. An allowlisted batch could self-call enable module, a Medium finding, acknowledged.
Run every check on every transaction. Apply token decimals, have a second signer decode independently, and if any row fails, do not sign.
Read the full guide for the commands. Guardian's OpSec audit tests whether your signers catch a malicious transaction before approving.
Why Decode It Yourself
On February 21, 2025, Bybit's signers approved a malicious Safe transaction. The FBI later attributed the theft to North Korea.[1, 2]
Bybit said preliminary forensic work by Sygnia and Verichains found compromised Safe developer credentials, used to deceive its signers. Our Bybit hack breakdown traces the full chain.[3]
The practical lesson: the page that proposes a transaction can lie. Read the bytes yourself, with your own tools, before your device signs them.
Our guide to verifying a Safe transaction before signing covers hashes, simulation and the device. This guide goes deep on one step: turning raw data into a call you can check.
What Calldata Contains
An ordinary contract call starts with a four-byte selector: the first four bytes of the Keccak-256 hash of the canonical signature, such as transfer(address,uint256).[4]
Encoded arguments follow in 32-byte words. An address is padded to a full word, and dynamic values such as bytes sit behind offsets.
The encoding does not describe itself. Without the right interface, the same bytes are just hex; Ethereum calldata explained walks through the offsets byte by byte.
Calldata is also only one field you sign. In Safe v1.5.0, owners sign to, value, data, operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver and nonce.[5]
The signature's domain binds the chain ID and the Safe's address. The data field alone never says which contract runs it, what native value moves, or whether it is a delegatecall.
Know where each party sits. In a token transfer, the target is the token contract and the recipient is an argument; approve instead authorizes a spender.[6]
When a device cannot decode these bytes, it shows a hash or raw data instead. That gap is what blind signing means.
Decoding With Etherscan and 4byte
Start with the bytes, not the label. The safe-tx-hashes-util maintainer advises copying the raw data from your wallet extension, not from the Safe interface's copy button.[7]
Safe's own guidance is to paste that raw data into Etherscan's decoder, which it links at etherscan.io/inputdatadecoder, or another decoder, and read the result.[8]
A decoder is only as good as its ABI. Etherscan's contract API is chain specific and returns a verified contract's ABI, plus Proxy and Implementation fields.[9]
So select the right chain first. If the target is a proxy, decode against the implementation that is live now, not one you remember.
4byte Directory is the fallback when no verified ABI exists. It maps selectors to signatures people have submitted.[10]
Search 0xa9059cbb and the results list transfer(address,uint256) alongside several other signatures that share the same four bytes.
Treat every lookup result as a candidate. A matching selector says what the bytes could mean, not what the target implements or what its code does.[11]
Decoding With cast
Foundry's cast decodes against a signature you supply. In the v1.10.0 source, decode-calldata parses that signature and decodes the bytes locally, with no RPC or signature lookup.[12, 13, 14]
Foundry's latest stable release is v1.10.0, published November 19, 2026; later nightly builds are prereleases. Check each flag against the version you have installed.[15, 16, 17]
Try it on a benign, synthetic transfer. It is not a real transaction, and the recipient is a placeholder:
cast decode-calldata "transfer(address,uint256)" 0xa9059cbb000000000000000000000000111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000f4240
By the ABI rules, it should decode to the address 0x1111111111111111111111111111111111111111 and the raw amount 1000000. The 68 bytes are the selector plus two 32-byte words.[4]
Raw amounts need the token's decimals. 1000000 is one token only if the token uses six decimals, and ERC-20 makes decimals optional.[6]
A clean decode does not confirm the selector. In v1.10.0, decode-calldata drops the first four bytes without comparing them to your signature.
So recompute it: cast sig "transfer(address,uint256)" should return 0xa9059cbb, the first four bytes of the data.[10, 18]
cast calldata "transfer(address,uint256)" 0x1111111111111111111111111111111111111111 1000000 re-encodes the call. Compare its output with the bytes you were sent.
Three neighboring commands behave differently, and mixing them up gives wrong answers:
- cast decode-abi --input takes arguments without the selector. Without --input, it decodes return data instead.[19]
- cast 4byte-calldata looks up unknown selectors through Sourcify's signature service, not 4byte.directory.[20]
- cast pretty-calldata --offline lays out the words and skips that lookup.[21]
Nested MultiSend and Delegatecall Payloads
Batches hide the real work one level down. A Safe batch delegatecalls the MultiSend library, whose single bytes argument packs every inner transaction.[22]
Decode the wrapper first: cast decode-calldata "multiSend(bytes)" "$DATA". You get one long bytes value, not a list.[12]
The records inside are packed, not ABI-encoded. Each holds 1 byte of operation, 20 bytes of target, 32 bytes of value, 32 bytes of data length, then the data.
So each record runs 85 bytes plus its data. Split them in order, then decode each inner data field like any other call.
Watch for a zero target. In the v1.5.0 batch libraries, an inner target of zero resolves to the current execution address, which under the Safe's delegatecall is the Safe itself.[11, 23]
Confirm your library version before relying on that reading. Safe's deployment directory lists several Safe versions.[24]
MultiSend allows inner delegatecalls. MultiSendCallOnly rejects them, but the outer Safe transaction still delegatecalls the library, and its inner calls can still do harm.
Delegatecall runs the target's code with the Safe's storage, address and balance. A familiar function name on an unknown delegatecall target is no comfort.
Guardian's review of an Ethena Safe guard found this gap in code. The guard checked only the outer transaction, so an allowlisted MultiSendCallOnly batch could self-call enableModule unchecked (Medium, acknowledged).[25]
A signer reading only the outer label sees a trusted batcher. Reading each inner record shows the zero target and the module change.
A Signer's Decode Checklist
Run every row for every transaction, routine ones included. Record the result as an ordered call table: depth, target, operation, value, function, arguments and ABI source.
Decoding shows what the bytes say. Hash tools such as OpenZeppelin Safe Utils and safe-tx-hashes-util bind them to what you sign; Safe recommends several tools and devices.[8]
Simulation is a third view. Safe suggests reading Tenderly's contracts, events and full trace; the hash utility's simulation overrides owners, threshold, nonce and guards, so its success is not proof.[7]
Some hardware wallets decode transactions on their own screen. Our comparison of hardware wallets for multisig signers shows which ones.
If any row fails, do not sign. Safe's guidance is to withhold a signature until verification is complete.
Guardian's OpSec audit tests this routine: how transactions are proposed, verified and signed, and whether a signer detects a malicious one before approving.[26]
| Check | Evidence | Stop if |
|---|---|---|
| Source of bytes | Raw data copied from the wallet extension | The only copy came from the proposing page |
| Chain and target | Chain ID and full address, matched to your address book | Any address or chain you cannot verify |
| ABI source | Verified ABI of the live implementation | Only a selector guess, or an unresolved proxy |
| Function | Selector recomputed with cast sig | The function differs from what was requested |
| Arguments | Full addresses; raw amounts with decimals applied | A recipient, spender or amount nobody explained |
| Value and refund fields | Values the approved operation needs | Native value or reimbursement nobody explained |
| Operation | Call, or delegatecall to your approved batch library | Delegatecall to any other target |
| Batch records | Every inner record decoded, in order | Unexplained bytes, or a self-call or inner delegatecall nobody approved |
| Re-encoding | cast calldata output matches the bytes | Any byte differs |
| Second reviewer | Another signer decodes independently | Tools or reviewers disagree |
Find out what your signers would miss
A disguised transaction only needs enough signers to approve bytes they never read. Guardian can test your proposal, decoding and signing routine before an attacker does.
Frequently Asked Questions
Is empty calldata always safe to sign?
No. Empty data names no function, but the target, native value, operation and refund fields still decide what happens. Check them as you would for any contract call.[5]
What if the target contract has no verified ABI?
Ask the proposer for the source and the exact signature, then have a technical reviewer re-encode and confirm the call. Custom encodings and routers need their own schema before anyone signs.
Should a contract call always carry zero native value?
Not always. Payable functions and configured gas reimbursements are legitimate. The test is whether each value and refund field matches the operation your team approved, not whether it reads zero.[5]
Related reading
- How to Verify a Safe Transaction Before Signing: 5 Steps
- What Is Blind Signing? The Risk Behind Bybit and Radiant
- Ethereum Calldata Explained: Decoding a Real Multicall
- Safe Multisig Monitoring: Owner, Module and Guard Alerts
- Bybit Hack Explained: How a Tampered Frontend Stole $1.5B
Sources
- FBI Internet Crime Complaint Center: North Korea Responsible for $1.5 Billion Bybit Hack
- BleepingComputer: Lazarus hacked Bybit via breached Safe{Wallet} developer machine
- Bybit via Australian Associated Press: Bybit Confirms Security Integrity Amid Safe (Wallet) Incident - No Compromise in Infrastructure
- Solidity: Contract ABI Specification
- Safe: Safe.sol, v1.5.0
- Ethereum: ERC-20: Token Standard
- pcaversaccio: Safe Multisig Transaction Hashes
- Safe: How to verify Safe{Wallet} transactions on a hardware wallet
- Etherscan: Get Contract Source Code
- 4byte Directory: Function signatures matching 0xa9059cbb
- Solidity: Introduction to Smart Contracts
- Foundry: cast decode-calldata
- Foundry: Cast command dispatch, v1.10.0
- Foundry: Foundry ABI helpers, v1.10.0
- Foundry: Foundry releases
- Foundry: Foundry v1.10.0
- Foundry: Cast package manifest, v1.10.0
- Foundry: Cast: ABI encoding
- Foundry: cast decode-abi
- Foundry: cast 4byte-calldata
- Foundry: cast pretty-calldata
- Safe: MultiSend.sol, v1.5.0
- Safe: MultiSendCallOnly.sol, v1.5.0
- Safe: Smart Account Supported Networks
- Guardian: Ethena Execution Guard: M-02
- Guardian: How to Verify a Safe Transaction Before Signing: 5 Steps
- Foundry: CLI reference versions
- Guardian: GMX Token Delisting Procedure: H-02
- Guardian: Ethereum Calldata Explained: Decoding a Real Multicall
- Guardian: What Is Blind Signing? The Risk Behind Bybit and Radiant
- Guardian: TVL Behind Upgradeable Contracts Without a Timelock
- Guardian: Best Hardware Wallets for Multisig Signers in 2026
- Guardian: How the EVM Works: Stack, Memory, Calldata and Storage
- Guardian: Safe Multisig Monitoring: Owner, Module and Guard Alerts
- Foundry: Foundry workspace manifest, v1.10.0