All Projects → raineorshine → Solgraph

raineorshine / Solgraph

Licence: isc
Visualize Solidity control flow for smart contract security analysis. 💵 ⇆ 💵

Programming Languages

javascript
184084 projects - #8 most used programming language
solidity
1140 projects

Labels

Projects that are alternatives of or similar to Solgraph

Qtbitcointrader
Secure multi crypto exchange trading client
Stars: ✭ 520 (-13.19%)
Mutual labels:  ethereum
Etherchain Light
Lightweight Ethereum blockchain explorer
Stars: ✭ 550 (-8.18%)
Mutual labels:  ethereum
Ethjs
A highly optimised, light-weight JS utility for Ethereum.
Stars: ✭ 574 (-4.17%)
Mutual labels:  ethereum
Btcrelay
Ethereum contract for Bitcoin SPV: Live on https://etherscan.io/address/0x41f274c0023f83391de4e0733c609df5a124c3d4
Stars: ✭ 533 (-11.02%)
Mutual labels:  ethereum
Randao
RANDAO: A DAO working as RNG of Ethereum
Stars: ✭ 541 (-9.68%)
Mutual labels:  ethereum
Brainflayer
A proof-of-concept cracker for cryptocurrency brainwallets and other low entropy key alogrithms.
Stars: ✭ 561 (-6.34%)
Mutual labels:  ethereum
React Box
Truffle, Webpack and React boilerplate.
Stars: ✭ 516 (-13.86%)
Mutual labels:  ethereum
Kelp
Kelp is a free and open-source trading bot for the Stellar DEX and 100+ centralized exchanges
Stars: ✭ 580 (-3.17%)
Mutual labels:  ethereum
Ethql
A GraphQL interface to Ethereum 🔥
Stars: ✭ 547 (-8.68%)
Mutual labels:  ethereum
Echidna
Ethereum smart contract fuzzer
Stars: ✭ 571 (-4.67%)
Mutual labels:  ethereum
Ethereumjs Util
Project is in active development and has been moved to the EthereumJS monorepo.
Stars: ✭ 534 (-10.85%)
Mutual labels:  ethereum
Btcpool Abandoned
backend of pool.btc.com
Stars: ✭ 541 (-9.68%)
Mutual labels:  ethereum
Lionshare Desktop
🦁 Simple cryptocurrency price and portfolio monitor for macOS
Stars: ✭ 570 (-4.84%)
Mutual labels:  ethereum
Web3modal
A single Web3 / Ethereum provider solution for all Wallets
Stars: ✭ 515 (-14.02%)
Mutual labels:  ethereum
Augur Core
Augur back-end (Ethereum contracts)
Stars: ✭ 575 (-4.01%)
Mutual labels:  ethereum
Eth Tweet
Decentralized Twitter: A microblogging service running on the Ethereum blockchain
Stars: ✭ 519 (-13.36%)
Mutual labels:  ethereum
Awesome Blockchain Articles
A collection of awesome blockchain articles. Good learning resources about blockchain.
Stars: ✭ 552 (-7.85%)
Mutual labels:  ethereum
Nbminer
NVIDIA & AMD GPU Miner for ETH, RVN, GRIN, BEAM, CFX, AE, SERO
Stars: ✭ 568 (-5.18%)
Mutual labels:  ethereum
Status Go
The Status module that consumes go-ethereum
Stars: ✭ 579 (-3.34%)
Mutual labels:  ethereum
Rainbow
🌈‒ the Ethereum wallet that lives in your pocket
Stars: ✭ 568 (-5.18%)
Mutual labels:  ethereum

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].