Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Datalayer-Storage/MirrorSync

Repository files navigation

DlMirrorSync

.NET CodeQL

This is a utility service that will synchronize the list of chia data layer singletons from datalayer.storage to the local chia node. By running this tool, the local node will subscribe to and mirror all of the datalayer.storage singletons. This includes a transaction fee for each and devoting 0.0003 XCH per mirror, so be sure you are ready to do this.

Can either be run from code, from built binaries in the latest release, or as a windows service.

  • The singlefile versions require .NET 8.
  • The standalone versions have .net embedded so don't need it installed separately.
  • The MSI installs the windows service that will synchronize the singletons once per day. (this installs as autostart and will run immediately)

Build

  • Ensure you have the .NET 8 SDK installed
  • Run ./publish.ps1 which will build single file and standalone binaries for windows, linux, and os-x
  • Outputs will be placed in the publish folder

To build the installer you need wix installed: dotnet tool install -g dotnet-wix (Windows only).

To manually install as a windows service run ./install.ps1 from an elevated terminal.

Run

Command Line

If you are running the single file or standalone versions you can run the following command to sync the singletons:

./DlMirrorSync ["optional path to chia config"]

Install As a Service

First build the binaries by running publish.ps1 [powershell for linux] which will build single file and standalone binaries for windows, linux, and os-x. Outputs will be placed in the publish folder. Second, set any options in the appsettings.json file in the relevant ./publish/standalone folder. Then run the following commands to install the service:

Windows

To manually install as a windows service run ./install.ps1 from an elevated terminal.

Linux

To install as a systemd service run sudo bash install.sh

Configuration

These settings can be configured in the appsettings.json file or via environment variables (prefixed with DlMirrorSync:).

  • MirrorServer: true - If true, this node will mirror the singletons from datalayer.storage in addition to subscribing to them.
  • MirrorHostUri: "" - The host uri to use for mirroring. If empty, will default to the host machine's public IP address.
  • WaitingForChangeDelayMinutes: 2 - The number of minutes to wait if spendable balance is 0 but change is owed.
  • PollingIntervalMinutes: 1440 - The number of minutes to wait between checking for new singletons.
  • MirrorServiceUri: https://api.datalayer.storage/mirrors/v1/list_all - The uri to use for retrieving the list of singletons to mirror.
  • DefaultFee: 500000, - The default fee to use for mirroring singletons if the dynamic fee cannot be retrieved.
  • AddMirrorAmount: 300000001 - The number of mojos to reserve in the mirror coin for each singleton.
  • XchWalletId: 1 - The XCH wallet id to use for paying the fee and reserve amount.