Author

Topic: NBitcoin : Mac, IOS, Android, Windows phone 8.1, Windows * Compatible Library (Read 3969 times)

hero member
Activity: 765
Merit: 503
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.
hero member
Activity: 714
Merit: 662
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;
hero member
Activity: 765
Merit: 503
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?
hero member
Activity: 714
Merit: 662
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
hero member
Activity: 765
Merit: 503
Looks good, was just about to start coding a script parser.  No need to now.
sr. member
Activity: 384
Merit: 258
Huge news !
Keep up the good work.
hero member
Activity: 714
Merit: 662
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
newbie
Activity: 38
Merit: 0
Great work. I posted about it https://twitter.com/BitcoinProg/status/542037614950236160 to get attention of .Net developers
hero member
Activity: 714
Merit: 662
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
Jump to: