# Defund node

By [fatalist](https://paragraph.com/@fatalist) · 2023-03-28

---

Install Defund node
-------------------

### Update packages, install dependencies

    cd $HOME
    sudo apt update && sudo apt upgrade -y
    sudo apt install make clang pkg-config libssl-dev build-essential git jq ncdu bsdmainutils htop -y < "/dev/null"
    

### Install go

    cd $HOME
    wget -O go1.19.1.linux-amd64.tar.gz https://golang.org/dl/go1.19.1.linux-amd64.tar.gz
    rm -rf /usr/local/go && tar -C /usr/local -xzf go1.19.1.linux-amd64.tar.gz && rm go1.19.1.linux-amd64.tar.gz
    echo 'export GOROOT=/usr/local/go' >> $HOME/.bash_profile
    echo 'export GOPATH=$HOME/go' >> $HOME/.bash_profile
    echo 'export GO111MODULE=on' >> $HOME/.bash_profile
    echo 'export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin' >> $HOME/.bash_profile && . $HOME/.bash_profile
    go version
    

### Download and build binaries

    git clone https://github.com/defund-labs/defund
    cd defund
    git checkout v0.2.6
    make install
    cd $HOME
    

### Initialize node and download genesis:

> Make up your own name for the node and replace it with <<node\_name>>

    defundd init <<node_name>> --chain-id orbit-alpha-1
    
    cd $HOME/.defund/config
    
    curl -s https://raw.githubusercontent.com/defund-labs/testnet/main/orbit-alpha-1/genesis.json > ~/.defund/config/genesis.json
    cd
    

### Adding seeds and peers

    seeds="f902d7562b7687000334369c491654e176afd26d@170.187.157.19:26656,2b76e96658f5e5a5130bc96d63f016073579b72d@rpc-1.defund.nodes.guru:45656"
    peers="f902d7562b7687000334369c491654e176afd26d@170.187.157.19:26656,f8093378e2e5e8fc313f9285e96e70a11e4b58d5@rpc-2.defund.nodes.guru:45656,878c7b70a38f041d49928dc02418619f85eecbf6@rpc-3.defund.nodes.guru:45656"
    sed -i.default "s/^seeds *=.*/seeds = \"$seeds\"/;" $HOME/.defund/config/config.toml
    sed -i "s/^persistent_peers *=.*/persistent_peers = \"$peers\"/;" $HOME/.defund/config/config.toml
    

### Config pruning

    recent=100
    every=0
    interval=10
    
    sed -i.back "s/pruning *=.*/pruning = \"custom\"/g" $HOME/.defund/config/app.toml
    sed -i "s/pruning-keep-recent *=.*/pruning-keep-recent = \"$recent\"/g" $HOME/.defund/config/app.toml
    sed -i "s/pruning-keep-every *=.*/pruning-keep-every = \"$every\"/g" $HOME/.defund/config/app.toml
    sed -i "s/pruning-interval *=.*/pruning-interval = \"$interval\"/g" $HOME/.defund/config/app.toml
    

### Creating service file

    echo "[Unit]
    Description=defund
    After=network.target
    
    [Service]
    User=$USER
    Type=simple
    ExecStart=$(which defundd) start
    Restart=on-failure
    LimitNOFILE=65535
    
    [Install]
    WantedBy=multi-user.target" > $HOME/defund.service
    sudo mv $HOME/defund.service /etc/systemd/system
    sudo tee <<EOF >/dev/null /etc/systemd/journald.conf
    Storage=persistent
    EOF
    

### Start servise

    sudo systemctl restart systemd-journald
    sudo systemctl daemon-reload
    sudo systemctl enable defund 
    
    sudo systemctl restart defund
    

### Create a wallet, save mnemonics

> Think of a name for your wallet and replace it with <<wallet\_name>>

    defundd keys add <<wallet_name>>
    

> (Optional) Recovering a wallet using mnemonics:

    defundd keys add <<wallet_name>> --recover
    

> Check if the node is synchronized, if the result is false - then the node is synchronized:

    curl -s localhost:26657/status | jq .result.sync_info.catching_up
    

### After the node is synchronized you need to request test tokens.

> To do this, go to Faucet in discord [https://discord.gg/qR6y2wkp3e](https://discord.gg/qR6y2wkp3e)

### Check your wallet balance

    defundd q bank balances <<address>>
    

> If your wallet does not show any balance than probably your node is still syncing. Please wait until it finish to synchronize and then continue

### Creating a validator (Replace: <<node\_name>>, <<wallet\_name>>)

    defundd tx staking create-validator \
    --moniker="<<node_name>>" \
    --amount=1000000ufetf \
    --pubkey=$(defundd tendermint show-validator) \
    --chain-id=orbit-alpha-1 \
    --commission-max-change-rate=0.01 \
    --commission-max-rate=0.20 \
    --commission-rate=0.05 \
    --min-self-delegation=1 \
    --from=<<wallet_name>> \
    --yes 
    

Don't forget to buckup **priv\_validator\_key.json** file
---------------------------------------------------------

---

*Originally published on [fatalist](https://paragraph.com/@fatalist/defund-node)*
