Solgraph

Visualize Solidity control flow for smart contract security analysis. 💵 ⇆ 💵
Alternatives To Solgraph
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Openzeppelin Contracts21,813511,03321 hours ago63September 07, 2022180mitJavaScript
OpenZeppelin Contracts is a library for secure smart contract development.
Smart Contract Best Practices6,529
3 months ago22
A guide to smart contract security best practices
Capstone6,26522 days ago2April 12, 2022349otherC
Capstone disassembly/disassembler framework: Core (Arm, Arm64, BPF, EVM, M68K, M680X, MOS65xx, Mips, PPC, RISCV, Sparc, SystemZ, TMS320C64x, Web Assembly, X86, X86_64, XCore) + bindings.
Awesome Solidity5,801
4 days ago7
⟠ A curated list of awesome Solidity resources, libraries, tools and more
Quorum4,319221 hours ago200March 14, 202226lgpl-3.0Go
A permissioned implementation of Ethereum supporting data privacy
Meshbird3,446
2 months agoJanuary 30, 201612apache-2.0Go
Distributed private networking
Manticore3,371118 days ago723July 07, 2022261agpl-3.0Python
Symbolic execution tool
Mythril3,0838310 days ago292June 20, 202292mitPython
Security analysis tool for EVM bytecode. Supports smart contracts built for Ethereum, Hedera, Quorum, Vechain, Roostock, Tron and other EVM-compatible blockchains.
Lighthouse2,269
20 hours ago1December 29, 2021271apache-2.0Rust
Ethereum consensus client in Rust
Echidna2,017
18 hours ago128agpl-3.0Solidity
Ethereum smart contract fuzzer
Alternatives To Solgraph
Select To Compare


Alternative Project Comparisons
Readme

solgraph

npm version Build Status

Generates a DOT graph that visualizes function control flow of a Solidity contract and highlights potential security vulnerabilities.

Screenshot

Legend:

  • Red: Send to external address
  • Blue: Constant function
  • Yellow: View
  • Green: Pure
  • Orange: Call
  • Purple: Transfer
  • Lilac: Payable

Generated from contract:

contract MyContract {
  uint balance;

  function MyContract() {
    Mint(1000000);
  }

  function Mint(uint amount) internal {
    balance = amount;
  }

  function Withdraw() {
    msg.sender.send(balance);
  }

  function GetBalance() constant returns(uint) {
    return balance;
  }
}

Install

npm install -g solgraph

Depending on your permissions, you may need to add the unsafe-perm flag:

sudo npm install -g solgraph --unsafe-perm=true --allow-root

Usage

solgraph MyContract.sol > MyContract.dot
strict digraph {
  MyContract
  Mint [color=gray]
  Withdraw [color=red]
  UNTRUSTED
  GetBalance [color=blue]
  MyContract -> Mint
  Withdraw -> UNTRUSTED
}

You have to have graphviz installed (brew install graphviz) to render the DOT file as an image:

dot -Tpng MyContract.dot -o MyContract.png

A 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)

pbpaste | solgraph | dot -Tpng | open -f -a /Applications/Preview.app

Node Module

import { readFileSync } from 'fs'
import solgraph from 'solgraph'

const dot = solgraph(fs.readFileSync('./Simple.sol'))
console.log(dot)
/*
Foo
Bar
Foo -> Bar
*/

License

ISC © Raine Revere

Popular Security Projects
Popular Ethereum Projects
Popular Security Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Javascript
Security
Ethereum
Solidity
Flow