public void Init() { _blockChainService = Services.GetService <IBlockChainService>(); _difficultyService = Services.GetService <IDifficultyService>(); _transactionVerifier = Services.GetService <ITransactionVerifier>(); _walletService = Services.GetService <IWalletService>(); _logger = Services.GetService <ILogger>(); _eventManager = Services.GetService <IEventManager>(); _memPoolFullPath = $"{Configurations.CurrentPath}\\BlockChain\\Data\\MemPool.json"; TryLoadMemPool(); MemPool.CollectionChanged += MemPool_CollectionChanged; CurrentWorkers = new List <Thread>(); Terminators = new Dictionary <int, bool>(); return; Task.Run(delegate { _logger.Log("Starting first miner in 6.."); Thread.Sleep(3000); _logger.Log("Starting first miner in 3.."); Thread.Sleep(3000); TryRestartingWorkers(); }); }
public void Initialize( CommandLineOptions options, PrivateKey privateKey, Action <bool> callback) { PrivateKey = privateKey; _channel = new Channel( options.RpcServerHost, options.RpcServerPort, ChannelCredentials.Insecure, new[] { new ChannelOption("grpc.max_receive_message_length", -1) } ); _lastTipChangedAt = DateTimeOffset.UtcNow; _hub = StreamingHubClient.Connect <IActionEvaluationHub, IActionEvaluationHubReceiver>(_channel, this); _service = MagicOnionClient.Create <IBlockChainService>(_channel); _genesis = BlockManager.ImportBlock(options.GenesisBlockPath ?? BlockManager.GenesisBlockPath); var appProtocolVersion = options.AppProtocolVersion is null ? default : Libplanet.Net.AppProtocolVersion.FromToken(options.AppProtocolVersion); AppProtocolVersion = appProtocolVersion.Version; RegisterDisconnectEvent(_hub); StartCoroutine(CoTxProcessor()); StartCoroutine(CoJoin(callback)); }
public BitLevelManager(IUserAuthorization authorizer, IUserContext userContext, IBitLevelQuery query, IPersistenceCommands pcommand, IUserNotifier notifier, IBlockChainService blockChain, ISettingsManager settingsManager, IReferralQuery refQuery, //IEmailPush emailService, IBackgroundOperationScheduler backgroundProcessor, IAppUrlProvider urlProvider) { ThrowNullArguments(() => userContext, () => query, () => pcommand, () => notifier, () => blockChain, () => settingsManager, () => refQuery, //() => emailService, () => backgroundProcessor, () => urlProvider); _query = query; _pcommand = pcommand; _authorizer = authorizer; _notifier = notifier; _blockChain = blockChain; _refQuery = refQuery; _settingsManager = settingsManager; //_emailService = emailService; _backgroundProcessor = backgroundProcessor; _urlProvider = urlProvider; UserContext = userContext; }
public void Init() { _transactionVerifier = Services.GetService <ITransactionVerifier>(); _difficultyService = Services.GetService <IDifficultyService>(); _blockChainService = Services.GetService <IBlockChainService>(); _minerService = Services.GetService <IMinerService>(); }
public LifetimeEventsHostedService( ILogger <LifetimeEventsHostedService> logger, IHostApplicationLifetime appLifetime, IBlockChainService blockChainService) { _logger = logger; _appLifetime = appLifetime; _blockChainService = blockChainService; }
public MineService(ITransactionPool transactionPool, IBlockChainService blockChainService, ITransactionExecutingService transactionExecutingService) { _transactionPool = transactionPool; _blockChainService = blockChainService; _transactionExecutingService = transactionExecutingService; Logger = NullLogger.Instance; }
public void Init() { Logger = Services.GetService <ILogger>(); _blockChainService = Services.GetService <IBlockChainService>(); _catchUpService = Services.GetService <ICatchUpService>(); ToParseQueue = new Queue <Action>(); var parser = new Thread(new ThreadStart(ParserThread)); parser.Start(); Start(); }
protected BlockChain(IBlockChainService blockChainService) { _blockChainService = blockChainService; if (_blockChainService.Blocks.Count() == 0) { CreateGenesisBlock(); } MiningAsync(); }
public DocumentService(IBlockChainService blockChainService, IStorageService storageService, ICryptoService cryptoService, IDataService dataService, ILogger <DocumentService> logger) { this.blockChainService = blockChainService ?? throw new System.ArgumentNullException(nameof(blockChainService)); this.storageService = storageService ?? throw new System.ArgumentNullException(nameof(storageService)); this.cryptoService = cryptoService ?? throw new System.ArgumentNullException(nameof(cryptoService)); this.dataService = dataService ?? throw new System.ArgumentNullException(nameof(dataService)); this.logger = logger ?? throw new System.ArgumentNullException(nameof(logger)); }
public static BlockChain Instance(IBlockChainService blockChainService) { if (instance == null) { lock (syncRoot) { if (instance == null) { instance = new BlockChain(blockChainService); } } } return(instance); }
public void Init() { _logger = Services.GetService <ILogger>(); _unspentDbFullPath = $"{Configurations.CurrentPath}\\BlockChain\\Data\\Unspent.sqlite"; var ev = Services.GetService <IEventManager>(); ev.RegisterEventListener(OnNewBlock, EventTypes.EventType.NewVerifiedBlock); ev.RegisterEventListener(OnNewTransaction, EventTypes.EventType.NewTransaction); _blockChainService = Services.GetService <IBlockChainService>(); _minerService = Services.GetService <IMinerService>(); _mappingService = Services.GetService <IMappingService>(); TryConnectToUnspentDB(); if (!IsLoadedIn(_blockChainService.Info.EndOfLongestChain)) { _logger.Log("Need to backload the Unspent db for some reasons"); LoadEveryNewBlock(); } }
public void Init() { _logger = Services.GetService <ILogger>(); _mappingService = Services.GetService <IMappingService>(); _server = Services.GetService <IP2PServer>(); _minerService = Services.GetService <IMinerService>(); _eventManager = Services.GetService <IEventManager>(); _blockChainService = Services.GetService <IBlockChainService>(); _catchDataFullPath = $"{Configurations.CurrentPath}\\BlockChain\\Catchup"; _logger.Log("Ketchup started to flow ....", 1); CaughtUp = false; bufferedTransactions = new List <Transaction>(); bufferedBlockInfos = new List <BlockInfo>(); supposedLongestBlockId = ""; shouldTryEnd = false; LastGotResponse = DateTime.UtcNow; if (!Directory.Exists(_catchDataFullPath)) { Directory.CreateDirectory(_catchDataFullPath); } }
public BalanceController(ILogger <BalanceController> logger, IBlockChainService blockChainService) { this.Logger = logger; this.BlockChainService = blockChainService; }
public HomeController(ILogger <HomeController> logger, IBlockChainService blockChain) { _logger = logger; _blockChain = blockChain; }
public BlockChainController(IBlockChainService blockChain) { ThrowNullArguments(() => blockChain); this._blockChain = blockChain; }
public BlockChainController(IBlockChainService blockChainService) { _blockChainService = blockChainService; }
public void Init() { _blockChainService = Services.GetService <IBlockChainService>(); }
public CabinetController() { _serviceUsers = new UserService(new ModelStateWrapper(ModelState), new UserRepository()); _blockChainService = new BlockChainService(new ModelStateWrapper(ModelState), new BlockChainRepository()); _blockChain = BlockChain.Instance(_blockChainService); }
public BlockChainController(ILogger <BlockChainController> logger, IBlockChainService blockChainService, NetworkSimulator networkSimulator) { _logger = logger; _blockChainService = blockChainService; _networkSimulator = networkSimulator; }
public StateController(ILogger <StateController> logger, IBlockChainService blockChainService) { this.Logger = logger; this.BlockChainService = blockChainService; }
public WebServiceController() { _transactionVerifier = Services.GetService <ITransactionVerifier>(); _eventManager = Services.GetService <IEventManager>(); _blockChainService = Services.GetService <IBlockChainService>(); }