NBitcoin is the most complete Bitcoin library for the .NET platform. It implements all most relevant Bitcoin Improvement Proposals (BIPs). It also provides low level access to Bitcoin primitives so you can easily build your application on top of it. Join us in our gitter chat room. It works on Windows, Mac and Linux with Xamarin, Unity, .NET Core or CLR. (Porting to Unity should not be that hard if you need it)
The best documentation available is our eBook, and the excellent unit tests. There are also some more resources below.
With NuGet :
Install-Package NBitcoin
Go on the NuGet website for more information.
The packages supports:
- With full features: Windows Desktop applications, Mono Desktop applications and platforms supported by .NET Standard 1.3 (.NET Core, Xamarin IOS, Xamarin Android, UWP and more).
- With limited features: Platforms supported by .NET Standard 1.1 (Windows Phone, Windows 8.0 apps).
To compile it by yourself, you can git clone, open the project and hit the compile button in Visual Studio. How to get started ? Check out this article on CodeProject for some basic Bitcoin operations, or this Introduction to NBitcoin video.
Install-Package NBitcoin.Altcoins
Find more information here.
Find more information here.
In command prompt:
git clone https://github.com/MetacoSA/NBitcoin/
cd NBitcoin
git checkout unity35
build-unity.bat
Then put the two libraries NBitcoin.dll and System.Threading.Tasks.Net35.dll found in "NBitcoin\NBitcoin\bin\Release" into your asset folder.
If you want to use .NET Core, first install .NET Core as documented here.
Then:
mkdir MyProject
cd MyProject
dotnet new console
dotnet add package NBitcoin
dotnet restore
Then edit your Program.cs:
using System;
using NBitcoin;
namespace _125350929
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World! " + new Key().GetWif(Network.Main));
}
}
}
You can then run with
dotnet run
We advise you to use Visual Studio Code as the editor for your project.
NBitcoin notably includes:
- A TransactionBuilder supporting Stealth, Open Asset, and all standard transactions
- Full script evaluation and parsing
- A RPC Client
- A Rest Client
- A SPV Wallet implementation with sample
- The parsing of standard scripts and creation of custom ones
- The serialization of blocks, transactions and scripts
- The signing and verification with private keys (with support for compact signatures) for proving ownership
- Bloom filters and partial merkle trees
- Segregated Witness (BIP 141, BIP 143, BIP 144)
- Bech32 segwit address implementation with error detection BIP 173
- Mnemonic code for generating deterministic keys (BIP 39), credits to Thasshiznets
- Hierarchical Deterministic Wallets (BIP 32)
- Payment Protocol (BIP 70)
- Payment URLs (BIP 21,BIP 72)
- Two-Factor keys (BIP 38)
- Stealth Addresses (Also on codeproject)
NBitcoin is inspired by Bitcoin Core code but provides a simpler object oriented API (e.g., new Key().PubKey.Address.ToString() to generate a key and get the associated address). It relies on the BouncyCastle cryptography library instead of OpenSSL, yet replicates OpenSSL bugs to guarantee compatibility. NBitcoin also ports the integrality of Bitcoin Core unit tests with their original data in order to validate the compatibility of the two implementations.
NBitcoin is licensed under the MIT License and we encourage you to use it to explore, learn, debug, play, share and create software for Bitcoin and with other Metaco services.
-
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
-
Stealth Payment, and BIP38 : http://www.codeproject.com/Articles/775226/NBitcoin-Cryptography-Part
-
How to build transaction : http://www.codeproject.com/Articles/835098/NBitcoin-Build-Them-All
-
Using the NBitcoin Indexer : http://www.codeproject.com/Articles/819567/NBitcoin-Indexer-A-scalable-and-fault-tolerant-blo
-
How to Scan the blockchain : http://www.codeproject.com/Articles/784519/NBitcoin-How-to-scan-the-Blockchain (You can dismiss the ScanState for that, now I concentrate on the indexer)
Please, use github issues for questions or feedback. For confidential requests or specific demands, contact us on Metaco support.
Visual Studio Community Edition : https://www.visualstudio.com/products/visual-studio-community-vs