HomeGuidesChangelog
GuidesDiscussions & SupportGitHubLog In
These docs are for v4.1.0. Click to read the latest docs for v4.4.2.

Syscoin 4.1 Sysethereum Agent

This guide is for people who are interested in running the Systhereum Agent. The agents builds the Syscoin SuperblockChain on the Ethereum chain by hashing 60 Syscoin blocks together and store it as 1 Superblock in the Ethereum smart contract

The chain activity can be seen here

Prerequisite

  1. Syscoin node on Linux box VPS
  2. ETH fund ( > 3 Eth needed)

Set up Guide

Create a new Eth address through Syscoind's Geth

$ sysgeth.nod account new -datadir .syscoin/geth

If you're planning to run both roles (challenger & submitter), create a second address

$ sysgeth.nod account new -datadir .syscoin/geth

Send some Eth to the addresses ( > 3 Eth each needed; suggested 9 eth on each address)

Install Dependency

$ sudo apt-get install default-jdk maven

Download sysethereum-agents

$ git clone http://www.github.com/syscoin/sysethereum-agents
$ cd sysethereum-agents

***** NEW: Switch to mainnet branch *****
$ git checkout master
$ git pull

Edit the configuration file in data/sysethereum-agents.conf (see below)
$ nano data/sysethereum-agents.conf 

Compile agent

$ mvn compile 
$ mvn package

Run agent.  The first argument is the location to the sysethereum-agents.conf file

**** NOV 22 NEW additional arg "-Dhttps.protocols=TLSv1.2,TLSv1.1,TLSv1" ****
$ java -Dsysethereum.agents.conf.file=/home/ubuntu/sysethereum-agents/data/sysethereum-agents.conf -Dhttps.protocols=TLSv1.2,TLSv1.1,TLSv1 -jar target/sysethereum-agents-1.0-jar-with-dependencies.jar 

OR run it with screen so you can disconnect from ssh session
you may have to install screen first
$ sudo apt-get install screen

$ screen java -Dsysethereum.agents.conf.file=/home/ubuntu/sysethereum-agents/data/sysethereum-agents.conf -Dhttps.protocols=TLSv1.2,TLSv1.1,TLSv1 -jar target/sysethereum-agents-1.0-jar-with-dependencies.jar 
hit ctrl+A and D to detach screen so it'll run in the background

you can resume the screen with this command
$ screen -r

Mandatory Fields

The configuration file has many fields, only the below ones are needed:

general.purpose.and.send.superblocks.address       
general.purpose.and.send.superblocks.unlockpw
syscoin.superblock.challenger.address
syscoin.superblock.challenger.unlockpw
data.directory
syscoinrpc.user
syscoinrpc.password
syscoinrpc.url_and_port
secondary.url

general.purpose.and.send.superblocks.address and syscoin.superblock.challenger.address

These two addresses should be different and it's your Geth wallet address mentioned above where you put in the >3 ETH each

data.directory

This field should just be "/home/ubuntu/.syscoin/testnet3" or the full path to the syscoin testnet3 folder

syscoinrpc

The following 3 fields should match your rpc configuration in syscoin.conf file for Syscoin Core: syscoinrpc.user, syscoinrpc.password and syscoinrpc.url_and_port
In Syscoin 4, if rpcuser and rpcpasswords are not set in syscoin.conf, a cookie will be generated, and the rpcuser becomes "cookie" and rpcpassword can be found by running ps - ef | grep syscoin and look at what's passed into relayer. The format will be "__cookie:[rpcpassword]" after "--sysrpcusercolonpass"
syscoinrpc.url_and_port is most likely "http://localhost:18369". Change the 18369 if you use a different rpc port.

secondary.url address

Please head to infura.io and create an account there.
Then create a new project and find a drop down beside ENDPOINT and select Rinkeby.
Take that URL and prefix it with "https://" use it for secondary.url.
Example: secondary.url = "https://rinkeby.infura.io/v3/abcdefghijklmnopqrstuvwxyz"

Challenger and/or Submitter

These two config can be toggled to choose what role to play. Either submitter, challenger or both
syscoin.superblock.submitter.enabled = true
syscoin.superblock.challenger.enabled = true

Optional Fields

agent email notification

Email notification can be set up as below:

agent.mailer.enabled = true

agent.mailer {
    enabled: true,
    smtp {
        # See https://myaccount.google.com/lesssecureapps
        host: "smtp.gmail.com",
        port: 587,
        username: "[email protected]",
        password: "verystrongpassword",
        transportStrategy: "SMTP_TLS"  # Supported values: "SMTP", "SMTP_TLS" and "SMTPS"
    },
    challenge.notifier {
        trigger: "ANY_BLOCK",  # Supported values: "MY_BLOCK", "ANY_BLOCK"
        from: "[email protected]",
        to: "[email protected]",
        subject: "Syscoin agent challenges superblock(s)!"
    }
}

The simplest way is to create a new gmail account and use it.
Just change the username and password above to the username and password of the new gmail account.
Also, change the challenge.notifier's from address to the new gmail account and the to to your email account where you wish to receive notifications.
Head to https://myaccount.google.com/lesssecureapps with your new gmail account and enable "less secure apps"
When you run it the first time, check your new gmail account and you should see some security alerts for a log in attempt from a region (most likely your VPS's region). Allow it and restart agent. You should start to receive notifications

sysethereum-agent-monitor

With this smtp gmail you can also setup
https://github.com/syscoin/sysethereum-agent-monitor

git clone https://github.com/syscoin/sysethereum-agent-monitor
cd sysethereum-agent-monitor
npm i

Edit config.json to configure the monitor for your environment.

Config Parameters:
interval - (seconds) how often to check system statuses.
smtp.host - SMTP host.
smtp.auth.user - SMTP username, leave blank for no auth.
smtp.auth.pass - SMTP password, leave blank for no auth.
smtp.port - SMTP server port.
syscoin.host - Syscoin RPC host.
syscoin.user - Syscoin RPC username.
syscoin.pass - Syscoin RPC password.
syscoin.port - Syscoin RPC port.
explorer_url - URL to Syscoin block explorer that utilizes BCF Explorer API. No trailing slash.
nottify_address - Email address which notifications will be sent.