Ejemplo n.º 1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers();
            var rpcInputs = Configuration.GetSection("CoinConfig").Get <List <RpcInput> >();

            services.AddTransient <ICoinService, CoinService>();

            foreach (var rpcInput in rpcInputs)
            {
                services.AddTransient <ICryptocoinService>(service =>
                {
                    var svc = new CryptocoinService(
                        rpcInput.DaemonUrl,
                        rpcInput.RpcUserName,
                        rpcInput.RpcPassword,
                        rpcInput.WalletPassword,
                        rpcInput.RpcRequestTimeoutInSeconds
                        );
                    svc.Parameters.CoinShortName = rpcInput.CoinShortName;
                    svc.Parameters.CoinLongName  = rpcInput.CoinLongName;
                    return(svc);
                });
            }

            services.AddSingleton <IPeerListRepository, PeerListRepository>();
            services.AddHostedService <PeerListService>();
        }
Ejemplo n.º 2
0
        public recieve_bitcoin(string A)
        {
            InitializeComponent();


            //ICryptocoinService bitcoinService = new CryptocoinService("http://162.213.252.66:18332/", "test", "test123", "qwe");
            ICryptocoinService bitcoinService = new CryptocoinService("http://198.54.119.56:36345//", "bitcoinrpc", "GrvHKju9oLg6Kw", "qwe");

            string a = bitcoinService.GetNewAddress(A);

            address_textBox.Text = a;

            pictureBox.Location = new Point(75, 30);
            Zen.Barcode.CodeQrBarcodeDraw qrcode = Zen.Barcode.BarcodeDrawFactory.CodeQr;
            pictureBox.Image = qrcode.Draw(a, 50);
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            // parse command line arguments
            Options options = new Options();

            CommandLine.Parser.Default.ParseArgumentsStrict(args, options);

            // create biblepay daemon interface
            ICryptocoinService bbpService = new CryptocoinService(options.Url, options.User, options.Password, "x");

            // retrieve blockchain
            Console.WriteLine("Retrieving blockchain data from biblepayd at " + options.Url + "...\n");
            List <GetBlockResponse> blocks = GetBlocks(bbpService);

            // format some data and write to console
            Console.WriteLine("{0,-6} | {1,-22} | {2,-20} | {3,-9}", "height", "timestamp", "difficulty", "blocktime");
            Console.WriteLine(new String('-', 80));

            foreach (GetBlockResponse block in blocks)
            {
                Console.WriteLine(String.Format(
                                      "{0,6} | {1,-22} | {2,-20} | {3,9:0.000}",
                                      block.Height,
                                      UnixTimeStampToDateTime(block.Time),
                                      block.Difficulty,
                                      block.Height > 1 ? GetBlockTime(blocks, block.Height) / 60.0 : Double.NaN
                                      ));
            }

            // calculate average blocktime
            int firstBlockTime = blocks[1].Time;
            int finalBlockTime = blocks[blocks.Count - 1].Time;
            int elapsedTime    = finalBlockTime - firstBlockTime;

            Console.WriteLine(String.Format("\nAverage blocktime: {0:0.000}", (elapsedTime / bbpService.GetBlockCount()) / 60.0));
        }
Ejemplo n.º 4
0
 public void RUN()
 {
     //   GetTransactions("").ForEach(m => Console.WriteLine(m.TxId));
     Wallet = new CryptocoinService("http://127.0.0.1:" + port, RPCUsername, RPCPassword, "", 5);
 }