{"id":21330,"library":"faster-eth-abi","title":"faster-eth-abi","description":"A ~2-6x faster fork of eth_abi: Python utilities for encoding and decoding Ethereum ABI definitions, implemented in C for performance. Current stable version: 5.2.27. Requires Python >=3.10, <4. Released on a continuous cadence.","status":"active","version":"5.2.27","language":"python","source_language":"en","source_url":"https://github.com/BobTheBuidler/faster-eth-abi","tags":["ethereum","abi","encoding","decoding","c-extension","performance"],"install":[{"cmd":"pip install faster-eth-abi","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Drop-in replacement; users may mistakenly import from eth_abi instead of faster_eth_abi","package":"eth-abi","optional":false}],"imports":[{"note":"faster-eth-abi is a separate package; importing from eth_abi uses the slower upstream version","wrong":"from eth_abi import decode_single","symbol":"decode_single","correct":"from faster_eth_abi import decode_single"},{"note":"Same as above; use faster_eth_abi for the C-accelerated version.","wrong":"from eth_abi import encode_single","symbol":"encode_single","correct":"from faster_eth_abi import encode_single"}],"quickstart":{"code":"from faster_eth_abi import encode_single, decode_single\n\n# Encode a uint256 value\nencoded = encode_single('uint256', 42)\nprint(encoded.hex())  # e.g., '000000000000000000000000000000000000000000000000000000000000002a'\n\n# Decode back\ndecoded = decode_single('uint256', encoded)\nprint(decoded)  # 42\n\n# Encode a tuple\nfrom faster_eth_abi import encode_abi\ntypes = ['address', 'uint256']\nvalues = ['0x1234567890abcdef1234567890abcdef12345678', 100]\nencoded = encode_abi(types, values)\nprint(encoded.hex())","lang":"python","description":"Basic encoding and decoding of Ethereum ABI types."},"warnings":[{"fix":"Replace all imports of form `from eth_abi import ...` with `from faster_eth_abi import ...`. Also update dependencies to require faster-eth-abi instead of eth-abi.","message":"faster-eth-abi is a fork of eth_abi but they are separate packages. Installing faster-eth-abi does not replace eth_abi; if your code imports from eth_abi, you will not see performance gains.","severity":"gotcha","affected_versions":"all"},{"fix":"Upgrade Python to 3.9+ (now 3.10+). Use only public API: `from faster_eth_abi import encode_single, decode_single, encode_abi, decode_abi`.","message":"Version 5.0.0 introduced breaking changes: removed support for Python 3.7 and 3.8, and changed internal module structure. Code relying on private modules may break.","severity":"breaking","affected_versions":"<5.0.0 (old) vs >=5.0.0 (new)"},{"fix":"Use keyword arguments: `decode_abi(types=types, data=data)`.","message":"The function `decode_abi` with positional arguments has been deprecated in favor of keyword argument style. In older versions: `decode_abi(types, data)`; now recommend `decode_abi(types, data)` still works but future versions may change.","severity":"deprecated","affected_versions":">=5.0.0"},{"fix":"Ensure array types are correctly specified: dynamic arrays use '[]', static use '[size]'. Validate with decode_abi after encoding.","message":"When encoding arrays, the type string must match exactly (e.g., 'uint256[]' not 'uint256[1]' for dynamic arrays). Using an incorrect type may produce silent data corruption.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Upgrade to latest version: `pip install --upgrade faster-eth-abi`. Ensure Python >=3.10.","cause":"Version mismatch or incomplete installation. Older versions (pre-5.0) used a different API.","error":"AttributeError: module 'faster_eth_abi' has no attribute 'decode_single'"},{"fix":"Use `bytes.fromhex(address[2:])` or ensure address is a bytes-like object. Example: `encode_single('address', bytes.fromhex('1234...'))`.","cause":"Addresses must be bytes (20 bytes) or hex strings with '0x' prefix. Passing a plain string (e.g., '0x...') without bytes conversion works if it's a valid hex, but a Python str that isn't a hex address fails.","error":"TypeError: Encoding 'str' to 'address' is not supported"},{"fix":"Pad hex string with a leading zero: '0x0123'.","cause":"Hex string has odd number of characters (e.g., '0x123').","error":"ValueError: The value provided must be an even-length string."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}