Sign inSign up

dn3010/sylo-node

By dn3010

•Updated about 2 years ago

Building blocks of the Sylo Networks.

Image
7

50K+

dn3010/sylo-node repository overview

⁠go-sylo-node

Sylo Nodes are the building blocks of the decentralized Sylo Networks. They work together to provide connectivity and network resources to users of decentralized applications, like the Sylo Smart Wallet.

⁠Sylo Node Commands

The Sylo Node has a few commands. Let's briefly identify them.

⁠config

Generate a Sylo Node configuration file. You can fill in your configuration values and use the file to start a Sylo Node.

⁠generate

Creates a Sylo Node identity file. NOTE: these files should be kept secure!

⁠version

Displays the version information for the Sylo Node.

⁠Sylo Node Service Configuration

There are several configuration options used by the Sylo Node:

NameDescription
--config FILELoad the Sylo Node configuration from the specified file
--node-nickname NAMEA nickname used to identify this Sylo Node
--identity FILEA file that contains the Sylo Node ID
--data-directory PATHA path the Sylo Node can use for storing persistent data
--pns-uri URIThe Sylo Node will send push notifications using the provided URI
--reporting-uri URINode reports are sent to this URI
--listen MULTIADDRThe local multiaddr the Sylo Node will listen to
--public-ip-addr IP_ADDRESSThe nodes' reachable public ip address
--bootstrap-peer MULTIADDRConnect to another peer and join an existing Sylo Network
--rpc-ip-address IP_ADDRESSHost the management RPC on this local IP address
--rpc-port PORTHost the management RPC on this local IP port
--rpc-user USERNAMEProvide a basic authentication username for accessing the RPC
--rpc-pw PASSWORDProvide a basic authentication password for accessing the RPC
--tls-certificate FILEA path to a TLS certificate file
--tls-key FILEA path to the key associated with the TLS certificate
--network NAMEBlockchain network to use
--evm-url URLURL to the Ethereum virtual machine gateway
--eth-keystore DIRECTORYA path to the Ethereum keystore directory
--eth-address ADDRESSThe Ethereum address to use with this Sylo Node
--eth-passphrase PASSPHRASEThe passphrase used to unlock the Ethereum address
--eventsAutomatically start the incentivised event relay service
--inboxAutomatically start the free inboxing service
--relayAutomatically start the free relay service
⁠Basic Options
⁠Nickname (--config)

You can provide your Sylo Node with a nickname, which is used in various places to identify your Sylo Node instead of using generic text or the long libp2p Peer ID.

⁠Nickname (--node-nickname)

You can provide your Sylo Node with a nickname, which is used in various places to identify your Sylo Node instead of using generic text or the long libp2p Peer ID.

⁠Identity (--identity)

If you don't provide an identity file, the Sylo Node will generate an ephemeral one each time it starts. This is fine for testing, but you will need a permanent one when you want to join an existing Sylo Network.

If you don't already have an identity file, you can generate one like this:

docker run --rm dn3010/sylo-node generate --output node.id

This file contains a private key for the identity, so you should keep it safe. If this file is lost, the associated identity will be lost.

⁠Data Directory (--data-directory)

The Sylo Node stores data for peers and also maintains various stores of its own. This directory will default to ~/.sylo-node. Note that if you use the Docker image, this will be inside the Docker container you are running.

⁠Push Notifications Server (--pns-uri)

If your Sylo Node is supporting the Sylo Smart Wallet, you can leave this as the default value. If you are running another app on the Sylo Network, you may need to pass the URI to your own push notification server.

⁠Sylo Node Self-Reporting (--reporting-uri)

The Sylo Node will send out periodic reports to this URI. These reports include some simple statistics. By default, these reports are sent to Sylo and used to display Sylo Node information in the Sylo Smart Wallet application. The URI can be changed to another location or reporting can be disabled by passing an empty string.

⁠Local listening address (--listen)

This is the local P2P multiaddr that the Sylo Node will listen to. It should be provided in standard multiaddr format (ex. "/ip4/0.0.0.0/tcp/12345").

⁠Public ip address (--public-ip-addr)

This is the public ipv4 address used to reach the node from the Internet (ex. "54.254.167.218").

⁠Bootstrap peers (--bootstrap-peer)

You can specify as many bootstrap peers as you like. A minimum of 3 is recommended. The Sylo Node will connect to these nodes when it starts and use the connections to bootstrap onto the Sylo Network. Other peers can be discovered as needed using the network's peer discover DHT.

Bootstrap peers are provided as special P2P multiaddrs, which provide both an endpoint and a peer-to-peer ID. They look like this:

