To install XAR you will need golang version 13 or higher and make.
Update your environment.
sudo apt-get update
sudo apt-get -y upgrade
Install build-essential to install make
apt-get -y build-essential
Install golang
wget https://dl.google.com/go/go1.13.3.linux-amd64.tar.gz
sudo tar -xvf go1.13.3.linux-amd64.tar.gz
sudo mv go /usr/local
Setup golang environment variables
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
mkdir -p $HOME/go/src/github.com/xar-network
cd $HOME/go/src/github.com/xar-network/
git clone https://github.com/xar-network/xar-network.git
cd xar-network/
make install
Confirm your xard version
xard version --long
name: xar
server_name: xar
client_name: xarcli
version: 2.0.7-48-g46a704d
commit: 46a704d317584a38ed0d307e55030f050605389e
build_tags: netgo,ledger
go: go version go1.13.3 linux/amd64
Confirm your xarcli version
xarcli version --long
name: xar
server_name: xar
client_name: xarcli
version: 2.0.7-48-g46a704d
commit: 46a704d317584a38ed0d307e55030f050605389e
build_tags: netgo,ledger
go: go version go1.13.3 linux/amd64
First initialize en empty chain with your moniker
xard init <moniker>
Copy over the genesis.json so that it matches the mainnet configuration
curl https://raw.githubusercontent.com/xar-network/genesis/master/genesis.json > $HOME/.xard/config/genesis.json
Copy over the config.toml so that it matches the mainnet configuration (or see below to manually edit)
curl https://raw.githubusercontent.com/xar-network/genesis/master/config.toml > $HOME/.xard/config/config.toml
Edit the config.toml to add your moniker
vi $HOME/.xard/config/config.toml# A custom human readable name for this node
moniker = "<moniker-here>"
You can instead simply edit the config.toml, change the following variables
# Time to wait before flushing messages out on the connection
flush_throttle_timeout = "25ms"timeout_propose = "2s"
timeout_propose_delta = "500ms"
timeout_prevote = "1s"
timeout_prevote_delta = "500ms"
timeout_precommit = "1s"
timeout_precommit_delta = "500ms"
timeout_commit = "1s"# Reactor sleep duration parameters
peer_gossip_sleep_duration = "25ms"
Lastly, add the seed nodes;
# Comma separated list of seed nodes to connect to
seeds = "1e0553f274dfc0a804dfa519eaace49dbff51ac1@34.250.125.195:26656,535c42c3f80f1e73b6d25f731caa57f0ca9f55dd@34.255.175.156:26656,06d418e3c110884f85a9f67e1d16aeb523b8195c@63.33.124.239:26656,84d764244913bddbf0067df16289aece2b17b5cc@34.245.237.110:26656,29ef8ef118c74a8bf71150ded103cb5f386e1e49@52.51.127.79:26656"
Start the node and let it sync
xard start
First you need a xar wallet, you can create one via the cli tool
xarcli keys add <key-name>Enter keyring passphrase:
Re-enter keyring passphrase:- name: key-name
type: local
address: xar1zppm70tq2xx9xz95tdn9umqcvl7dta6x4nvjs2
pubkey:
mnemonic: ""
threshold: 0
pubkeys: []**Important** write this mnemonic phrase in a safe place.
It is the only way to recover your account if you ever forget your password.
Next go to the bridge https://bnbridge.exchenage
Choose your incoming transaction (ERC20 if you are transferring from Ethereum to native FTM, or BEP2 if you are transferring from Binance to native FTM)
ERC20 to FTM selected
Select FTM as the token and specify your xar receive address, created above with the xarcli tool. Select Next
Transfer your FTM on Ethereum and select Next, your Xar account will be credited with your native uFTM. 1 FTM = 1,000,000 uFTM.
Now that you have an account with FTM, you can deposit the FTM as collateral (maximum 150%, recommended 300%) and mint ucsdt. We can do this via the xarcli tool
xarcli tx csdt modifycsdt <key-name> uftm 10000000000000 0 --chain-id=xar-chain-dora
If you are running the cli API you can confirm the deposited amount via the REST call.
xarcli rest-server --trust-nodehttp://localhost:1317/csdts?collateralDenom=uftm&owner=xar1zppm70tq2xx9xz95tdn9umqcvl7dta6x4nvjs2&underCollateralizedAt=0
Which will give you the following output based on the above command
{"height":"0","result":[
{
"owner": "xar1zppm70tq2xx9xz95tdn9umqcvl7dta6x4nvjs2",
"collateral_denom": "uftm",
"collateral_amount": "10000000000000",
"debt": "0"
}
]}
You can confirm the current prices for uftm <> ucsdt from the price oracle
http://localhost:1317/oracle/currentprice/uftm
With output
{"height":"0","result":{
"asset_code": "uftm",
"price": "0.011592000000000000",
"expiry": "20000"
}}
So with 10,000,000 FTM (10,000,000,000,000 uFTM) and 300% collateralization we can mint up to 38,640,000,000 ucsdt. So let’s mint 30,000,000,000 ucsdt (30,000 CSDT)
xarcli tx csdt modifycsdt <key-name> uftm 0 30000000000 --chain-id=xar-chain-dora
After this we can confirm our balance has increased by 30,000,000,000 ucsdt
http://localhost:1317/auth/accounts/xar1zppm70tq2xx9xz95tdn9umqcvl7dta6x4nvjs2{"height":"2844","result":{"type":"cosmos-sdk/Account","value":{"address":"xar1zppm70tq2xx9xz95tdn9umqcvl7dta6x4nvjs2","coins":[{"denom":"ucsdt","amount":"30000000000"}],"public_key":"","account_number":14,"sequence":2}}}
First we need to get our validator ID
xard tendermint show-validator
Next we can issue our create-validator command using ucsdt as collateral
xarcli tx staking create-validator --amount=30000000000ucsdt --pubkey=<key from xard tendermint show-validator> --moniker=<moniker> --chain-id=xar-chain-dora --commission-rate="0.10" --commission-max-rate="0.20" --commission-max-change-rate="0.01" --min-self-delegation="1" --gas="auto" --from=<key-name>
You can view if your validator was added via the validators list
http://localhost:1317/staking/validators