Last active
June 22, 2018 20:45
-
-
Save rnkhouse/798f0d84b3dced3fb4bd47152b63cb78 to your computer and use it in GitHub Desktop.
This file contains 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=0xa0460659ac0fb42e19590b1ed27bd8835e97392417fa8d6d5fcd02015fcf36a3 | |
#AION_MINER_CPU_URL=https://github.com/aionnetwork/aion_miner/releases/download/0.2.1_1/aionminer_CPU.tar.bz2 | |
#AION_MINER_CUDA_URL=https://github.com/aionnetwork/aion_miner/releases/download/0.2.1_1/aionminer_CUDA.tar.bz2 | |
#AION_SOLO_POOL_URL=https://github.com/aionnetwork/aion_miner/releases/download/v0.2.2/aion-solo-pool-0.2.2-2018-04-24.tar.gz | |
#AION_SOLO_POOL=aion-solo-pool-0.2.2-2018-04-24.tar.gz | |
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 nodejs | |
sudo apt-get install -y build-essential | |
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 | |
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 | |
# Solo miner setup (from build): | |
#cd /home/$USER && wget $AION_SOLO_POOL_URL | |
#if [ ! -d /home/$USER/aion_solo_pool ]; then | |
# cd /home/$USER && mkdir aion_solo_pool | |
# cd /home/$USER && tar xvzf $AION_SOLO_POOL -C /home/$USER/aion_solo_pool | |
# cd /home/$USER && rm $AION_SOLO_POOL | |
#fi | |
# Solo miner setup (manual): | |
#if [ ! -d /home/$USER/aion_miner ]; then | |
# cd /home/$USER && git clone https://github.com/aionnetwork/aion_miner.git | |
#fi | |
#cd /home/$USER/aion_miner/aion_solo_pool/local_modules/equihashverify && sudo npm install --save nan | |
#cd /home/$USER/aion_miner/aion_solo_pool/local_modules/equihashverify && sudo npm install --save bindings | |
#cd /home/$USER/aion_miner/aion_solo_pool/local_modules/equihashverify && sudo npm install --save async | |
#cd /home/$USER/aion_miner/aion_solo_pool/local_modules/equihashverify && node-gyp configure | |
#cd /home/$USER/aion_miner/aion_solo_pool/local_modules/equihashverify && node-gyp build | |
#cd /home/$USER/aion_miner/aion_solo_pool/local_modules/equihashverify && node test.js | |
#cd /home/$USER/aion_miner/aion_solo_pool/local_modules/equihashverify && sudo npm install | |
#cd /home/$USER/aion_miner/aion_solo_pool && npm install async | |
echo -e $purpleColor"solo miner has been installed!"$normalColor | |
# Reference mining CPU: | |
#if [ ! -d /home/$USER/cpu/aionminer ]; then | |
# cd /home/$USER/ && mkdir cpu | |
# cd /home/$USER/cpu && wget $AION_MINER_CPU_URL | |
# cd /home/$USER/cpu && tar xvjf aionminer_CPU.tar.bz2 | |
# rm /home/$USER/cpu/aionminer_CPU.tar.bz2 | |
#fi | |
##################################################################### CUDA: ########################################################## | |
#echo -e $purpleColor"CUDA installation started..."$normalColor | |
#sudo apt install g++ git cmake -y | |
#cd /home/$USER && wget https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.bz2 | |
#tar --bzip2 -xf boost_1_66_0.tar.bz2 | |
#rm /home/$USER/boost_1_66_0.tar.bz2 | |
#cd /home/$USER/boost_1_66_0 && ./bootstrap.sh | |
#cd /home/$USER/boost_1_66_0 && sudo ./b2 install | |
#cd /home/$USER && wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_9.1.85-1_amd64.deb | |
#sudo dpkg -i cuda-repo-ubuntu1604_9.1.85-1_amd64.deb | |
#rm /home/$USER/cuda-repo-ubuntu1604_9.1.85-1_amd64.deb | |
#sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub | |
#sudo apt-get update | |
#sudo apt-get install cuda -y | |
#LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda-9.0/lib64:/usr/local/cuda-9.1/lib64/stubs" | |
#PATH="$PATH:/usr/local/cuda-9.1:/usr/local/cuda-9.1/bin" | |
#echo -e $purpleColor"CUDA installation ended!"$normalColor | |
# Either run below 2 commands or use build from github release mentioned below. | |
#cd /home/$USER/aion_miner && mkdir build | |
#cd /home/$USER/aion_miner/build && cmake ../aion_reference_miner -DCUDA_CUDART_LIBRARY=/usr/local/cuda/lib64/libcudart.so && make | |
# Reference mining GPU: | |
#if [ ! -f /home/$USER/aionminer ]; then | |
# cd /home/$USER && wget $AION_MINER_CUDA_URL | |
# cd /home/$USER && tar xvjf aionminer_CUDA.tar.bz2 | |
# rm /home/$USER/aionminer_CUDA.tar.bz2 | |
#fi | |
#echo -e $purpleColor"reference miner has been installed!"$normalColor | |
# Smartminer: (http://looppool.org/) | |
#if [ ! -f /home/$USER/SmartMiner.v3 ]; then | |
# cd /home/$USER && wget https://github.com/smartbitcoin/SmartMiner/releases/download/v0.3/SmartMiner.v3.tar.bz2 | |
# cd /home/$USER && tar xvjf SmartMiner.v3.tar.bz2 | |
# rm /home/$USER/SmartMiner.v3.tar.bz2 | |
#fi | |
#echo -e $purpleColor"smart miner has been installed!"$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%<SYNC>INFO</SYNC>%<SYNC>DEBUG</SYNC>%g" /home/$USER/aion/config/config.xml | |
###################################################################################################################################### | |
# 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