{"id":13759378,"url":"https://github.com/ApeWorX/evm-trace","last_synced_at":"2025-05-10T09:32:29.519Z","repository":{"id":37845724,"uuid":"471168057","full_name":"ApeWorX/evm-trace","owner":"ApeWorX","description":"Ethereum Virtual Machine transaction tracing tool","archived":false,"fork":false,"pushed_at":"2024-12-16T16:03:38.000Z","size":1120,"stargazers_count":308,"open_issues_count":8,"forks_count":31,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-20T06:37:30.993Z","etag":null,"topics":["ethereum","python","smart-contracts","web3"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ApeWorX.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-17T22:58:52.000Z","updated_at":"2025-04-17T16:12:42.000Z","dependencies_parsed_at":"2024-04-09T16:38:01.876Z","dependency_job_id":"c7f47fc3-fc00-49bd-996c-c8f03bdc20e8","html_url":"https://github.com/ApeWorX/evm-trace","commit_stats":{"total_commits":111,"total_committers":7,"mean_commits":"15.857142857142858","dds":0.7297297297297297,"last_synced_commit":"4f7497e5544ad9e252e279bc66b1c0f1e46ef8b6"},"previous_names":[],"tags_count":36,"template":false,"template_full_name":"ApeWorX/project-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ApeWorX%2Fevm-trace","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ApeWorX%2Fevm-trace/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ApeWorX%2Fevm-trace/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ApeWorX%2Fevm-trace/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ApeWorX","download_url":"https://codeload.github.com/ApeWorX/evm-trace/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253397085,"owners_count":21901992,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ethereum","python","smart-contracts","web3"],"created_at":"2024-08-03T13:00:51.963Z","updated_at":"2025-05-10T09:32:26.197Z","avatar_url":"https://github.com/ApeWorX.png","language":"Python","funding_links":[],"categories":["dApps directory","I - Tools List"],"sub_categories":["Debugging Tools"],"readme":"# Quick Start\n\nEthereum Virtual Machine transaction tracing tool\n\n## Dependencies\n\n- [python3](https://www.python.org/downloads) version 3.9 to 3.12.\n\n## Installation\n\n### via `pip`\n\nYou can install the latest release via [`pip`](https://pypi.org/project/pip/):\n\n```bash\npip install evm-trace\n```\n\n### via `setuptools`\n\nYou can clone the repository and use [`setuptools`](https://github.com/pypa/setuptools) for the most up-to-date version:\n\n```bash\ngit clone https://github.com/ApeWorX/evm-trace.git\ncd evm-trace\npython3 setup.py install\n```\n\n## Quick Usage\n\n### Geth Style Traces\n\nIf you are using a node that supports the `debug_traceTransaction` RPC, you can use `web3.py` to get trace frames:\n\n```python\nfrom web3 import HTTPProvider, Web3\nfrom evm_trace import TraceFrame\n\nweb3 = Web3(HTTPProvider(\"https://path.to.my.node\"))\ntxn_hash = \"0x...\"\nstruct_logs = web3.manager.request_blocking(\"debug_traceTransaction\", [txn_hash]).structLogs\nfor item in struct_logs:\n    frame = TraceFrame.model_validate(item)\n```\n\nIf you want to get the call-tree node, you can do:\n\n```python\nfrom evm_trace import CallType, get_calltree_from_geth_trace\n\nroot_node_kwargs = {\n    \"gas_cost\": 10000000,\n    \"gas_limit\": 10000000000,\n    \"address\": \"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\",\n    \"calldata\": \"0x00\",\n    \"value\": 1000,\n    \"call_type\": CallType.CALL,\n}\n\n# Where `trace` is a `TraceFrame` (see example above)\ncalltree = get_calltree_from_geth_trace(trace, **root_node_kwargs)\n```\n\n### Parity Style Traces\n\nIf you are using a node that supports the `trace_transaction` RPC, you can use `web3.py` to get trace objects:\n\n```python\nfrom evm_trace import CallType, ParityTraceList\n\nraw_trace_list = web3.manager.request_blocking(\"trace_transaction\", [txn_hash])\ntrace_list = ParityTraceList.model_validate(raw_trace_list)\n```\n\nAnd to make call-tree nodes, you can do:\n\n```python\nfrom evm_trace import get_calltree_from_parity_trace\n\ntree = get_calltree_from_parity_trace(trace_list)\n```\n\n### Gas Reports\n\nIf you are using a node that supports creating traces, you can get a gas report.\n\n```python\nfrom evm_trace.gas import get_gas_report\n\n# see examples above for creating a calltree\ncalltree = get_calltree_from_geth_trace(trace, **root_node_kwargs)\n\ngas_report = get_gas_report(calltree)\n```\n\nFor a more custom report, use the `merge_reports` method to combine a list of reports into a single report.\nPass two or more `Dict[Any, Dict[Any, List[int]]]` to combine reports where `List[int]` is the gas used.\n\nCustomize the values of `Any` accordingly:\n\n1. The first `Any` represents the bytes from the address.\n2. The second `Any` represents the method selector.\n\nFor example, you may replace addresses with token names or selector bytes with signature call strings.\n\nImport the method like so:\n\n```python\nfrom evm_trace.gas import merge_reports\n```\n\n## Development\n\nThis project is in development and should be considered a beta.\nThings might not be in their final state and breaking changes may occur.\nComments, questions, criticisms and pull requests are welcomed.\n\n## License\n\nThis project is licensed under the [Apache 2.0](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FApeWorX%2Fevm-trace","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FApeWorX%2Fevm-trace","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FApeWorX%2Fevm-trace/lists"}