Zen Protocol Documentation
WebsiteTelegramBlogForum
  • Zen Protocol Docs
  • Apps
    • Headless Full Node
      • Full Node NPM Package
      • Build from Source
      • CLI
      • API
        • Wallet
        • Contracts
        • General
        • Blockchain
        • AddressDB
      • Deploy
        • Systemd
        • Shell script
        • Docker
      • Technical Model
      • AddressDB
    • Wallet
      • Desktop Wallet
        • Installers
      • Web Wallet
        • Run Locally
      • Wallet User Guide
        • Connect a Wallet
          • Create a Wallet
          • Import a Wallet
          • Watch Mode
        • My Wallet
          • Navigation Bar
          • Portfolio
          • Receive
          • Send / Execute
          • Transaction History
        • Contracts
          • Active Contracts
          • Execute a Contract
            • Message Body Field
          • Extend a Contract
          • Activate a Contract
        • Voting
          • Common Goods Pool
            • Generating a Ballot ID
          • Governance
        • Signer
        • Settings
          • Account Settings
          • Node Connectivity
      • Deprecated Desktop Wallet
        • Executable Installers
        • Wallet Structure
          • Video Tutorials
    • Explorer
    • Zen.js
      • Payment Processing
    • Oracle
      • Oracle GUI
      • Oracle Service
      • Oracle's API
      • Deploy
        • Systemd
        • Docker
      • How the Oracle contract works
      • How to create an Attestation token
    • Dex
      • Dex User Guide
        • Traded Pairs
        • Search Pairs
        • Order Book
        • Operations
        • My Wallet
        • Settings
      • How DEX contract works
    • Fixed Payout
      • Fixed Payout Generator User Guide
        • Issue
        • Redeem
        • Cancel
        • Verify
        • Settings
      • How the FP Contract works
      • How are the asset named?
  • Smart Contracts
  • Contract Structure
  • Contract Cost
  • Contract Activation
  • Contract Examples
  • Smart Contracts SDK
  • Contracts Language ZF*
  • Named Token Tutorial
  • Consensus
  • Common Goods Pool
  • Block Validation
  • Transaction Validation
  • Serialization
  • Use Cases
    • Create Unsigned Transaction
    • Secure Sign Transaction
    • Cold Storage using Full Node
  • Troubleshooting
    • Responsible Disclosure
    • Bug Bounty
    • Known Bugs
  • For Miners
    • Pools
    • GPU Mining
    • GPU Bounties
  • Check Crowdsale Contribution
  • Alpha call option
Powered by GitBook
On this page
  • Normal Node
  • Address Node (Explorer and Exchange)
  1. Apps
  2. Headless Full Node
  3. Deploy

Shell script

To fast install of a full node use the following

Normal Node

#!/bin/bash

# install mono-devel and other libs needed to get ZEN NODE up and running.
install_mono(){

  echo "Adding Mono-devel Repo"
  sudo apt install gnupg ca-certificates -y
  sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
  echo "deb https://download.mono-project.com/repo/ubuntu stable-bionic main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list

  sudo apt update
  sudo apt upgrade -y

  # install mono-devel, Lighting Memory-Mapped Database lib and unzip
  sudo apt install mono-devel -y
  sudo apt install liblmdb0 -y
  sudo apt install unzip -y

}


#---------------------------------------------------------------------------------------
#ENTRY POINT

# check for mono-devel.
which mono || install_mono  # only install and upgrade the system if mono-devel is missing


# NVM Sections
echo "---------------------------------------------------"
echo "NVM SETUP."
sudo echo ' '

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"

nvm install --lts
npm config set @zen:registry https://www.myget.org/F/zenprotocol/npm/
npm install @zen/zen-node -g


# set data path location for the database
DATAPATH="$HOME/.config/zen-node"

echo "---------------------------------------------------"
echo "Generating Zen-Node Service File..."

# generate the service file then save it appropriately
printf "[Unit]
Description=Zen Node
After=network.target

