Skip to main content

Getting Started

Source Code of PAC Protocol Core can be found under GitHub pacprotocol/pacprotocol

For the following step we're using the user root. For production usage it's recommended to use different user with no admin permission.

Install PAC Protocol Core Daemon#

Requirements#

  • Minimum 1GB RAM
  • Minimum 25GB Hard Disk
  • Ubuntu 18.04 LTS or newer. (Windows and macOS supports it too, but we're focusing on ubuntu)

Step 1 - Get/Setup binaries of PAC Protocol Core#

We're pulling the binaries of "PAC Protocol v0.17" and grant permission of "pacprotocold" and "pacprotocol-cli" to make it executeable.

cd /root # we're using root directory in this example. You can obviously choose your owh directory.
wget https://github.com/pacprotocol/pacprotocol/releases/download/v0.17.0.4/pacprotocol-v0.17.0.4-lin64.tgz
tar -xzvf pacprotocol-v0.17.0.4-lin64.tgz
rm -f pacprotocol-v0.17.0.4-lin64.tgz
mv -v pacprotocol-v0.17.0.4-lin64 PACProtocol
chmod +x PACProtocol/pacprotocold
chmod +x PACProtocol/pacprotocol-cli

Step 2 - Configuring the wallet#

To configure the PAC Protocol Core, you need to enter following commands.

mkdir /root/.PACProtocol
cd /root/.PACProtocol
nano pacprotocol.conf # or any other file editor you want

Following settings in pacprotocol.conf is recommended to enable RPC JSON HTTP API:

# pacprotocol.conf
rpcuser=<choose any username>
rpcpassword=<create a good password>
rpcallowip=127.0.0.1 # Listen only to local machine.
rpcport=7111
listen=1
server=1
daemon=1

You can find more options under Daemon Options

Save it and back to terminal.

Step 3 - Creating systemctl service (optional, recommended)#

This step is not necessary, but it helps to run PAC Protocol Core in background and it auto-start in case of crashing. It will also start automatically when the machine is turned on.

Skip to Step 4 if you don't want to use systemctl service.

nano /etc/systemd/system/pac.service # or any other file editor you want

With the following content of pac.service:

# pac.service
[Unit]
Description=PAC Protocol Core Daemon
After=network.target
[Service]
User=root
Group=root
Type=forking
PIDFile=/root/.PACProtocol/pacprotocol.pid
ExecStart=/root/PACProtocol/pacprotocold -daemon -pid=/root/.PACProtocol/pacprotocol.pid \
-conf=/root/.PACProtocol/pacprotocol.conf -datadir=/root/.PACProtocol/
ExecStop=-/root/PACProtocol/pacprotocol-cli -conf=/root/.PACProtocol/pacprotocol.conf \
-datadir=/root/.PACProtocol/ stop
Restart=always
RestartSec=20s
PrivateTmp=true
TimeoutStopSec=7200s
TimeoutStartSec=30s
StartLimitInterval=120s
StartLimitBurst=5
[Install]
WantedBy=multi-user.target

Save it and back to terminal.

Enable the service

systemctl enable pac.service

And start the service

systemctl start pac.service

If you want to stop the service (stopping the PAC Protocol Core Daemon instance)

systemctl stop pac.service

Step 4 - Testing if it's working.#

Now your PAC Protocol Core Daemon is ready to be used for development purpose.

If you skipped the Step 3, you can run daemon by following step:

./root/PACProtocol/pacprotocold -daemon

Wait for a some time and then you can ping the HTTP RPC JSON if it's functional:

curl --data-binary '{"jsonrpc":"1.0","id":"curltext","method":"getblockchaininfo","params":[]}' -H 'content-type:text/plain;' http://<rpcusername>:<rpcpassword>@127.0.0.1:7111/

The rpcusername and rpcpassword is the same as from Step 2

You can validate if the blockchain is fully synced:

curl --data-binary '{"jsonrpc":"1.0","id":"curltext","method":"mnsync","params":["status"]}' -H 'content-type:text/plain;' http://<rpcusername>:<rpcpassword>@127.0.0.1:7111/

If "isBlockchainSynced" is true, it means the blockchain on your machine is fully synced!

It can take some time to sync fully. Luckly we have a solution for that in order to sync it faster - please see the following tutorial Install Bootstrap

Congratulation. Now you have a self-hosted PAC Protocol HTTP API which you can use on your language/framework by using HTTP requests!

Please see Client Commands for more information of commands usage & http