Before running the program, please refer to the option values in the latest official 9c-launcher-config.json and fill out the variables in appsettings.json.
In appsettings.json, AppProtocolVersionToken, StorePath, PeerStrings, MySqlConnectionString properties MUST be filled to run the program.
To setup the NineChronicles mainnet blockchain store to use in the StorePath, download and extract the latest mainnet snapshot to a desired location.
$ dotnet run --project ./NineChronicles.DataProvider.Executable/ --
Development Guide
This section lays out the steps in how to log a new action in the database.
The TransferAsset action is used as an example in this guide.
In general, TxId, BlockIndex, Date, and Timestamp are useful to add as default properties in a model because these values will help with query speed when table size increases.
namespace NineChronicles.DataProvider.Store.Models
{
using System;
using System.ComponentModel.DataAnnotations;
public class TransferAssetModel
{
[Key]
public string? TxId { get; set; }
public long BlockIndex { get; set; }
public string? Sender { get; set; }
public string? Recipient { get; set; }
public decimal Amount { get; set; }
public DateOnly Date { get; set; }
public DateTimeOffset TimeStamp { get; set; }
}
}
This migration tool migrates all action data based on DataRendering to the designated MySQL database.
Options such as offset and limit are provided to specify which block data to migrate.
IMPORTANT) This migration tool requires you to have the necessary state data in the blocks you want to migrate (If your chain store lacks the state data, this tool will not work).
Usage: NineChronicles.DataProvider.Executable mysql-migration [--store-path <String>] [--mysql-server <String>] [--mysql-port <UInt32>] [--mysql-username <String>] [--mysql-password <String>] [--mysql-database <String>] [--offset <I
nt32>] [--limit <Int32>] [--help]
Migrate action data in rocksdb store to mysql db.
Options:
-o, --store-path <String> Rocksdb path to migrate. (Required)
--mysql-server <String> A hostname of MySQL server. (Required)
--mysql-port <UInt32> A port of MySQL server. (Required)
--mysql-username <String> The name of MySQL user. (Required)
--mysql-password <String> The password of MySQL user. (Required)
--mysql-database <String> The name of MySQL database to use. (Required)
--offset <Int32> offset of block index (no entry will migrate from the genesis block).
--limit <Int32> limit of block count (no entry will migrate to the chain tip).
-h, --help Show help message