Skip to content

Instantly share code, notes, and snippets.

@mchlmicy
Last active April 26, 2016 23:28
Show Gist options
  • Select an option

  • Save mchlmicy/87af29b36dda08390ca73b81beade007 to your computer and use it in GitHub Desktop.

Select an option

Save mchlmicy/87af29b36dda08390ca73b81beade007 to your computer and use it in GitHub Desktop.
Quick script for compiling solidity using geth console
#!/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