Skip to main content

A package for decoding and analyzing EVM transactions and logs

Project description

🔍 EVM Decoder

A powerful Python toolkit for decoding and analyzing Ethereum Virtual Machine (EVM) transactions and events. This package provides three core managers for comprehensive blockchain data analysis.

🎯 Core Components

1. DecoderManager

The DecoderManager is responsible for decoding various types of blockchain data:

from evm_decoder import DecoderManager

# Initialize with custom config or use default
decoder_manager = DecoderManager(config_path='path/to/config.json')

# Automatic decoding
result = decoder_manager.decode(event_data)

# Use specific decoder
result = decoder_manager.decode_with_specific_decoder(data, 'my_decoder')

# Add custom decoder
decoder_manager.add_decoder('custom_name', custom_decoder)

Key Features:

  • 🔄 Automatic decoder selection based on input data
  • 📚 Support for transaction and event decoding
  • 🛠 Configurable through JSON configuration file
  • 🔌 Extensible with custom decoders

2. AnalyzerManager

The AnalyzerManager provides deep analysis of transactions and their effects:

from evm_decoder import AnalyzerManager

# Initialize analyzer
analyzer = AnalyzerManager()

# Analyze full transaction
analysis = analyzer.analyze_transaction(tx_with_logs)
# Returns:
# {
#     "balance_analysis": {...},  # Balance changes per address
#     "token_transfers": [...]     # Detailed token transfer events
# }

# Analyze specific aspects
token_transfers = analyzer.analyze_token_transfers(tx_with_logs)
balance_changes = analyzer.analyze_balance_changes(tx_with_logs)

Key Features:

  • 💰 Track token transfers (ERC20, native currency)
  • 📊 Analyze balance changes across addresses
  • 🔄 Support for WETH wrapping/unwrapping events
  • 🧮 Automatic balance calculation and reconciliation

3. ContractManager

The ContractManager handles all smart contract interactions:

from evm_decoder import ContractManager

# Initialize with Web3 provider
contract_manager = ContractManager("https://mainnet.infura.io/v3/YOUR-KEY")

# Read contract data
result = contract_manager.read_contract(
    contract_type="erc20",
    address="0x...",
    method="balanceOf",
    args=["0x..."],
    block_identifier="latest"
)

# Write to contract
tx_hash = contract_manager.write_contract(
    contract_type="erc20",
    address="0x...",
    method="transfer",
    args=["0x...", 1000],
    private_key="your_private_key"
)

# Get contract instance
contract = contract_manager.get_contract("erc20", "0x...")

Key Features:

  • 📚 Automatic ABI management
  • 🔄 Contract instance caching
  • 📖 Read contract data
  • ✍️ Write contract transactions
  • 🔐 Secure transaction signing

🚀 Installation

pip install -r requirements.txt

Required dependencies:

  • web3>=7.5.0: For Ethereum node interaction
  • pandas: For data manipulation
  • chain_index: For chain information

📖 Configuration

Create a decoder_config.json file:

{
    "transaction_decoders": [
        {
            "type": "transaction",
            "name": "erc20_transfer",
            "abi_path": "abis/erc20.json",
            "fixed_types": {
                "transfer": [
                    {"name": "to", "type": "address"},
                    {"name": "value", "type": "uint256"}
                ]
            }
        }
    ],
    "event_decoders": [
        {
            "type": "event",
            "name": "transfer_event",
            "abi_path": "abis/erc20.json"
        }
    ]
}

🤝 Contributing

We welcome contributions! Please check our contribution guidelines.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

📬 Support

For support and questions:

  • 📚 Check our documentation
  • 🐛 Report issues on GitHub
  • 💬 Join our community discussions

Built with ❤️ for the Ethereum community

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

evm_decoder-0.3.7.tar.gz (18.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

evm_decoder-0.3.7-py3-none-any.whl (23.2 kB view details)

Uploaded Python 3

File details

Details for the file evm_decoder-0.3.7.tar.gz.

File metadata

  • Download URL: evm_decoder-0.3.7.tar.gz
  • Upload date:
  • Size: 18.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for evm_decoder-0.3.7.tar.gz
Algorithm Hash digest
SHA256 2b2d6f7c38027e7ee20feb4a549d22cb1ad19eadf57e9cade4fddca6bcd3d127
MD5 4d6e838d0202afbe9948fa116b907d6e
BLAKE2b-256 bcb72bef6414f810699fcc4dc6e5b6ae924d5132998fe3a21bf3a64a000a795b

See more details on using hashes here.

File details

Details for the file evm_decoder-0.3.7-py3-none-any.whl.

File metadata

  • Download URL: evm_decoder-0.3.7-py3-none-any.whl
  • Upload date:
  • Size: 23.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for evm_decoder-0.3.7-py3-none-any.whl
Algorithm Hash digest
SHA256 bac6c1e900a42427657122d83ce01f47d7fd1a69c9ab1106185eade5492fcba4
MD5 9bc6c6b65c9ba35e5849451958d808f6
BLAKE2b-256 c7e57904718cf55a4a4190f22288b655fcf374f726e1427ed80da515be4bc48e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page