Last active
June 27, 2018 16:42
-
-
Save rnkhouse/eb3c313848b16047afec002697a8aa21 to your computer and use it in GitHub Desktop.
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
# Server requirement: Ubuntu 16.04 | |
# mount aion to separate storage: | |
# IMPORTANT: Run this script from /home/<USER>/ directory: bash -c "$(curl SCRIPT_URL)" | |
set -e | |
purpleColor='\033[0;95m' | |
normalColor='\033[0m' | |
USER=$(whoami) | |
# Variables: | |
AION_KERNEL_URL=https://github.com/aionnetwork/aion/releases/download/v0.2.8/aion-v0.2.8.ef5df39c-2018-06-15.tar.bz2 | |
AION_KERNEL=aion-v0.2.8.ef5df39c-2018-06-15.tar.bz2 | |
AION_ADDRESS=0xa03ba9611637a9dd7ff03c7d69449336f940f73e1b42ce0a46c9b65a0128d3c4 | |
sudo apt-get update | |
# Aion install: | |
cd /home/$USER && wget $AION_KERNEL_URL | |
tar xvjf $AION_KERNEL | |
rm $AION_KERNEL | |
# Install latest nodejs and dependencies: | |
curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash - | |
sudo apt-get install -y git | |
sudo apt-get install -y nodejs | |
sudo apt-get install -y build-essential | |
sudo apt-get install -y libssl-dev | |
sudo apt-get install -y pkg-config | |
sudo apt-get install -y libboost-all-dev | |
sudo apt-get install -y libsodium-dev | |
sudo apt -y install cmake | |
sudo npm install pm2 -g | |
sudo npm install -g node-gyp | |
sudo apt install xsel | |
cd /home/$USER && sudo chown ronak:ronak .config | |
echo -e $purpleColor"node js and npm dependencies has been installed!"$normalColor | |
# Redis cache: | |
if [ ! -d /home/$USER/redis-stable ]; then | |
cd /home/$USER && wget http://download.redis.io/redis-stable.tar.gz | |
cd /home/$USER && tar xvzf redis-stable.tar.gz | |
cd /home/$USER && rm redis-stable.tar.gz | |
cd /home/$USER/redis-stable && make | |
fi | |
echo -e $purpleColor"redis cache is now up to date!"$normalColor | |
# Install libsodium: | |
if [ ! -d /home/$USER/libsodium-stable ]; then | |
cd /home/$USER && wget https://download.libsodium.org/libsodium/releases/LATEST.tar.gz | |
cd /home/$USER && tar -xvzf LATEST.tar.gz | |
cd /home/$USER && rm LATEST.tar.gz | |
fi | |
echo -e $purpleColor"libsodium is now up to date!"$normalColor | |
cd /home/$USER/libsodium-stable && ./configure | |
cd /home/$USER/libsodium-stable && make && make check | |
cd /home/$USER/libsodium-stable && sudo make install | |
echo -e $purpleColor"libsodium configuration is done!"$normalColor | |
# Update confix.xml | |
sed -i "s%<mining>true</mining>%<mining>false</mining>%g" /home/$USER/aion/config/config.xml | |
sed -i "s%0000000000000000000000000000000000000000000000000000000000000000%$AION_ADDRESS%g" /home/$USER/aion/config/config.xml | |
sed -i "s%<threads>1</threads>%<threads>8</threads>%g" /home/$USER/aion/config/config.xml | |
sed -i "s%<apis-enabled>web3,eth,personal,stratum</apis-enabled>%<apis-enabled>web3,eth,personal,stratum,net</apis-enabled>%g" /home/$USER/aion/config/config.xml | |
#sed -i "s%<SYNC>INFO</SYNC>%<SYNC>DEBUG</SYNC>%g" /home/$USER/aion/config/config.xml | |
# Postgresql (>v10): | |
if [ ! -f /etc/apt/sources.list.d/pgdg.list ]; then | |
sudo echo "deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main" >> /etc/apt/sources.list.d/pgdg.list | |
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - | |
sudo apt-get update | |
sudo apt-get install postgresql-10 -y | |
sudo -u postgres createuser -s $USER | |
sudo -u postgres createuser miningcore | |
sudo -u postgres createdb miningcore | |
fi | |
# .NET: | |
cd /home/$USER/ && wget -q https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb | |
cd /home/$USER/ && sudo dpkg -i packages-microsoft-prod.deb | |
cd /home/$USER/ && rm packages-microsoft-prod.deb | |
sudo apt-get install apt-transport-https | |
sudo apt-get update | |
sudo apt-get install aspnetcore-runtime-2.1 -y | |
# Yarn: | |
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - | |
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list | |
sudo apt update | |
sudo apt install yarn | |
# APIN POOL: | |
cd /home/$USER/ && git clone https://github.com/aionnetwork/aion_pool2.git | |
cd /home/$USER/aion_pool2/aion_pool/src/MiningCore/Persistence/Postgres/Scripts && sudo -u postgres psql -d miningcore -f createdb.sql | |
cd /home/$USER/aion_pool2/aion_pool/src/MiningCore && ./linux-build.sh | |
cd /home/$USER/aion_pool2/aion_pool/build && cp ../examples/aion_pool.json . | |
###################################################################################################################################### | |
# New Commands: | |
# 1) sudo -u postgres psql | |
# After login: alter user miningcore with encrypted password '{PASSWORD}'; | |
# grant all privileges on database miningcore to miningcore; | |
# \q (to quit) | |
# 2) Start Pool: | |
# cd /home/$USER/aion_pool2/aion_pool/build && pm2 start dotnet -- MiningCore.dll -c aion_pool.json | |
# 3) UI: (https://github.com/aionnetwork/aion_pool2/tree/master/ui) | |
# cd /home/$USER/aion_pool2/ui && yarn | |
# cd /home/$USER/aion_pool2/ui && yarn build | |
# cd /home/$USER/aion_pool2/ui && yarn global add serve | |
# cd /home/$USER/aion_pool2/ui && sudo npm install -g serve | |
# cd /home/$USER/aion_pool2/ui && pm2 start serve -- -s build -n | |
# Start servers: | |
# Create account: cd /home/$USER/aion && ./aion.sh -a create | |
# cd /home/$USER/redis-stable && pm2 start ./src/redis-server --name redis_server | |
# cd /home/$USER/aion && pm2 start ./aion.sh --name aion | |
# cd /home/$USER/aion_solo_pool && pm2 start ./run.sh --name aion_solo_miner | |
# OR | |
# cd /home/$USER/aion_miner/aion_solo_pool && pm2 start ./run.sh --name aion_solo_miner | |
# Cuda install for Azure: | |
# AZURE_CUDA_INSTALL=https://gist.githubusercontent.com/rnkhouse/436f728dd8dddf556edfa4e3c01c219c/raw/65b6f5f4cbd653cab420f2f48485d08ee474c0d2/azure_cuda_installer.sh | |
# bash -c "$(curl $AZURE_CUDA_INSTALL)" | |
# After chain sync is done: | |
# cd /home/$USER/cpu && pm2 start ./aionminer -- -t 6 --location 127.0.0.1:3333 | |
# OR | |
# cd /home/$USER && pm2 start ./aionminer -- -cd 0 -cv 1 -cb 64 -ct 64 --location 127.0.0.1:3333 | |
# OR | |
# cd /home/$USER/aion_miner/build && ./aionminer -cd 0 -cv 1 -cb 64 -ct 64 --location 127.0.0.1:3333 | |
# pm2 start ./aionminer -- -cd 0 1 2 3 -cv 1 -cb 64 -ct 64 --location aion.rnkhouse.com:3333 -u 0xa0460659ac0fb42e19590b1ed27bd8835e97392417fa8d6d5fcd02015fcf36a3 | |
# pm2 start ./SmartMiner.v3 -- -l aion.rnkhouse.com:3333 -cd 0 1 2 3 -u 0xa06dc1f0daa40ea95f80fbe9def2fc021bb075df6f22e108b43d25c48423e4df | |
################################################################################################################################### | |
# Web3 API calls: | |
# Balance check: web3.fromWei(web3.eth.getBalance(web3.eth.coinbase)).toString() | |
# Balance check: web3.fromWei(web3.eth.getBalance("0xa0460659ac0fb42e19590b1ed27bd8835e97392417fa8d6d5fcd02015fcf36a3")).toString() | |
# Unlock account: web3.personal.unlockAccount("0xaion_address","password","6000") | |
# Transaction: web3.eth.sendTransaction({from: '0xfrom_account', to: '0xto_account', value: web3.toWei(whole_AION_to_send)}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment