HOWTO: Setup an Agent
This guide is for those interested in running a Syscoin Bridge Agent node. Agents build the Syscoin SuperblockChain on Ethereum by hashing 60 Syscoin blocks together and storing this as 1 Superblock in the Bridge Superblocks smart contract
The chain activity can be seen here
https://etherscan.io/address/0xa0Fe740Ed57C9FCB0A04E330824aD8aD574bc54c#events
Prerequisite
- Syscoin node on Linux box VPS
- ETH fund (18 ETH recommended, >3 ETH minimum)
Setup Guide
This guide assumes the following:
- user "ubuntu"
- default .syscoin data directory (~/.syscoin)
(please change the names accordingly)
After setting up your Syscoin node, do the following:
Create a new Eth address through Syscoind's Geth
$ sysgeth.nod account new -datadir .syscoin/geth
If you're planning your node to perform both roles (challenger & submitter), create a second address:
$ sysgeth.nod account new -datadir .syscoin/geth
Send some ETH to the addresses ( > 3 ETH needed for each; at least 9 on each address is recommended)
Install Dependency
$ sudo apt-get install default-jdk maven
Download sysethereum-agents
$ git clone http://www.github.com/syscoin/sysethereum-agents
$ cd sysethereum-agents
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
$ 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 following 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
general.purpose.and.send.superblocks.address
and syscoin.superblock.challenger.address
These two addresses should be different. These are your Geth wallet address(es) mentioned above where you sent >3 ETH to each.
data.directory
data.directory
This field should be /home/ubuntu/.syscoin
or the full path to the syscoin data directory
syscoinrpc
syscoinrpc
The following 3 fields should match the RPC configuration in your syscoin.conf file for Syscoin Core: syscoinrpc.user, syscoinrpc.password
and syscoinrpc.url_and_port
A cookie will be generated if rpcuser
and rpcpasswords
are not set in syscoin.conf; the rpcuser
becomes "cookie" and rpcpassword
can be found by running ps - ef | grep syscoin
to look at what's passed to relayer. The format will be "__cookie:[rpcpassword]" after "--sysrpcusercolonpass"
syscoinrpc.url_and_port
is most likely "http://localhost:8370". Change the 8370 if you use a different RPC port.
secondary.url address
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 then select Mainnet.
Take that URL and prefix it with "https://" use it for secondary.url
.
Example: secondary.url = "https://mainnet.infura.io/v3/abcdefghijklmnopqrstuvwxyz"
Challenger and/or Submitter
These two configurations can be toggled to choose what role to play; 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 follows:
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 and use a gmail account.
Change the username and password above to those of your gmail.
Change the challenge.notifier
from
address to this account.
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 (most likely from your VPS's region). Allow it, then restart your agent. You should then be able 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.
Updated over 4 years ago