Skip to content

Commit

Permalink
improve testnet script and use old way for backward compatible (#90)
Browse files Browse the repository at this point in the history
* improve testnet

* update start script

* give message to upgrade script

* update script to remove conflict
  • Loading branch information
liam-lai committed Sep 18, 2023
1 parent 38c50ed commit f003751
Show file tree
Hide file tree
Showing 12 changed files with 84 additions and 27 deletions.
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@

## How to Setup XinFin Masternode
## How to Setup XinFin Masternode

### Method 1:- Setup XinFin’s XDC Masternode One-click Installer ###

To qualify for Masternode on XinFin Network, you need at least **10,000,000 XDC, for the long term.**


**Operating System**:
**Operating System**:

* Apple Mac
* Windows
* Windows
* Linux - Ubuntu

**Step 1: Download [XinFin One-Click Installer](https://xinfin.org/setup-masternode) (to setup Masternode) for Windows, Linux, and Mac OS and Install on your local machine.**
Expand All @@ -31,10 +31,10 @@ https://user-images.githubusercontent.com/92325549/137081568-f1c99c1f-b035-4ef1-

**Step 3: Create a wallet for Masternode**

* Create your wallet address with Mnemonic Phrase or with Keystore. We always recommend to use Keystore for running a Masternode.
* Create your wallet address with Mnemonic Phrase or with Keystore. We always recommend to use Keystore for running a Masternode.
* Enter a strong password while creating the wallet.
* **Don't lose your Keystore file**
* **Don't share it with anyone**
* **Don't share it with anyone**
* **Always take a backup of your Keystore file.**
* **If you lose it, all your funds will get locked.**
* After creating backup, Download your Keystore file.
Expand All @@ -50,7 +50,7 @@ https://user-images.githubusercontent.com/92325549/137081588-b644bef6-5b5c-43c6-
**Step 4: Host your Masternode**

* For hosting the Masternode, you need to copy the private key and login the Masternode.
* For uploading the KYC, click on the "Become a Masternode"
* For uploading the KYC, click on the "Become a Masternode"
* Check the KYC criteria, the KYC file should be in pdf format only.
* Once you upload your KYC, you need to enter the "Coinbase Address" which is in One Click Installer after that click on Apply button.
* Now you will be notify with sucessful toaster i.e **"You have successfully applied for Masternode"**
Expand All @@ -70,19 +70,19 @@ https://user-images.githubusercontent.com/92325549/137086528-4a8c5c44-ce89-4a70-

**For Mainnet**

Bootstrap Command XinFin Node Setup:-
Bootstrap Command XinFin Node Setup:-

```
sudo su -c "bash <(wget -qO- https://raw.githubusercontent.com/XinFinOrg/XinFin-Node/master/setup/bootstrap.sh)" root
```

Examples:-
Examples:-
```
$ sudo su -c "bash <(wget -qO- https://raw.githubusercontent.com/XinFinOrg/XinFin-Node/master/setup/bootstrap.sh)" root
[sudo] password for user:
[sudo] password for user:
Please enter your XinFin Network (mainnet/testnet/devnet) :- mainnet
Your running network is mainnet
Please enter your XinFin MasterNode Name :- Demo_Server
Please enter your XinFin MasterNode Name :- Demo_Server
Your Masternode Name is Demo_Server
```
Expand Down Expand Up @@ -113,13 +113,13 @@ Type 'Y' or 'y' to continue:

### Method 3:- Setup XinFin Masternode Docker ###

**Operating System**: Ubuntu 20.04 64-bit or higher
**Operating System**: Ubuntu 20.04 64-bit or higher

Should be facing internet directly with **public IP** & **without NAT**

**Tools**: Docker, Docker Compose(1.27.4+)

Setup (For Ubuntu 20.04 64-bit or higher Operating System)
Setup (For Ubuntu 20.04 64-bit or higher Operating System)

**Clone repository**
```
Expand Down Expand Up @@ -159,7 +159,7 @@ sudo docker-compose -f docker-compose.yml up -d
```

You should be able to see your node listed on the [XinFin Network](https://XinFin.network/) page.
Select Menu **"Switch to TestNet"** for **TestNetwork** and Select **"Switch to LiveNet"** to check **LiveNetwork** Stats.
Select Menu **"Switch to TestNet"** for **TestNetwork** and Select **"Switch to LiveNet"** to check **LiveNetwork** Stats.

Your coinbase address can be found in xdcchain/coinbase.txt file.

Expand Down Expand Up @@ -196,10 +196,10 @@ sudo docker-compose -f docker-compose.yml down
## Troubleshooting


Public discussions on the technical issues, post articles and request for Enhancements and Technical Contributions.
Public discussions on the technical issues, post articles and request for Enhancements and Technical Contributions.

- [Discord](https://discord.com/invite/KZdD6pkFxp)
- [Telegram](http://bit.do/Telegram-XinFinDev)
- [Reddit](https://www.reddit.com/r/xinfin/)
- [GitHub](https://github.com/XinFinorg)
- [XinFin FAQs](https://howto.xinfin.org/general/faq/)
- [XinFin FAQs](https://howto.xinfin.org/general/faq/)
Empty file modified devnet/.env
100644 → 100755
Empty file.
Empty file modified devnet/.pwd
100644 → 100755
Empty file.
Empty file modified devnet/xdc-attach1.sh
100644 → 100755
Empty file.
Empty file modified devnet/xdc-attach2.sh
100644 → 100755
Empty file.
4 changes: 2 additions & 2 deletions mainnet/start-node.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/bin/bash

if [ ! -d /work/xdcchain/XDC/chaindata ]
if [ ! -d /work/xdcchain/XDC/chaindata ]
then
wallet=$(XDC account new --password /work/.pwd --datadir /work/xdcchain | awk -v FS="({|})" '{print $2}')
echo "Initalizing Genesis Block"
coinbaseaddr="$wallet"
coinbasefile=/work/xdcchain/coinbase.txt
touch $coinbasefile
if [ -f "$coinbasefile" ]
then
then
echo "$coinbaseaddr" > "$coinbasefile"
fi
XDC --datadir /work/xdcchain init /work/genesis.json
Expand Down
7 changes: 0 additions & 7 deletions testnet/.env
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
NODE_NAME=XF_MasterNode
CONTACT_DETAILS=YOUR_EMAIL_ADDRESS
NODE_TYPE=full

PORT=30304
RPC_PORT=8545
WS_PORT=8555

PRIVATE_KEYS=
NETWORK=testnet
LOG_LEVEL=3
2 changes: 1 addition & 1 deletion testnet/cleanup.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

rm -rf ./xdcchain/XDC
rm -rf ./xdcchain-testnet/XDC
3 changes: 2 additions & 1 deletion testnet/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ services:
xinfinnetwork:
image: xinfinorg/xdposchain:v1.4.8-beta
volumes:
- "./xdcchain:/work/xdcchain"
- "./xdcchain-testnet:/work/xdcchain"
- "./start-apothem.sh:/work/start.sh"
restart: "always"
env_file: .env
network_mode: "host"
2 changes: 1 addition & 1 deletion testnet/docker-up.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sudo docker-compose -f docker-compose.yml up -d
docker-compose -f docker-compose.yml up -d --build --force-recreate
46 changes: 46 additions & 0 deletions testnet/start-apothem.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash

if [ ! -d /work/xdcchain/XDC/chaindata ]
then
wallet=$(XDC account new --password /work/.pwd --datadir /work/xdcchain | awk -F '[{}]' '{print $2}')
echo "Initializing Testnet Genesis Block"
echo "wallet: $wallet"
coinbaseaddr="$wallet"
coinbasefile=/work/xdcchain/coinbase.txt
touch $coinbasefile
if [ -f "$coinbasefile" ]
then
echo "$coinbaseaddr" > "$coinbasefile"
cat xdcchain/keystore/* >> "$coinbasefile"
fi
XDC --datadir /work/xdcchain init /work/genesis.json
else
wallet=$(XDC account list --datadir /work/xdcchain| head -n 1 | awk -F '[{}]' '{print $2}')
echo "wallet: $wallet"
fi

input="/work/bootnodes.list"
bootnodes=""
while IFS= read -r line
do
if [ -z "${bootnodes}" ]
then
bootnodes=$line
else
bootnodes="${bootnodes},$line"
fi
done < "$input"
INSTANCE_IP=$(curl https://checkip.amazonaws.com)
netstats="${INSTANCE_NAME}:xdc_xinfin_apothem_network_stats@stats.apothem.network:2000"

echo "Starting nodes with $bootnodes ..."
XDC --ethstats ${netstats} --gcmode=archive \
--bootnodes ${bootnodes} --syncmode ${NODE_TYPE} \
--datadir /work/xdcchain \
--networkid 51 -port 30304 \
--rpc --rpccorsdomain "*" --rpcaddr 0.0.0.0 \
--rpcport 8555 --rpcapi admin,db,eth,debug,net,shh,txpool,personal,web3,XDPoS \
--rpcvhosts "*" --unlock "${wallet}" --password /work/.pwd \
--mine --gasprice "1" --targetgaslimit "420000000" \
--verbosity 2 --ws --wsaddr=0.0.0.0 --wsport 8556 \
--wsorigins "*" 2>&1 >>/work/xdcchain/xdc.log | tee -a /work/xdcchain/xdc.log
17 changes: 17 additions & 0 deletions testnet/upgrade.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh
echo "Upgrading XDC Network Configuration Scripts"
cd testnet
mv .env .env_tmp

git stash
git pull

source .env_tmp
sed -i "s/NODE_NAME=XF_MasterNode/NODE_NAME=$NODE_NAME/" .env
sed -i "s/CONTACT_DETAILS=YOUR_EMAIL_ADDRESS/CONTACT_DETAILS=$CONTACT_DETAILS/" .env
sed -i "s/NODE_TYPE=full/NODE_TYPE=$NODE_TYPE/" .env

bash docker-down.sh
mv xdcchain xdcchain-testnet || true
mv start.sh start-apothem.sh || true
bash docker-up.sh

0 comments on commit f003751

Please sign in to comment.