<repo_name>jackrack/vault712<file_sep>/vault712.sh
#!/bin/bash
##Download on https://github.com/jackrack/Vault712

##Config setup
##GrinLog=/root/mw/grin/server/grin.log

##Rust installer function
rust_installer()
{
sudo apt-get update -y
sudo apt-get install build-essential cmake -y	
	
curl https://sh.rustup.rs -sSf | sh
source $HOME/.cargo/env
}

##Clang installer function
clang_installer()
{
sudo apt-get update
sudo apt-get install clang-3.8
}

##Libncurses & zlib1g installer function not yet activated
dependencies_installer()
{
sudo apt-get install libncurses5-dev libncursesw5-dev
sudo apt-get install zlib1g-dev
}

##Grin installer function
main_installer()
{
while true; do
    read -p "Do you wish to install Grin? "  yn
    case $yn in
        [Yy]* ) break;;
        [Nn]* ) exit;;
        * ) echo "Please answer yes or no.";;
    esac
done
cd $HOME
mkdir mw/
cd mw
git clone https://github.com/mimblewimble/grin.git
cd grin
cargo build --verbose
main_menu
}

#Reinstall Grin
reinstall_grin()
{
rm -rf $HOME/mw
cd $HOME
mkdir mw/
cd mw
git clone https://github.com/mimblewimble/grin.git
cd grin
cargo build --verbose
main_menu
}

##Start node function
my_node()
{
cd $HOME/mw/grin/
export PATH=$HOME/mw/grin/target/debug:$PATH
grin
}

##Start spend balance function
my_spendbalance()
{
cd $HOME/mw/grin/
export PATH=/$HOME/mw/grin/target/debug/:$PATH
grin wallet info
echo "Press ENTER To Return"
read continues
}

##Start output function
my_outputs()
{
cd $HOME/mw/grin
export PATH=$HOME/mw/grin/target/debug/:$PATH
grin wallet outputs
echo "Press ENTER To Return"
read continue
}

##Start output function in detail
my_outputs_detailed()
{
cd $HOME/mw/grin
cat wallet.dat
echo "Press ENTER To Return"
read continue
}

##Function to send Grin to an ip address
sendgrinto_ip()
{
echo This option will send Grins to an IP address
cd $HOME/mw/grin/
export PATH=$HOME/mw/grin/target/debug:$PATH
read -p 'Please enter the ip address of recipient to send: ' sendipvar
read -p 'Please enter the amount of Grins to send: ' sendamountvar
grin wallet send -d http$sendipvar:13415 $sendamountvar
echo You have sent $sendamountvar Grins to $sendipvar
echo Press any key to return
read
}

##Start the main part of the application menu if Grin and prerequisites are installed
main_menu()
{

while :
do
    clear
   
	echo " "
	echo -e "Grin has been succesfully installed, please choose one of the options below\n"
	echo "MAIN OPTIONS"
	echo "1) Start Grin"
	echo "2) Shutdown all Grin Nodes & Servers"
	echo ""
	echo "GRIN DEBUG OPTIONS"
    echo "3) View Confirmed & Spendable Balance "
    echo "4) Show Individual Outputs"
    echo "5) Show Detailed Individual Outputs"
    echo ""
    echo "GRIN SEND & RECEIVE OPTIONS"
	echo "6) Send Grin to an IP"
    echo ""
    echo "OPTIONS"
    echo "7) Reinstall Grin (Latest Available)"
	echo "8) Exit"
	echo "====================================="
	
	read m_menu
	
	case "$m_menu" in
	
		1) option_1;;
		2) option_2;;
		3) option_3;;
		4) option_4;;
		5) option_5;;
		6) option_6;;
		7) option_7;;
		8) exit 0;;
		*) echo "Error, invalid input, press ENTER to go back"; read;;
	esac
done
}

option_1()
{
   ##export function, run a new shell starting Grin
   export -f my_node
   $(gnome-terminal --tab -e "bash -c 'my_node'")  
}

option_2()
{
	##shutdown any Grin process
	killall -9 grin
	main_menu
}

option_3()
{   
    ##export function, run a new shell
	export -f my_spendbalance
	$(gnome-terminal --tab -e "bash -c 'my_spendbalance'")
}

option_4()
{
    ##export function, run a new shell
	export -f my_outputs
	$(gnome-terminal --tab -e "bash -c 'my_outputs'")
	
}

option_5()
{
	##export function, run a new shell
	export -f my_outputs_detailed
	$(gnome-terminal --tab -e "bash -c 'my_outputs_detailed'")
}

option_6()
{
	##export function, run a new shell
	export -f sendgrinto_ip
	$(gnome-terminal --tab -e "bash -c 'sendgrinto_ip'")
	
}

option_7()
{
	export -f reinstall_grin
	$(gnome-terminal --tab -e "bash -c 'reinstall_grin'")
}

option_wait()
{
	echo This option will send Grins to Termbin and can be claimed by anyone that knows the url
	export PATH=$HOME/mw/grin/target/debug:$PATH
	read -p 'Please enter amount to send: ' amountvar
	grin wallet send -d $amountvar
	termbinvar="$(echo $amountvar | nc termbin.com 9999)"
	echo Share this url to allow someone to claim the output: "$termbinvar"
	echo Press any key to return
	read
	
}

##Check if Clang is installed
if [ "type -p clang-3.8" ];
then
	:
else
	clang_installer
fi

##Check if Rust is installed
if [ "type -p rustc" ];
then
     :
else 
     rust_installer
fi

##Check if Grin is installed
if [ -d "$HOME/mw/grin/" ];
then
    main_menu
else
    main_installer
fi
<file_sep>/README.md
# Vault 712

Vault 712 is a Grin installer for the MimbleWimble protocol. It will install Grin and all prerequisites on your linux computer. Vault 712 is also an interactive shell that allows you to run the Grin server for mining and the Grin wallet and sending/receiving the cryptocurrency Grin. 

## Getting Started

1) Run the command below to download the script

```
wget https://raw.githubusercontent.com/jackrack/Vault712/master/vault712.sh
```

2) Run the main shell script by executing ```./vault712``` on the command line interface 

3) Run ```chmod +x on vault712.sh``` to make sure you have permissions to run it on the command line interface

4) Follow the instructions in the terminal prompt to proceed with the installation

![alt text](https://user-images.githubusercontent.com/32465294/34165766-18ca3724-e4d5-11e7-9077-427a79e215d2.png)

**This script has been updated and is now compatible with Testnet 3**

This script is mainly used for testing and fast deployment of the latest Grin as well as testing features in the latest Grin build. 

The installation script works independently of starting a node and server, and can be closed and opened independently to run different optional commands for Grin. 

### Requirements

* Linux - Primary platform (x86 only, at present)
* Ubuntu 16.04 or later
* zlib1g-dev, libncurses5-dev and libncursesw5-dev currently need to be manually installed

### What will be installed

- Clang 3.6
- Latest Rust, if not already installed (NOTE! If you run older than Rust 1.26, Grin might not work, and you will manually have to update before running this script) 
- The latest Grin with wallet and server. (NOTE! Grin is constantly updated and this script does not autoupdate. You need to delete the folder mw in $HOME to install the latest Grin with this script
- An interactive shell wallet to send the cryptocurrency Grin

## Information

* More about Grin: https://github.com/mimblewimble/grin
* More about Grin compared to Bitcoin: https://github.com/mimblewimble/grin/blob/master/doc/grin4bitcoiners.md
* More information about Grin: http://grin-tech.org/
* More information about MimbleWimble & Grin development: https://lists.launchpad.net/mimblewimble/
* Grin forum: https://www.grin-forum.org
