Pages:
Author

Topic: NBitcoin : Almost full bitcoin implementation in .NET (Read 30722 times)

hero member
Activity: 765
Merit: 503
Is there any info on the Fee Policy implementation?  Not sure how to use it.  Im hoping it sets the miners fee in the TX builder.
member
Activity: 103
Merit: 327
UPDATE: We have just came out with the second edition of NBitcoin's documentation, what is a book, called "Programming The Blockchain in C#". 
Now everything has been moved to GitHub, contributions are welcomed! 
https://github.com/ProgrammingBlockchain/ProgrammingBlockchain
hero member
Activity: 714
Merit: 661
Yes it would be possible, but it depends on the differences. I don't know the differences though.
NBitcoin is only for Bitcoin though, but I'm not against adding things in the code to make it extensible for other altcoins.
I won't do it myself though, so I'm waiting PR.
newbie
Activity: 17
Merit: 0
Hi!

Assuming all the similarities between bitcoin and litecoin, would it be feasible / doable to adapt NBitcoin to also handle litecoin?
I mean not necessary in one codebase, but maybe as a child / side project.
How much work would that be?



hero member
Activity: 714
Merit: 661
Yes, you can check the book https://blockchainprogramming.azurewebsites.net/ to see how I to use coin selector to build transactions and a sample of SPV implementation on https://github.com/NicolasDorier/NBitcoin.SPVSample
sr. member
Activity: 364
Merit: 257
If you take a look at the NBitcoin repo https://github.com/NicolasDorier/NBitcoin you will see that it is a very active project. In fact, yesterday there was a new release with many improvements. For example, the latest version allows you to use the bitcoin core consensus library to validate transactions.

There are new features (see the TransactionBuilder and MoneyBag classes), improvements and, at the same time, NBitcoin is on sync with bitcoin core project. So, summarizing: there are a lot of news.      



I wonder if it does have some kind of coin selector and a wallet file format?
full member
Activity: 164
Merit: 126
Amazing times are coming
If you take a look at the NBitcoin repo https://github.com/NicolasDorier/NBitcoin you will see that it is a very active project. In fact, yesterday there was a new release with many improvements. For example, the latest version allows you to use the bitcoin core consensus library to validate transactions.

There are new features (see the TransactionBuilder and MoneyBag classes), improvements and, at the same time, NBitcoin is on sync with bitcoin core project. So, summarizing: there are a lot of news.      

hero member
Activity: 714
Merit: 661
Is there a new thread somewhere?  How could 4 months go by without anyone discussing NBitcoin?  
There was some about discussion on threads about Blockchain Programming in C# about it.
The rest happens on github/stackoverflow/mails. (no specific forum thread)
legendary
Activity: 1386
Merit: 1000
KawBet.com - Anonymous Bitcoin Casino & Sportsbook
Is there a new thread somewhere?  How could 4 months go by without anyone discussing NBitcoin? 
hero member
Activity: 765
Merit: 503
Is it possible to run it as a full node implementation? Basically with tx relay and wallet maintenance.


Yes it is, here to get started (assuming you run bitcoin core locally)
Obviously, you can also connect to other node as long as you know the IP.

Quote
using(var node = Node.ConnectToLocal(Network.Main))
{
   node.VersionHandshake();
   node.MessageReceived += (node,message) => //Do your stuff when new message here;
}

If you want to make a server,

Quote
using(var server = new NodeServer(Network.Main))
{
   server.Listen();
   server.NodeAdded += (s,node)=>//do stuff when node connect (Handshakes and Ping/Pong are handled automatically)
}

When trying to start as server, I'm getting this exception thrown on server.Listen()

An unhandled exception of type 'System.Net.Sockets.SocketException' occurred in NBitcoin.dll

Additional information: Only one usage of each socket address (protocol/network address/port) is normally permitted

Any ideas?
 Roll Eyes I had bitcoind running using that port.
hero member
Activity: 765
Merit: 503
Actually, I'm a little busy to create an indexer.
So that will probably be a blockchain.info or blockexplorer.com backed by Microsoft Azure. (which is pure awesomeness)
I will release it entirely open source.

Doing a similar thing.  PM me Smiley
hero member
Activity: 714
Merit: 661
Got it - thanks

One advice, there is several test that are using these class.
If you have the xunit test running, they either the Trait "NodeServer" or "Network". It assume you have a local bitcoin instance on testnet.
You might learn how these class work with the tests.
sr. member
Activity: 467
Merit: 267
Got it - thanks
hero member
Activity: 714
Merit: 661
Thanks for your quick response, another question - is there support for the maintenance of the mempool and the set of unspent outputs? I couldn't find where transactions are checked for double spends for example.



No, this is yours to do.
NodeServer and Node are the class to send message and respond to messages you receive. (as a server, or as a client)
I have not coded a full node with this, but someone can.

In my code, I usually use NodeServer for mocking a fake bitcoin server (for unit testing), and I use Node to get notified from new Transactions, blocks, get the Headers chain, and download blocks.
sr. member
Activity: 467
Merit: 267
Thanks for your quick response, another question - is there support for the maintenance of the mempool and the set of unspent outputs? I couldn't find where transactions are checked for double spends for example.

hero member
Activity: 714
Merit: 661
Is it possible to run it as a full node implementation? Basically with tx relay and wallet maintenance.


Yes it is, here to get started (assuming you run bitcoin core locally)
Obviously, you can also connect to other node as long as you know the IP.

Quote
using(var node = Node.ConnectToLocal(Network.Main))
{
   node.VersionHandshake();
   node.MessageReceived += (node,message) => //Do your stuff when new message here;
}

If you want to make a server,

Quote
using(var server = new NodeServer(Network.Main))
{
   server.Listen();
   server.NodeAdded += (s,node)=>//do stuff when node connect (Handshakes and Ping/Pong are handled automatically)
}
sr. member
Activity: 467
Merit: 267
Is it possible to run it as a full node implementation? Basically with tx relay and wallet maintenance.
sr. member
Activity: 485
Merit: 274
If you ask, M$ will give you a free "Biz Spark" MSDN subscription, if you have a web site and pretend to be a start up.  I got one of the back of a couple of iPhone apps i wrote which i said i wanted to port to WinPhone. 

http://www.microsoft.com/bizspark/default.aspx
Pages:
Jump to: