Bitcoin Forum
November 06, 2024, 03:37:32 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: NBitcoin : Mac, IOS, Android, Windows phone 8.1, Windows * Compatible Library  (Read 3969 times)
Nicolas Dorier (OP)
Hero Member
*****
Offline Offline

Activity: 714
Merit: 662


View Profile
December 08, 2014, 05:05:56 PM
Last edit: December 08, 2014, 07:56:17 PM by Nicolas Dorier
Merited by ABCbits (81)
 #1

Today, I am glad to announce the portable release of NBitcoin on nuget.

What does it means ?

That you can share your .NET code across several plateform painlessly with Xamarin.
That you can use a complete Bitcoin framework on Mac, android, IOS, Windows Everything all distributed with nuget.

How to use it ?

If you are using Visual Studio, then it is as simple as running

Quote
Install-Package NBitcoin

On your project, nuget will figure the most feature complete version of NBitcoin for your plateform automatically.

What does it means technically ?

Making NBitcoin works accross all plateform, made me create a version supporting Portable Profile111 and Profile259 (111 + wp8).
It means that I needed to strip a few things, to isolate the common denominator :

-Bitcoin Network connection (Because there is no socket support in this profile)
-Payment (BIP70) (Because it depends on Protobuf that is not portable on profile111, and because profile111 does not support X509Certificate2 either)
-You will need to configure the plateform specific RNG depending on the plateform. (RandomUtils.Random, use the UnsecureRandom, if you don't care about a good RNG, NBitcoin use Deterministic signatures)

All the rest was ported nicely (included Open Asset, for Colored Coins and Stealth address support)
The unit tests being also ported, I can assure you that there is no breaking change.

A portable lib is nice, but it means I could not include goodness of native plateforms into the code.
This is why other plateform specific NBitcoin version will be shipped in next months and include some plateform specific feature.
In fact, I have already done that for Android. (To configure the RNG automatically)

What's next ?

-Support for .NET Micro framework, so you can make the Internet Of Things with Bitcoin comes true, and create your hand made trezor (here is what can be done http://www.codeproject.com/Articles/657218/Upgrading-your-car-with-NET-Micro-Framework)
-Plateform specific versions, for ease of use.
-Windows Phone 8.0 support

Now is the time to innovate ! Smiley
Who said that the .NET world doesn't embrace open source ? Smiley

If any problem or feedback, you can go on github.

A reminder of NBitcoin feature that I could port :

  • Build and Sign transactions of all types easily (TransactionBuilder see link below)
  • Parsing of all Bitcoin related data structure (block, transaction, address, and all kind of base58 data)
  • HD keys
  • BIP38
  • multi sig, p2pkh, p2pk, and all P2SH versions of them
  • Script creation, parsing and evaluation
  • Open Asset
  • Stealth Address

Some article relevant to what can be done :

NBitcoin Github : https://github.com/NicolasDorier/NBitcoin

NBitcoin Nuget : https://www.nuget.org/packages/NBitcoin/

Intro : http://www.codeproject.com/Articles/768412/NBitcoin-The-most-complete-Bitcoin-port-Part-Crypt

How to build transaction (TransactionBuilder) : http://www.codeproject.com/Articles/835098/NBitcoin-Build-Them-All

Stealth Payment, and BIP38 : http://www.codeproject.com/Articles/775226/NBitcoin-Cryptography-Part

Bitcoin address 15sYbVpRh6dyWycZMwPdxJWD4xbfxReeHe
Farghaly
Newbie
*
Offline Offline

Activity: 38
Merit: 0


View Profile
December 08, 2014, 07:28:20 PM
 #2

Great work. I posted about it https://twitter.com/BitcoinProg/status/542037614950236160 to get attention of .Net developers
Nicolas Dorier (OP)
Hero Member
*****
Offline Offline

Activity: 714
Merit: 662


View Profile
December 08, 2014, 07:57:31 PM
 #3

Thanks !
Just finished to add WP8 to the mix.

So if someone have a xamarin project, he create a portable lib referenced to all plateform specific projects without problem ! Smiley

Bitcoin address 15sYbVpRh6dyWycZMwPdxJWD4xbfxReeHe
laurentmt
Sr. Member
****
Offline Offline

Activity: 384
Merit: 258


View Profile
December 08, 2014, 07:57:58 PM
 #4

Huge news !
Keep up the good work.
doof
Hero Member
*****
Offline Offline

Activity: 765
Merit: 503


View Profile WWW
December 10, 2014, 01:23:41 AM
 #5

Looks good, was just about to start coding a script parser.  No need to now.
Nicolas Dorier (OP)
Hero Member
*****
Offline Offline

Activity: 714
Merit: 662


View Profile
December 10, 2014, 02:02:02 AM
 #6

yep, support all the OPs, example of parsing :

Quote
var bytes = new Script("1 pubkey1 pubkey2 2 OP_CHECKMULTISIG").ToBytes();

There is several class for generating Script so it is easier than writing yourself : PayTo*****Template

Bitcoin address 15sYbVpRh6dyWycZMwPdxJWD4xbfxReeHe
doof
Hero Member
*****
Offline Offline

Activity: 765
Merit: 503


View Profile WWW
December 10, 2014, 03:32:19 AM
 #7

yep, support all the OPs, example of parsing :

Quote
var bytes = new Script("1 pubkey1 pubkey2 2 OP_CHECKMULTISIG").ToBytes();

There is several class for generating Script so it is easier than writing yourself : PayTo*****Template
Is there the reverse too?  Take bytes and turn into script stack?
Nicolas Dorier (OP)
Hero Member
*****
Offline Offline

Activity: 714
Merit: 662


View Profile
December 10, 2014, 12:32:15 PM
 #8

yep, support all the OPs, example of parsing :

Quote
var bytes = new Script("1 pubkey1 pubkey2 2 OP_CHECKMULTISIG").ToBytes();

There is several class for generating Script so it is easier than writing yourself : PayTo*****Template
Is there the reverse too?  Take bytes and turn into script stack?

Yes,

Quote
var str = new Script(bytes).ToString();

If by "script stack" you refer to the stack after a script execution, then.

Quote
var stack = new ScriptEvaluationContext().EvalScript(script,tx,n).Stack;

Bitcoin address 15sYbVpRh6dyWycZMwPdxJWD4xbfxReeHe
doof
Hero Member
*****
Offline Offline

Activity: 765
Merit: 503


View Profile WWW
December 15, 2014, 06:13:34 AM
 #9

yep, support all the OPs, example of parsing :

Quote
var bytes = new Script("1 pubkey1 pubkey2 2 OP_CHECKMULTISIG").ToBytes();

There is several class for generating Script so it is easier than writing yourself : PayTo*****Template
Is there the reverse too?  Take bytes and turn into script stack?

Yes,

Quote
var str = new Script(bytes).ToString();

If by "script stack" you refer to the stack after a script execution, then.

Quote
var stack = new ScriptEvaluationContext().EvalScript(script,tx,n).Stack;
Thanks for the reply, I will take a look tonight.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!