{"id":13392659,"url":"https://github.com/raineorshine/solgraph","last_synced_at":"2025-05-15T16:09:15.788Z","repository":{"id":37663721,"uuid":"62669862","full_name":"raineorshine/solgraph","owner":"raineorshine","description":"Visualize Solidity control flow for smart contract security analysis.  :dollar: ⇆ :dollar:","archived":false,"fork":false,"pushed_at":"2022-12-04T15:07:40.000Z","size":519,"stargazers_count":1031,"open_issues_count":5,"forks_count":122,"subscribers_count":26,"default_branch":"master","last_synced_at":"2025-05-12T02:05:30.930Z","etag":null,"topics":["ethereum","solidity"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/raineorshine.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-07-05T21:10:07.000Z","updated_at":"2025-04-22T06:51:44.000Z","dependencies_parsed_at":"2023-01-23T01:15:13.005Z","dependency_job_id":null,"html_url":"https://github.com/raineorshine/solgraph","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raineorshine%2Fsolgraph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raineorshine%2Fsolgraph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raineorshine%2Fsolgraph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raineorshine%2Fsolgraph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raineorshine","download_url":"https://codeload.github.com/raineorshine/solgraph/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254374483,"owners_count":22060612,"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","solidity"],"created_at":"2024-07-30T17:00:32.633Z","updated_at":"2025-05-15T16:09:15.742Z","avatar_url":"https://github.com/raineorshine.png","language":"JavaScript","funding_links":[],"categories":["Tools","Software Development","JavaScript","Developer Tools","Roadmap","Solidity","Utilities","\u003ca id=\"1d9dec1320a5d774dc8e0e7604edfcd3\"\u003e\u003c/a\u003e工具-新添加的"],"sub_categories":["Visualization","Risk Management","Other dialects and variants","\u003ca id=\"8f1b9c5c2737493524809684b934d49a\"\u003e\u003c/a\u003e文章\u0026\u0026视频","Audits"],"readme":"# solgraph\n\n[![npm version](https://img.shields.io/npm/v/solgraph.svg)](https://npmjs.org/package/solgraph)\n[![Build Status](https://travis-ci.org/raineorshine/solgraph.svg?branch=master)](https://travis-ci.org/raineorshine/solgraph)\n\nGenerates a [DOT](\u003chttps://en.wikipedia.org/wiki/DOT_(graph_description_language)\u003e) graph that visualizes function control flow of a Solidity contract and highlights potential security vulnerabilities.\n\n![Screenshot](https://raw.githubusercontent.com/raineorshine/solgraph/master/example.png)\n\n**Legend:**\n\n- Red: Send to external address\n- Blue: Constant function\n- Yellow: View\n- Green: Pure\n- Orange: Call\n- Purple: Transfer\n- Lilac: Payable\n\n**Generated from contract:**\n\n```js\ncontract MyContract {\n  uint balance;\n\n  function MyContract() {\n    Mint(1000000);\n  }\n\n  function Mint(uint amount) internal {\n    balance = amount;\n  }\n\n  function Withdraw() {\n    msg.sender.send(balance);\n  }\n\n  function GetBalance() constant returns(uint) {\n    return balance;\n  }\n}\n```\n\n## Install\n\n```sh\nnpm install -g solgraph\n```\n\nDepending on your permissions, you may need to add the `unsafe-perm` flag:\n\n```sh\nsudo npm install -g solgraph --unsafe-perm=true --allow-root\n```\n\n## Usage\n\n```sh\nsolgraph MyContract.sol \u003e MyContract.dot\nstrict digraph {\n  MyContract\n  Mint [color=gray]\n  Withdraw [color=red]\n  UNTRUSTED\n  GetBalance [color=blue]\n  MyContract -\u003e Mint\n  Withdraw -\u003e UNTRUSTED\n}\n```\n\nYou have to have [graphviz](https://graphviz.gitlab.io/download/) installed (`brew install graphviz`) to render the [DOT](\u003chttps://en.wikipedia.org/wiki/DOT_(graph_description_language)\u003e) file as an image:\n\n```sh\ndot -Tpng MyContract.dot -o MyContract.png\n```\n\nA nice example of piping contract source that is in your clipboard through solgraph, dot, and preview: (Use whatever image previewer is available on your system; Preview.app is available on Mac)\n\n```sh\npbpaste | solgraph | dot -Tpng | open -f -a /Applications/Preview.app\n```\n\n## Node Module\n\n```js\nimport { readFileSync } from 'fs'\nimport solgraph from 'solgraph'\n\nconst dot = solgraph(fs.readFileSync('./Simple.sol'))\nconsole.log(dot)\n/*\nFoo\nBar\nFoo -\u003e Bar\n*/\n```\n\n## License\n\nISC © [Raine Revere](https://github.com/raineorshine)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraineorshine%2Fsolgraph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraineorshine%2Fsolgraph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraineorshine%2Fsolgraph/lists"}