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 interactionpandas: For data manipulationchain_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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file evm_decoder-0.3.4.tar.gz.
File metadata
- Download URL: evm_decoder-0.3.4.tar.gz
- Upload date:
- Size: 17.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c8cbd79f05f12314329bdff741595a45e04a222c4858cc89d67c143a30ff093f
|
|
| MD5 |
29bc4baabdb8b2da66ad294a4c197519
|
|
| BLAKE2b-256 |
8fa14b99fb5d1657b41148d7ed1db7698ce11d6f0814f92802dffd66a0628aba
|
File details
Details for the file evm_decoder-0.3.4-py3-none-any.whl.
File metadata
- Download URL: evm_decoder-0.3.4-py3-none-any.whl
- Upload date:
- Size: 19.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d62bb6ba9735776d184232d4aa4c0bc0370b57d81b249f30a3fc0743ebd99106
|
|
| MD5 |
dc56b749810b4849bc3ae262128f55d9
|
|
| BLAKE2b-256 |
6f4e7696a3f0a6789aa0bdba5ced22ec5ed287e446eb6dd4e73609d50f6fe9f4
|