[Service]
Type=simple
WorkingDirectory=$HOME/.nvm/versions/node/$(node --version)/lib/node_modules/@zen/zen-node/Release/
ExecStart=/usr/bin/mono $HOME/.nvm/versions/node/$(node --version)/lib/node_modules/@zen/zen-node/Release/zen-node.exe --data-path "$DATAPATH" --api "*:11567"
Restart=on-failure

[Install]
WantedBy=multi-user.target
" | sudo tee /etc/systemd/system/zen-node.service


# check for the blockchain DB, if present, continue.
# if absent, check for the zipped version and extract it.
# if no zipped version present, download the one hosted.
if [[ ! -s $DATAPATH ]] ; then
  echo "---------------------------------------------------"
  if [[ ! -s "zen-node.zip" ]] ; then
    echo "Downloading Blockchain..."
    # download zen-node.zip from s3
    wget https://node-backups.s3-eu-west-1.amazonaws.com/zen-node.zip
  fi

  echo "Unziping The BlockchainDB in $DATAPATH..."
  unzip zen-node.zip -d "$HOME/.config"

fi

echo "---------------------------------------------------"
echo "Starting ZEN NODE...."
sudo systemctl enable zen-node.service
sudo systemctl start zen-node.service
sudo journalctl -f -u zen-node.service

Address Node (Explorer and Exchange)

#!/bin/bash

# install mono-devel and other libs needed to get ZEN NODE up and running.
install_mono(){

  echo "Adding Mono-devel Repo"
  sudo apt install gnupg ca-certificates -y
  sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
  echo "deb https://download.mono-project.com/repo/ubuntu stable-bionic main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list

  sudo apt update
  sudo apt upgrade -y

  # install mono-devel, Lighting Memory-Mapped Database lib and unzip
  sudo apt install mono-devel -y
  sudo apt install liblmdb0 -y
  sudo apt install unzip -y

}


#---------------------------------------------------------------------------------------
#ENTRY POINT

# check for mono-devel.
which mono || install_mono  # only install and upgrade the system if mono-devel is missing


# NVM Sections
echo "---------------------------------------------------"
echo "NVM SETUP."
sudo echo ' '

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"

nvm install --lts
npm config set @zen:registry https://www.myget.org/F/zenprotocol/npm/
npm install @zen/zen-node -g


# set data path location for the database
DATAPATH="$HOME/.config/zen-node"

echo "---------------------------------------------------"
echo "Generating Zen-Node Service File..."

# generate the service file then save it appropriately
printf "[Unit]
Description=Zen Node
After=network.target

[Service]
Type=simple
WorkingDirectory=$HOME/.nvm/versions/node/$(node --version)/lib/node_modules/@zen/zen-node/Release/
ExecStart=/usr/bin/mono $HOME/.nvm/versions/node/$(node --version)/lib/node_modules/@zen/zen-node/Release/zen-node.exe --data-path "$DATAPATH" --api "*:11567" --addressdb
Restart=on-failure

[Install]
WantedBy=multi-user.target
" | sudo tee /etc/systemd/system/zen-node.service


# check for the blockchain DB, if present, continue.
# if absent, check for the zipped version and extract it.
# if no zipped version present, download the one hosted.
if [[ ! -s $DATAPATH ]] ; then
  echo "---------------------------------------------------"
  if [[ ! -s "zen-node.zip" ]] ; then
    echo "Downloading Blockchain..."
    # download zen-node.zip from s3
    wget https://node-backups.s3-eu-west-1.amazonaws.com/zen-node-addressdb.zip
  fi

  echo "Unziping The BlockchainDB in $DATAPATH..."
  unzip zen-node.zip -d "$HOME/.config"

fi

echo "---------------------------------------------------"
echo "Starting ZEN NODE...."
sudo systemctl enable zen-node.service
sudo systemctl start zen-node.service
sudo journalctl -f -u zen-node.service
PreviousSystemdNextDocker

Last updated 2 years ago