contract-decode

Decodes EVM function selectors, calldata, and revert data using local cast tools and external ABI APIs.

189|25|Updated Jan 30, 2026
One-click install
npx skills add https://github.com/sd0xdev/sd0x-harness --skill contract-decode-sd0xdev
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: contract-decode
Source: https://github.com/sd0xdev/sd0x-harness/tree/main/skills/contract-decode
Command: npx skills add https://github.com/sd0xdev/sd0x-harness --skill contract-decode-sd0xdev

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? When an EVM transaction fails or you encounter raw hex data like 0xaca553e4, it is opaque and hard to interpret. This Skill decodes function selectors, custom errors, calldata, and revert data into human-readable signatures and arguments. ## Core Features & Use Cases - Local Fast Decode: Instantly recognizes standard Error(string) and Panic(uint256) reverts, with panic code lookup, and uses Foundry's cast for offline selector and calldata decoding. - External ABI Resolution: Queries Sourcify (free, no key), Etherscan v2, and 4byte.directory to fetch contract ABIs or signature candidates, including proxy contract implementation resolution via EIP-1967 storage slots. - Confidence-Ranked Reports: Outputs structured decode reports with confidence levels, listing multiple candidates when selector collisions occur. - Use Case: A user pastes revert data 0xaca553e4 from a failed withdrawal transaction; the Skill classifies it as a 4-byte selector, queries 4byte.directory, and returns WithdrawalRequestDoesNotExist() as the matching custom error. ## Quick Start Decode this revert data 0xaca553e4 from my failed transaction on Ethereum mainnet and tell me what error it represents.

Frequently Asked Questions about contract-decode

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I decode EVM revert data like 0xaca553e4?▼

Classify the input by length first: 4-byte hex is a selector, longer data is calldata or revert data. Try local decoding with cast for standard Error(string) and Panic(uint256), then query 4byte.directory or fetch the contract ABI from Sourcify or Etherscan for custom errors.

How to decode Ethereum calldata without a contract ABI?▼

Use the 4byte.directory API to look up the 4-byte selector and get candidate function signatures, then decode the remaining data with cast abi-decode using the candidate signature. Multiple candidates are reported with low confidence when selector collisions occur.

Does decoding work for proxy contracts on Ethereum?▼

Yes, but proxy ABIs only contain admin functions. Detect the proxy via Etherscan getsourcecode or the EIP-1967 storage slot, retrieve the implementation address, then re-query the ABI for the implementation contract and decode against it.

What do Panic(uint256) error codes mean in Solidity?▼

Panic codes indicate runtime failures: 0x01 is an assert failure, 0x11 is arithmetic overflow, 0x12 is division by zero, and 0x32 is array out-of-bounds access. Decode the revert data with cast abi-decode "Panic(uint256)" to extract the code.

Why does selector lookup return multiple function signatures?▼

Function selectors are only 4 bytes, so different signatures can collide on the same selector. The 4byte.directory database may return several candidates; all possibilities are listed with low confidence unless a verified contract ABI confirms one.