The repository contains implementation of high performance blockchain backend service for oracle contracts off-chain world interaction.
The Oracle Backend service is responsible for monitoring oracle smart contracts activity on block chain, especially for emitted events on contracts, and respond with relevant data from off-chain world needed to perform on-chain actions. Special modules can also feed on-chain contracts with external data, based on specified criteria, timer, or API response.
Building Oracle Backend requires GIT package and Go (version 1.14 or later is recommended). You can install it using your favourite package manager. The latest version of Go can be installed directly from GoLang Website.
Once you have the Go environment ready, clone the Watchdog repository from GitHub and build the binary package:
git clone https://github.com/TechPay-io/TechPay-Oracle-Backend.git
go build -o ./build/oracle ./cmd/oracle
The build output is build/oracle
executable.
You don't need to clone the project into $GOPATH
due to Go Modules tooling,
use any suitable location. We recommend moving the built Oracle Backend binary
to your bin
path and using Systemd
unit to manage the Backend as a service
for production use.
You need access to an RPC interface of an Photon Sirius node to run the Oracle Backend server. Please follow Photon instructions to build and run the node. You can obtain access to a remotely running instance of Photon, too.
We recommend using local IPC channel for communication between a Photon node and the Oracle Backend server for performance and security reasons. Please consider security implications of opening Photon RPC to outside world access.
To run the Oracle Backend as a system service on Linux, create a service unit file on appropriate location.
The actual place for putting the service file may vary by Linux distribution. For example, you can use
/etc/systemd/system/oracle.service
file path on Ubuntu systems.
We assume you want to use /var/photon/oracle
as the working directory for the Watchdog and that
you copied the Watchdog binary to /usr/bin/oracle
. In that case, the recommended
.service
file content is:
[Unit]
Description=TechPay Oracle Backend service
After=network.target auditd.service
[Service]
Type=simple
User=photon
Group=photon
WorkingDirectory=/var/photon/oracle
ExecStart=/usr/bin/oracle \
--rpc /root/.photon/photon.ipc \
--cfg /var/photon/oracle/modules.json \
--log NOTICE
OOMScoreAdjust=-900
Restart=on-failure
RestartSec=5s
[Install]
WantedBy=multi-user.target
Alias=oracle.service
Adjust the service unit file to match your path and configuration details for Photon RPC interface, work path and Oracle Backend binary file location.
Don't forget to update the System.d status to be able to use the new service file to start and stop
the Watchdog: systemctl enable oracle.service
. Manage the service start/stop using usual System.d commands,
i.e. systemctl start oracle.service
.