#Bitcoin C#:Creating Bitcoin address using NBitCoin

1.Get NBitcoin from Nuget package.

Bitcoin Address : 

It is payment address which either begins with 1 or 3 ,its more of a combination of secure private and public key hash that is generated using cryptographic algorithm.To end user,its simply an address which is useful for sending/receiving bitcoins.

Generating Bitcoin using NBitcoin :


 Key bitcoin = new Key();
 var bitcoinaddress=bitcoin.PubKey.GetAddress(Network.TestNet);
 Console.WriteLine(bitcoinaddress);

Its as simple as that, you create a key and decide which network to generate bitcoin address.There are two networks MainNet(Real world) and TestNet(Test Environment).

 

WebHook in .NET

What is WebHook ?

A webhook is a provider that helps you to get data from external system  as and whenit flows into the system.These are real time data that is exposed over HTTP as and when data flows into system.

Components in WebHook :

Receiver : This type of webhook pulls the data  from external system to your server.

Sender  : This type of webhook is responsible for exposing your data to external system.

WebHook with .NET :

.NET does support web hook and there are various type of web hook that is customized  according to business need.

Types of WebHook Libraries provided by .NET :

  1. GitHubWebHook.
  2. SlackWebHook.
  3. GenericWebHook (This is the one which you use at custom level,the webhook is not tied to any providers like github,stripe instead you can define/customize  to your needs)

References :

https://github.com/aspnet/WebHooks

Inputs in Angular 2

Inputs helps pass the data dynamically to the component. There are situations where you pass data to component and in turn component would invoke the service and fetch the desired result.Inputs are ideally suitable for such situation.

Defining Inputs in Component :

  1. @Input  directive in the Component which is imported from angular2/core.
  2. Defining Inputs in Component MetaData.

Example  of Inputs with directive:


import {Component,Input} from 'angular2/core'

@Component({

'selector':inputsample,

'template':"<span>{{Name}} </span>"

})

export class InputsampleComponent

{

@Input Name ;

}

Using  Input in Root/App Component :


<inputsample [Name ]="somename"> </inputsample>

#Bitcoins-Programming Bitcoins in C#-Resources.

I have started using Bitcoins and Block Chain technologies and with the .NET Stack had found the following libraries quite useful.

What is Bitcoins ?

 

They are nothing more than virtual currencies which are accepted worldwide.They use the Block Chain technology which holds the transaction in distributed servers.

Libraries in C# :

Bitcoin itself is in the initial phase of evolution,there are only few libraries and I am listing the one which was pretty useful for me,

Nicolas Dorier- BitCoin libraries:

BitCoin-Client   : https://github.com/NicolasDorier/BlockchainProgramming

BitCoin-Server :  https://github.com/NicolasDorier/BlockchainProgramming

GeorgeKimionis-Bitcoin libraries:

https://github.com/GeorgeKimionis/BitcoinLib

They both are transaction oriented.

SetInterval and ClearInterval -Javascript

I had been developing a real time chat system at my work  and the chat system takes some time to load(makes an ajax call to the backend that fetches users details,chat message,chat room id ,chat user role id etc..).and also there are multiple chat rooms based on user roles. The challenge was to wait for all of data to load  and then enable the chat system.

Solution :

The solution  is to wait for x interval of time and then make a call x time to check if the data we require is loaded.

 


var intialloading=false;
waitoperation();
var someinterval =setInterval(function(){

if(intialloading)

{

//clear the interval.

ClearInterval(someinterval);

}

},2000) // call function every 2 secs

function waitoperation()

{

//some call

intialloading=true;

}