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.6.tar.gz (17.5 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.6-py3-none-any.whl (19.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: evm_decoder-0.3.6.tar.gz
  • Upload date:
  • Size: 17.5 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.6.tar.gz
Algorithm Hash digest
SHA256 1da89878cb7944c089534f176923fa07c61b65bba9f1a2cfb192477b8c62787f
MD5 87dcc451d8fa746c86f9c2a1da949035
BLAKE2b-256 bdfc1ad51a29b4df5939cc119d20821c5fa32c4b7ce125542584fd61435a9c77

See more details on using hashes here.

File details

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

File metadata

  • Download URL: evm_decoder-0.3.6-py3-none-any.whl
  • Upload date:
  • Size: 19.7 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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 8957b2bbc228ea3c2db50e72efad623ce040fa7a24b74f2a51d9a4da2fbd35d2
MD5 59a38a742b20fc8a3a323e78b7e051d9
BLAKE2b-256 ba29e2a36d907f25745b511b78f7b7b32cf393ddde242b839882b382fd969d47

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