Implementation with go-ethereum
Preview of code execution main.go
- main.go - main executable or build file
- cmd/ - folder from which
solc.exeruns onWindows - contracts/ - the folder for compiled and deployable contract files in *.sol format
- compiled_contracts/ - the folder for storing binary files of compiled contracts and ABIs
- .env - file to store variables such as
RPC-nodeorprivate_key
-
Installed
solc(Linux) or download executable files for Windows from Github -
Installed
Go Lang
sudo apt-get update && sudo apt-get upgrade -y
apt install build-essential gitmake gcc tmux htop nvme-cli pkg-config libssl-dev libleveldb-dev tar clang bsdmainutils ncdu unzip libleveldb-dev -y
ver="1.20" && \
wget "https://golang.org/dl/go$ver.linux-amd64.tar.gz" && \
sudo rm -rf /usr/local/go && \
sudo tar -C /usr/local -xzf "go$ver.linux-amd64.tar.gz" && \
rm "go$ver.linux-amd64.tar.gz" && \
echo "export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin" >> $HOME/.bash_profile && \
source $HOME/.bash_profile && \
go version \
sudo apt-get install tmux \
sudo add-apt-repository ppa:ethereum/ethereum \
sudo apt-get install solc \
solc --version- Clone the repository and navigate to the source folder
git clone https://github.com/whonion/go-solc-batch-deployer.git
cd go-solc-batch-deployer- Add to
.env-fileyour variables:PRIVATE_KEY(without 0x),RPC_PROVIDERandCHAIN_ID
PRIVATE_KEY = '<YOUR_PRIVATE_KEY1>
<YOUR_PRIVATE_KEY2>
<YOUR_PRIVATE_KEY3>
<YOUR_PRIVATE_KEY4>
<YOUR_PRIVATE_KEY5>
<YOUR_PRIVATE_KEY6>
<YOUR_PRIVATE_KEY7>
<YOUR_PRIVATE_KEY8>
<YOUR_PRIVATE_KEYn>'
#Specify your instant RPC-node
#RPC_PROVIDER='https://ethereum-goerli.publicnode.com'
#Specify CHAIN_IDs for deploy contracts (In Example contracts'll deploy to Goerly and Sepolia chains for all PRIVATE_KEYs)
CHAIN_ID = '5,11155111'-
Add correct files *.sol to the
contactsfolder for deployment on the required chain -
Create new session with
tmux
tmux new -s contractdeploy \- Run
main.go
go run main.go- paste this script in your
ssh-client
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
nanosetPRIVATE_KEY,CHAIN_IDand comment with#or setRPC_PROVIDER - Press
Ctrl + O, Enter and nextCtrl +X - Enjoy deploying your smart contracts on the selected chain
