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.5.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.5-py3-none-any.whl (19.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: evm_decoder-0.3.5.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.5.tar.gz
Algorithm Hash digest
SHA256 0e2ffe642afa6e64fcc1cbda5a96659b322ebc331519dd9eaec19f4328300b4b
MD5 c36af22b291e1732ae61ac28e2b164f9
BLAKE2b-256 a6554dce30d07fd4341c74c4fff180178177d137284717c6bd8fbf9184819e63

See more details on using hashes here.

File details

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

File metadata

  • Download URL: evm_decoder-0.3.5-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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 326fd3cfa86dd13b52cda922736178e97f4b9da83881316a793854b6a3dfef76
MD5 fadedf9e709b37751128ba71687c84c3
BLAKE2b-256 6a61097ee34377aeb1ad78ee8bdbf45ec13720ee94c5c4e9fcf1555743294dda

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