Last active
April 26, 2016 23:28
-
-
Save mchlmicy/87af29b36dda08390ca73b81beade007 to your computer and use it in GitHub Desktop.
Quick script for compiling solidity using geth console
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| input=$1 | |
| contract=$2 | |
| if [[ -n "$input" ]]; then | |
| # minify code | |
| code="" | |
| while IFS= read -r line | |
| do | |
| code+=$line | |
| done < "$input" | |
| # compile code | |
| echo "-----------------" | |
| echo "Compiled contract" | |
| echo "-----------------" | |
| geth --exec "eth.compile.solidity('$code')" console | |
| # optional: get abiDefinition | |
| if [[ -n "$contract" ]]; then | |
| echo "" | |
| echo "-------------" | |
| echo "abiDefinition" | |
| echo "-------------" | |
| geth --exec "eth.compile.solidity('$code').$contract.info.abiDefinition" console | |
| fi | |
| else | |
| echo "Please specify a file path." | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment