https://github.com/ambitioncx/evm-cfg-py
Creating Control Flow Graph (CFG) for Ethereum Smart Contract and Transaction execution path
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (9.3%) to scientific vocabulary
Repository
Creating Control Flow Graph (CFG) for Ethereum Smart Contract and Transaction execution path
Basic Info
Statistics
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
- Releases: 0
Metadata Files
README.md
Control Flow Graph for EVM
Using UV
You need to install UV at first
How to use UV for python version management
uv python list: View available Python versions.uv python install python3.x: Install Python versions.uv python uninstall python3.x: Uninstall a Python version.
How to manage Python projects with UV
uv init: Create a new Python project with apyproject.tomlfile, which contains all information for this project, similar topackage.jsonin Node.js project.uv add: Add a dependency to the project, instead ofpip install,uv addwill add the package topyproject.tomlenvironment.uv remove: Remove a dependency from the project.uv sync: Sync the project's dependencies with the environment, similar tonpm install.uv lock: Create a lockfile for the project's dependencies.uv run: Run a command in the project environment.uv tree: View the dependency tree for the project.
What each file does
main.py, evm_information.py, basic_block.py, cfg_transaction.py, cfg_contract.py, and cfg_static_complete.py are the main files for this project.
evm_information.pyretrieves and standardizes execution traces and contract bytecode from an Ethereum node, serving as a clean data interface for downstream analysis.basic_block.pysplits EVM bytecode into basic blocks, enabling structural analysis of smart contract execution.cfg_transaction.pydraws the transaction execution CFG of a certain transaction.cfg_contract.pydraws the contract CFG of the executed path of a certain contract.cfg_static_complete.pydraws the static CFG of a certain contract.
The results of the 3 CFGs above are saved in the folder
Result/.
Run the following command to draw the CFGs:
bash
python main.py
Tool files for detecting Swap patterns
find_call_nodes.pyextracts the nodes containing"CALL"and"SSTORE"from the (dynamic) contract CFG.
The results are saved in the folderResult_call_nodes/.
Run the following command to extract the nodes:
bash
python find_call_nodes.py
find_trace_opcode.pyextracts the steps with opcodes"CALL"or"SSTORE"from the execution trace.
It first targets a certain contract in a transaction, and then extracts the relevant steps.
The results are saved in the folderResult_call_sstore/.
Run the following command to extract the steps:
bash
python find_trace_opcode.py
Owner
- Name: AmbitionCX
- Login: AmbitionCX
- Kind: user
- Repositories: 14
- Profile: https://github.com/AmbitionCX
GitHub Events
Total
- Push event: 16
- Fork event: 1
- Create event: 2
Last Year
- Push event: 16
- Fork event: 1
- Create event: 2
Issues and Pull Requests
Last synced: 10 months ago