A CLI wrapper for @openchainxyz/abi-guesser to decode any ABI-encoded data without knowing the ABI.
- 🔍 Guess ABI types from encoded data automatically
- 🎯 Decode function calldata including function selectors
- 📊 Multiple output formats (human-readable or JSON)
- 🚀 No ABI required - works with any properly encoded data
npm install -g decode-anything-cli
# or
yarn global add decode-anything-cligit clone <repository-url>
cd decode-anything-cli
yarn install
yarn buildDecode ABI-encoded data:
decode-anything 0x0000000000000000000000000000000000000000000000000000000000000001Include the 4-byte function selector (first 4 bytes of transaction calldata):
decode-anything --calldata 0xa9059cbb000000000000000000000000...Get machine-readable JSON output:
decode-anything --json 0x0000000000000000000000000000000000000000000000000000000000000001USAGE:
decode-anything <data> [options]
ARGUMENTS:
<data> Hex-encoded data (with or without 0x prefix)
OPTIONS:
-j, --json Output in JSON format
-c, --calldata Decode as function calldata (expects first 4 bytes to be function selector)
-h, --help Show this help message
$ decode-anything 0x0000000000000000000000000000000000000000000000000000000000000001
Guessed Parameter Types:
[0] uint256
Decoded Values:
[0] 1$ decode-anything 0x000000000000000000000000833589fcd6edb6e08f4c7c32d4f71b54bda0291300000000000000000000000000000000000000000000000000000000000186a0
Guessed Parameter Types:
[0] address
[1] uint256
Decoded Values:
[0] 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
[1] 100000$ decode-anything --calldata 0xa9059cbb000000000000000000000000833589fcd6edb6e08f4c7c32d4f71b54bda0291300000000000000000000000000000000000000000000000000000000000186a0
Function Fragment:
guessed_a9059cbb(address,uint256)
Selector: 0xa9059cbb
Parameter Types:
[0] address
[1] uint256
Decoded Values:
[0] 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
[1] 100000$ decode-anything --json 0x0000000000000000000000000000000000000000000000000000000000000001
{
"success": true,
"types": [
{
"type": "uint256",
"baseType": "uint256",
"format": "uint256"
}
]
}
{
"decodedValues": [
"1"
]
}This tool uses the abi-guesser library which:
- Analyzes the structure of ABI-encoded data
- Identifies parameter boundaries using 32-byte padding
- Detects dynamic types using offset pointers
- Infers specific types based on data patterns (addresses, uint sizes, etc.)
Note: This only works with abi.encode() formatted data. Data encoded with abi.encodePacked() cannot be reliably decoded without knowing the types beforehand.
yarn buildyarn dev <data> [options]yarn check-typesyarn lint
yarn format- Only works with properly ABI-encoded data (using
abi.encode()) - Cannot decode
abi.encodePacked()data (no type boundaries) - Type inference may not always be 100% accurate
- Complex nested structures might have ambiguous types
Built on top of @openchainxyz/abi-guesser by the OpenChain team.
MIT