Pactus can be run in different modes, including the command-line interface (CLI) and the graphical user interface (GUI). This tutorial will guide you through the steps to run Pactus in CLI mode, suitable for advanced users.
Before proceeding with the steps below, ensure that you have the following:
To get started, download and extract the Pactus CLI file from here. Once you have downloaded and extracted the Pactus CLI file, you can proceed to the next step.
Now you need to create a wallet and setup a working directory for your node. A working directory is a place where you save blockchain data and wallets. Open the Terminal and run the following command:
./pactus-daemon init
This command creates your wallet and setup the working working directory at ~/pactus
.
pactus-daemon.exe init
This command creates your wallet and setup the working working directory at C:\Users\<USER_NAME>\pactus
.
~/pactus
in Unix-like systems.
For Windows it is set to C:\Users\<USER_NAME>\pactus
.
--working-dir
option.
The working directory contains:
Feel free to explore the contents of these files as needed, particularly the config file. The config file contains parameters that can customize your node.
If you ever need to restore your node, for instance on a new device,
you can use the --restore
option followed by your mnemonic:
./pactus-daemon init --restore "<your-mnemonic>"
Replace <your-mnemonic>
with your previously noted mnemonic phrase.
This command will restore your wallet in the ~/pactus
directory.
pactus-daemon.exe init --restore "<your-mnemonic>"
Replace <your-mnemonic>
with your previously noted mnemonic phrase.
This command will restore your wallet in the C:\Users\<USER_NAME>\pactus
directory.
Now you can start the node and sync with the network. Run the following command in the Terminal:
./pactus-daemon start
pactus-daemon.exe start
When the Pactus node starts running, it begins syncing with the network. This process may take some time, as your node needs to download and verify the entire blockchain history. Please be patient while your node syncs.
The default network ports in Pactus are defined as follows. It is recommended not to change these default ports:
To run Pactus commands in the background and keep them running even after you close your terminal or log out, you can use terminal multiplexer software. Terminal multiplexers allow you to create and manage multiple terminal sessions within a single window.
Two popular terminal multiplexer options are:
You can install tmux on Unix-like systems using your package manager (e.g., apt
, brew
, yum
).
Here’s how to use tmux to run Pactus in the background:
tmux
Ctrl-b
, followed by d
.tmux attach-session
allows you to run terminal sessions in the background.
Here’s how to use screen to run Pactus in the background:
screen
Ctrl-a
, followed by d
.screen -r
Choose the terminal multiplexer that suits your preference and install it using your system’s package manager. With these tools, you can run Pactus commands in the background with ease.
To become a validator and participate in the consensus algorithm to earn rewards, you first need to stake some coins. In the next tutorial, we will explain how to send a Bond transaction to become a validator.
By running a Pactus node, you contribute to the decentralization and security of the Pactus blockchain network. Thank you for your participation!