public static void Initialize(string name, string dataPath) { Instance = new NodeConfiguration(name, dataPath); Directory.CreateDirectory(GetCertificatesPath()); }
public IConnectionService CreateConnectionService() { var config = NodeBuilder.BuildConfiguration(NodeConfiguration.GetPath("node_server.txt"), NodeConfiguration.GetCertificatesPath(), "node_id.pem"); var nodes = P2PServerConfiguration.ToIPEndpoints(new UrlConfiguration(NodeConfiguration.GetPath("nodes.txt")).Lines); var connection = new Connections.P2PConnection(config, nodes, 5, 20); var connectionService = new ConnectionService(connection, false /*TODO to config ?*/); var dispatcher = new Dispatcher(connectionService.Logger); var bockchainChannel = connectionService.CreateChannel(ConnectionService.BLOCKCHAIN_CHANNEL, dispatcher, new BlockchainApi().JsonMessageFactory, session => true); connectionService.SetBlockchainChannel(bockchainChannel); return(connectionService); }
public static string GetDefaultPath() { return(NodeConfiguration.GetPath("initial.block")); }