예제 #1
0
        public EmbedServer(TransactionPool transactionPool, IBlockMiner blockMiner, ILoggerFactory loggerFactory, IConfigurationRoot config)
        {
            string port = config.GetSection("RpcPort").Get <string>();

            url = $"http://localhost:{port}/";

            server = CreateWebServer(url);
            this.transactionPool = transactionPool;
            this.blockMiner      = blockMiner;
            this.logger          = loggerFactory.CreateLogger <EmbedServer>();
        }
예제 #2
0
        static void Main(string[] args)
        {
            var serviceProvider = ConfigureForMongoDB("DigitalCurrency", 10500);

            //var serviceProvider = ConfigureForLiteDb("node.db", 10500);

            _host           = serviceProvider.GetService <IBlockchainNode>();
            _miner          = serviceProvider.GetService <IBlockMiner>();
            _network        = serviceProvider.GetService <IPeerNetwork>();
            _sigService     = serviceProvider.GetService <ISignatureService>();
            _addressEncoder = serviceProvider.GetService <IAddressEncoder>();
            _txnRepo        = serviceProvider.GetService <ICustomInstructionRepository>();
            _blockRepo      = serviceProvider.GetService <IBlockRepository>();
            _txnBuilder     = serviceProvider.GetService <ITransactionBuilder>();

            Console.Write("Enter passphrase:");
            var phrase  = Console.ReadLine();
            var keys    = _sigService.GetKeyPairFromPhrase(phrase);
            var address = _addressEncoder.EncodeAddress(keys.PublicKey, 0);

            Console.WriteLine($"Your address is {address}");

            _network.Open();

            PrintHelp();
            while (true)
            {
                Console.Write(">");
                var command = Console.ReadLine();

                if (command == "exit")
                {
                    break;
                }

                RunCommand(command, keys);
            }
            _network.Close();
        }
예제 #3
0
 public Startup(IBlockMiner blockMiner, IRpcServer rpcServer)
 {
     this.blockMiner = blockMiner;
     this.rpcServer  = rpcServer;
 }
예제 #4
0
 public Controller(IBlockMiner blockMiner, TransactionPool transactionPool)
 {
     this.blockMiner      = blockMiner;
     this.transactionPool = transactionPool;
 }