/ip4/123.45.67.89/tcp/12345/p2p/12D3KooWBDsmZbA3owqjnUU1mmprLvE2ZMTLf7kqSJDvSkvjY4Xh

⁠Services
⁠Event Relay (--events)

The parameter tells the Sylo Node to automatically start the event relay service when the node is started. The event relay service is used to pass small events between peers. It is similar to an asynchronous push notification service.

This is a boolean flag parameter and takes no additional arguments.

⁠Inbox (--inbox)

This parameter tells the Sylo Node to provide the inboxing service for peers. The inboxing service is used to store messages received while a peer is offline or unable to accept peer-to-peer relay connections.

This is a boolean flag parameter and takes no additional arguments.

⁠Relay (--relay)

This parameter tells the Sylo Node to assist other peers with making peer-to-peer connections by acting as a relay.

If the node does not act as a relay, peers connected to this node are likely to appear "offline" to other peers on the network.

This is a boolean flag parameter and takes no additional arguments.

⁠Management RPC

Managing the Sylo Node is performed through an HTTP RPC. The management RPC runs on a different IP/port endpoint than the Sylo Node service. The RPC supports TLS with basic authentication, although users may want to add additional access restrictions.

⁠RPC IP Address (--rpc-ip-address)

This is the local IP address the RPC server will bind to.

⁠RPC Port (--rpc-port)

This is the local port the RPC server will bind to.

⁠RPC Username (--rpc-user)

A basic authentication⁠ username, used to access the RPC.

⁠RPC Password (--rpc-password)

A basic authentication⁠ password, used to access the RPC.

⁠TLS Certificate (--tls-certificate)

Use this option to provide the path to a TLS certificate. This will cause the RPC to be run on an HTTPS server. If your management RPC is hosted on a public address, you should use HTTPS to protect your authentication data.

⁠TLS Key (--tls-key)

If you provided a TLS certificate, you will also need to provide the path to a TLS key.

⁠Ethereum Options
⁠Network (--network)

You can run your Sylo Node on different Rootnet networks. You can specify rootnet-mainnet here to use the Rootnet mainnet. Or porcini to use the Rootnet testnet. The Sylo Node will load the corresponding smart contract. There is also an option to run the node on a ganache deployment, which we provide via docker hub.

If you are running a different network, you can specify the path to a file containing the smart contract addresses you want to use and those will be loaded instead.

⁠Ethereum Gateway URL (--eth-url)

You will need to provide an Ethereum gateway for your Sylo Node to access the Ethereum blockchain. This is only necessary if you wish to provide incentivised services with your Sylo Node.

⁠Ethereum Keystore (--eth-keystore)

The Ethereum Keystore is a directory where encrypted Ethereum keys can be stored. This can either be an existing store or the location of a new store.

⁠Ethereum Address (--eth-address)

You can specify an address from the Ethereum keystore that should be used when the Sylo Node starts.

⁠Ethereum Passphrase (--eth-passphrase)

You can provide the passphrase to unlock the Ethereum address. This is less secure than entering the passphrase yourself when the Sylo Node starts but is provided as an option for automating startup of the Sylo Node. You should only use this option if access to the machine running the node is securely controlled.

⁠Sylo Node Environmental Variable Configuration

NameDescription
SYLO_NODE_ENABLE_PANICSetting this to true will disable the panic recovery handlers. Typically this should only be used during development.

⁠Version number

Release version numbers are short and self explanatory.

During development version numbers look like this: v1.0.0-254-g799d7573-dirty.

  • v1.0.0 - the last tagged commit in the history
  • 254 - the number of new commits since the tag
  • g799d7573 - the current commit SHA
  • dirty - added if built with uncommitted local data

⁠gRPC

Before you are able to compile the protobuf you need to install the dependencies:

⁠protoc

https://grpc.io/docs/protoc-installation/⁠

On Macos:

brew install protobuf

On Linux:

sudo apt-get install -y protobuf-compiler
⁠grpc go tools
go install \
    github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway \
    github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2 \
    google.golang.org/protobuf/cmd/protoc-gen-go \
    google.golang.org/grpc/cmd/protoc-gen-go-grpc
⁠Compiling Protobuf
make
⁠Generate mock files for unit tests

To create mocking framework of go-sylo-network-client repository, run:

go install github.com/golang/mock/mockgen
make generate-network-client-mocks

To create mocking framework of internal sources, run:

go install github.com/golang/mock/mockgen
make generate-internal-mocks destination="" source=""

Tag summary

Content type

Image

Digest

sha256:70f894560…

Size

363.3 MB

Last updated

about 2 years ago

docker pull dn3010/sylo-node:v2.0.0-substrate-upgrade