Pages:
Author

Topic: NBitcoin : Almost full bitcoin implementation in .NET - page 4. (Read 30756 times)

member
Activity: 66
Merit: 10
Very nice initiative and as @DeathAndTaxes said it's good to see more people getting involved with C# for Bitcoin.

I can now start implementing the rpc client. Smiley

Before you decide to reinvent the wheel I would suggest you take a look at this C# RPC API library & wrapper for Bitcoin, Litecoin and Bitcoin-based ALTs:

https://github.com/GeorgeKimionis/BitcoinLib

Some of BitcoinLib's features:

- Fully compatible and up-to-date with Bitcoin 0.9.1 RPC API.
- Design-by-contract, service-oriented architecture.
- Strongly-typed structures for complex RPC requests and responses.
- Implicit JSON casting for all RPC messages.
- Extended methods for every-day scenarios where the built-in methods fall short.
- Exposure of all RPC API's functionality as well as the extended methods through a single interface.
- Fallback mechanism for timed-out RPC requests.
- Custom RPC exceptions.
- Supports all Bitcoin clones.
- Can operate on unlimited daemons with a single library reference.
- Litecoin integration included.
- Each coin instance can be fully parametrized at run-time and implement its own constants.
- Console and web test clients out of the box with demo methods implemented in them.
- Testnet ready.
- Fully configurable.
donator
Activity: 1218
Merit: 1079
Gerald Davis
Well glad I could help.   Testnet exists for that exact purpose.  Depending on your testing needs you may also want to look into "testnet in a box" which is a self contained testnet that exists only on your system.

BTW I have no problem with you asking for tips just didn't want you wasting them thinking they need to be used for testing.  Glad to see some .net development.  Will take a look at your code this weekend.
hero member
Activity: 714
Merit: 662
I did not know about the test network .(seen in the code that we could change, but had no idea about an existing test network)
Thanks for the tips, I can now start implementing the rpc client. Smiley

Even if I ported the code, I am relatively new to bitcoin, I only knew the basics before starting to coding.
donator
Activity: 1218
Merit: 1079
Gerald Davis
Wow got to take a look at this.

Still you are kidding about needing coins to do testing right?
https://tpfaucet.appspot.com/
hero member
Activity: 714
Merit: 662
Hi all,

I passed the two last weeks, full time, porting the C++ code of bitcoin on C#.
It is the most complete and faithful porting I know of bitcoin.
Here is a copy paste of the info I put on the github page.

For those familiar with visual studio, it is available on nuget:
Install-Package NBitcoin

Why is it a big deal ? Because you can run it and debug into it without any linux-voodoo-setup to make it run.
Visual studio express for free, XUnit and you are up to go.

  • Full port of the test suite of bitcoin core with their own data
  • Full script evaluation and parsing
  • Recognize standard script and permit to create them
  • Object model faithful to the C++ API but with C# goodness
  • Simpler API (here is how to generate a key and get the address : new Key().PubKey.Address.ToString())
  • Bloom filter, partial merkle tree
  • Serialization of Blocks, Transactions, Script
  • Signing/verification with private keys, support compact signature for prooving ownership
  • Deterministic wallet : BIP 32

Then the RPC client part. Which I need your help because I don't have any satoshi myself, so I can't emit transactions for testing. If you like my work, submit the testing satoshis to 15sYbVpRh6dyWycZMwPdxJWD4xbfxReeHe Wink

Public classes are clean and easy to use, but the implementation is a little messy due to the fact that I'm using C# convention and C++ and the same time. (I will clean that up after the RPC client implementation)

I ported directly from the C++, except the OpenSSL part where I'm using BouncyCaslte instead. (BitcoinJ helped me a lot on the implementation)
I also ported OpenSSL bugs (you can't believe how much time it took me) Wink

Please, use the code to explore/learn/debug/play/sharing/create the licence is LGPL v3, so you should be good to go.
This is the simple way and most complete way to see the internal of bitcoin without going to C++ madness.

With no so much work, it should be Mono compliant. I don't have a lot of dependency on the Windows.

If you like my work, send some satoshi I can crucify for the testing of the RPC client. Wink

Info :
github : https://github.com/NicolasDorier/NBitcoin
bitcoin address : 15sYbVpRh6dyWycZMwPdxJWD4xbfxReeHe

Useful link :
Nuget site : https://www.nuget.org/packages/NBitcoin/
Visual studio express : http://www.visualstudio.com/en-us/products/visual-studio-express-vs.aspx
XUnit runner (only if using vs express) : http://xunit.codeplex.com/releases
Pages:
Jump to: