Skip to content

Commit

Permalink
add install.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
whonion committed Jun 23, 2023
1 parent abd7942 commit cc6d1f4
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 11 deletions.
13 changes: 2 additions & 11 deletions .env
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
PRIVATE_KEY = '0x.......................................................'
RPC_PROVIDER='https://eth-goerli.g.alchemy.com/v2/{YOUR_API_KEY}'
PRIVATE_KEY = '<YOUR_PRIVATE_KEY>'
RPC_PROVIDER='https://ethereum-goerli.publicnode.com'
CHAIN_ID = 5
#CHAIN_ID_INFURA= 59140
#RPC_PROVIDER = 'https://eth-mainnet.g.alchemy.com/v2/{YOUR_API_KEY}'
#INFURA_MAINNET='https://mainnet.infura.io/v3/{YOUR_API_KEY}'
#INFURA_POLIGON='https://polygon-mainnet.infura.io/v3/{YOUR_API_KEY}'
#INFURA_OPTIMISM='https://optimism-mainnet.infura.io/v3/{YOUR_API_KEY}'
#INFURA_ARBITRUM'https://arbitrum-mainnet.infura.io/v3/{YOUR_API_KEY}'
#INFURA_AVAX='https://avalanche-mainnet.infura.io/v3/{YOUR_API_KEY}'
#INFURA_PALM='https://palm-mainnet.infura.io/v3/{YOUR_API_KEY}'
#CONSENSYS='https://consensys-zkevm-goerli-prealpha.infura.io/v3/{YOUR_API_KEY}'

#FAUCETS: https://faucetlink.to/
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ tmux new -s contract_deploy \
```sh
go run main.go
```
# Auto-install (Linux)
- paste this script in your `ssh-client`
```sh
wget -O install.sh https://github.com/whonion/go-solc-batch-deployer/raw/main/install.sh ; chmod +x install.sh; ./install.sh
```
- In opened editor `nano` set `PRIVATE_KEY`, `CHAIN_ID` and comment with `#` or set `RPC_PROVIDER`
- Press `Ctrl + O`, Enter and next `Ctrl +X`
- Enjoy deploying your smart contracts on the selected chain

[sol-releases]: https://github.com/ethereum/solidity/releases

Expand Down
64 changes: 64 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/bin/bash

green='\033[0;32m'
clear='\033[0m'

echo -e "${green}Loading packages...${clear}"
sudo apt-get update

echo -e "${green}Upgrading packages...${clear}"
sudo apt-get upgrade -y

echo -e "${green}Installing required packages...${clear}"
sudo apt-get install build-essential git make gcc tmux htop nvme-cli pkg-config libssl-dev libleveldb-dev tar clang bsdmainutils ncdu unzip libleveldb-dev nano -y

ver="1.20"
echo -e "${green}Downloading Go version $ver...${clear}"
wget "https://golang.org/dl/go$ver.linux-amd64.tar.gz"

echo -e "${green}Removing previous Go installation...${clear}"
sudo rm -rf /usr/local/go

echo -e "${green}Extracting Go...${clear}"
sudo tar -C /usr/local -xzf "go$ver.linux-amd64.tar.gz"
rm "go$ver.linux-amd64.tar.gz"

echo -e "${green}Configuring Go environment...${clear}"
echo "export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin" >> $HOME/.bash_profile
source $HOME/.bash_profile

echo -e "${green}Verifying Go installation...${clear}"
go version

echo -e "${green}Installing tmux...${clear}"
sudo apt-get install tmux

echo -e "${green}Adding Ethereum repository...${clear}"
sudo add-apt-repository ppa:ethereum/ethereum -y

echo -e "${green}Installing solc...${clear}"
sudo apt-get install solc

echo -e "${green}Verifying solc installation...${clear}"
solc --version

echo -e "${green}Cloning go-solc-batch-deployer repository...${clear}"
rm -rf go-solc-batch-deployer
git clone https://github.com/whonion/go-solc-batch-deployer.git

echo -e "${green}Changing directory to go-solc-batch-deployer...${clear}"
cd go-solc-batch-deployer

echo -e "${green}Opening .env file for editing...${clear}"
nano .env

echo -e "${green}Creating a new tmux session...${clear}"
tmux new-session -d -s contract_0

echo -e "${green}Sending commands to the tmux session...${clear}"
tmux send-keys -t contract_0 'cd $HOME/go-solc-batch-deployer' Enter
sleep 1
tmux send-keys -t contract_0 'go run main.go' Enter

echo -e "${green}Attaching to the tmux session...${clear}"
tmux attach-session -t contract_0

0 comments on commit cc6d1f4

Please sign in to comment.