{"id":13429889,"url":"https://github.com/MetacoSA/NBitcoin","last_synced_at":"2025-03-16T04:31:17.808Z","repository":{"id":15855893,"uuid":"18596168","full_name":"MetacoSA/NBitcoin","owner":"MetacoSA","description":"Comprehensive Bitcoin library for the .NET framework.","archived":false,"fork":false,"pushed_at":"2024-10-27T13:07:13.000Z","size":68032,"stargazers_count":1877,"open_issues_count":120,"forks_count":848,"subscribers_count":165,"default_branch":"master","last_synced_at":"2024-10-29T14:59:23.260Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"facebook/php-graph-sdk","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MetacoSA.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-04-09T12:22:52.000Z","updated_at":"2024-10-29T01:40:12.000Z","dependencies_parsed_at":"2023-02-16T19:01:20.440Z","dependency_job_id":"ff8bead3-a70d-4a58-9361-7eb12c89afcf","html_url":"https://github.com/MetacoSA/NBitcoin","commit_stats":{"total_commits":3151,"total_committers":132,"mean_commits":23.87121212121212,"dds":"0.19866708981275782","last_synced_commit":"db86ab33629e8f2efbad1a952862189091936e51"},"previous_names":["nicolasdorier/nbitcoin"],"tags_count":924,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MetacoSA%2FNBitcoin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MetacoSA%2FNBitcoin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MetacoSA%2FNBitcoin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MetacoSA%2FNBitcoin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MetacoSA","download_url":"https://codeload.github.com/MetacoSA/NBitcoin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243826788,"owners_count":20354220,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T02:00:47.263Z","updated_at":"2025-03-16T04:31:17.802Z","avatar_url":"https://github.com/MetacoSA.png","language":"C#","funding_links":[],"categories":["Frameworks, Libraries and Tools",".Net Libraries","框架, 库和工具","C\\#","JavaScript/TypeScript Tools","awesome Bitcoin","Blockchain"],"sub_categories":["Blockchain","区块链","E-Books"],"readme":"# NBitcoin\n\n[![Join the chat at https://chat.btcpayserver.org/btcpayserver/channels/nbitcoin](https://img.shields.io/badge/Community%20Chat-Mattermost-%230058cc)](https://chat.btcpayserver.org/btcpayserver/channels/nbitcoin)\n[![Build status](https://github.com/MetacoSA/NBitcoin/actions/workflows/CI.yml/badge.svg?branch=master\u0026event=push)](https://github.com/MetacoSA/NBitcoin/actions?query=branch%3Amaster)\n\nNBitcoin 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 [mattermost chat room](https://chat.btcpayserver.org/btcpayserver/channels/nbitcoin).\nIt 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)\n\nThe best documentation available is our [eBook](https://programmingblockchain.gitbooks.io/programmingblockchain/content/), and the excellent unit tests. There are also some more resources below.\n\nYou can also browse the API easily through [the API reference](https://metacosa.github.io/NBitcoin/api/index.html).\n\n# How to use ?\n\nIn .NET Core:\n```bash\ndotnet add package NBitcoin\n```\nIf using legacy .NET Framework in Visual Studio\n```bash\nInstall-Package NBitcoin\n```\nYou can also just use the `Manage NuGet Package` window on your project in Visual Studio.\n\nGo on the [NuGet website](https://www.nuget.org/packages/NBitcoin/) for more information.\n\nThe packages support:\n\n* With full features: Windows Desktop applications, Mono Desktop applications and platforms supported by [.NET Standard 1.3](https://docs.microsoft.com/en-us/dotnet/articles/standard/library) (.NET Core, Xamarin IOS, Xamarin Android, UWP and more).\n* With limited features: platforms supported by [.NET Standard 1.1](https://docs.microsoft.com/en-us/dotnet/articles/standard/library) (Windows Phone, Windows 8.0 apps).\n\nTo compile it by yourself, you can git clone, open the project and hit the compile button in Visual Studio.\n\n\n # How to get started? \n \n First, you need to understand Bitcoin, for this read:\n * [Programming The Blockchain in C#](https://programmingblockchain.gitbooks.io/programmingblockchain/content/)\n\n Once you get familiar with Bitcoin terminology with this book, follow up by reading:\n\n * [NBitcoin documentation](https://github.com/NicolasDorier/NBitcoin.Docs/blob/master/README.md)\n\n This will teach you how to use NBitcoin in a practical way.\n\n# How to use with Altcoins ?\n\n\u003e **Install-Package NBitcoin.Altcoins** \n\nFind more information [here](NBitcoin.Altcoins).\n\n# How to debug in NBitcoin source code?\n\nWhen a new version of `NBitcoin`, `NBitcoin.Altcoins` or `NBitcoin.TestFramework` is released on Nuget, we also upload a separate symbol package (`snupkg`) with SourceLink enabled. This is enabled from version `4.1.1.73`.\n\nThis means that it is possible to debug into NBitcoin code, and the source will be fetched transparently from github.\n\nThis works on both Visual Studio Code and Visual Studio for Windows.\n\n## Debug inside source with Visual Studio\n\nYou need to run at least Visual Studio 15.9.\nThen, you need to:\n\n* Go in `Tools / Options / Debugging / General` and turn off `Enable Just My Code`.\n* Go in `Tools / Options / Debugging / Symbols` and add `https://symbols.nuget.org/download/symbols` to the `Symbol file (.pdb) locations`, make sure it is checked.\n\nYou should also check `Microsoft Symbol Server` or your debugging experience in visual studio will be slowed down.\n\nNow you can Debug your project and step inside any call to NBitcoin.\n\n## Debug inside source with Visual Studio Code\n\nInside your `launch.json`, add the following to `.NET Core Launch (console)` configuration:\n\n```json\n\"justMyCode\": false,\n\"symbolOptions\": {\n    \"searchPaths\": [ \"https://symbols.nuget.org/download/symbols\" ],\n    \"searchMicrosoftSymbolServer\": true\n},\n```\n\nNow you can Debug your project and step inside any call to NBitcoin.\n\n# How to use with my own blockchain?\n\n Find more information [here](NBitcoin.Altcoins).\n\n# How to use in Unity?\n\nYou should use at least `Unity 2018.2` using `Script Runtime Version` `.NET 4.x Equivalent` and `Api Compatibility Level` `.NET Standard 2.0`.\nYou can see more on [this post](https://blogs.unity3d.com/2018/07/11/scripting-runtime-improvements-in-unity-2018-2/).\n\nThen you need to compile NBitcoin:\n\n```powershell\ngit clone https://github.com/MetacoSA/NBitcoin/\ncd NBitcoin/NBitcoin\ndotnet publish -c Release -f netstandard2.0\nRemove-Item -Force -Recurse .\\bin\\Release\\netstandard2.0\\publish\\runtimes\\\n```\n\nThen put the libraries of `.\\bin\\Release\\netstandard2.0` into your asset folder.\n\nIf you need altcoins support, use the same step but with `cd NBitcoin/NBitcoin.Altcoins` instead.\n\n# How to use in .NET Core\n\nIf you want to use .NET Core, first install .NET Core [as documented here](https://www.microsoft.com/net/core#windowsvs2017).\n\nThen:\n```\nmkdir MyProject\ncd MyProject\ndotnet new console\ndotnet add package NBitcoin\ndotnet restore\n```\nThen edit your Program.cs:\n```\nusing System;\nusing NBitcoin;\n\nnamespace _125350929\n{\n    class Program\n    {\n        static void Main(string[] args)\n        {\n            Console.WriteLine(\"Hello World! \" + new Key().GetWif(Network.Main));\n        }\n    }\n}\n```\nYou can then run with\n```\ndotnet run\n```\n\nWe advise you to use [Visual Studio Code](https://code.visualstudio.com/) as the editor for your project.\n\n## Description\nNBitcoin notably includes:\n\n* A [TransactionBuilder](http://www.codeproject.com/Articles/835098/NBitcoin-Build-Them-All) supporting Stealth, Open Asset, and all standard transactions\n* Full script evaluation and parsing\n* A RPC Client\n* A Rest Client\n* The parsing of standard scripts and creation of custom ones\n* The serialization of blocks, transactions and scripts\n* The signing and verification with private keys (with support for compact signatures) for proving ownership\n* Bloom filters and partial merkle trees\n* Segregated Witness ([BIP 141](https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki), [BIP 143](https://github.com/bitcoin/bips/blob/master/bip-0143.mediawiki), [BIP 144](https://github.com/bitcoin/bips/blob/master/bip-0144.mediawiki))\n* Bech32 segwit address implementation with error detection [BIP 173](https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki)\n* Mnemonic code for generating deterministic keys ([BIP 39](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki)), credits to [Thasshiznets](https://github.com/Thashiznets/BIP39.NET)\n* Hierarchical Deterministic Wallets ([BIP 32](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki))\n* Payment URLs ([BIP 21](https://github.com/bitcoin/bips/blob/master/bip-0021.mediawiki))\n* Full Bitcoin P2P implementation with SOCKS5 support for connecting through Tor\n* [A C# implementation of secp256k1](NBitcoin.Secp256k1/README.md)\n\nPlease read our [ebook](https://programmingblockchain.gitbooks.io/programmingblockchain/content/) to understand the capabilities.\n\nNBitcoin 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.\n\nNBitcoin is licensed under the [MIT License](https://opensource.org/licenses/MIT) and we encourage you to use it to explore, learn, debug, play, share and create software for Bitcoin and with other Metaco services.\n\n## How to connect use a SOCKS5 proxy to connect to a Bitcoin node?\n\nHere an example which assume you run Tor with SOCKS5 proxy on port 9050.\n```csharp\nvar connectionParameters = new NodeConnectionParameters();\nconnectionParameters.TemplateBehaviors.Add(new SocksSettingsBehavior(Utils.ParseEndpoint(\"localhost\", 9050)));\nNode node = await Node.ConnectAsync(Network.Main, \"7xnmrhmkvptbcvpl.onion:8333\", connectionParameters);\nnode.VersionHandshake();\n```\n\n## Some OSS projects using NBitcoin\n\n* [Wasabi](http://github.com/zkSNACKs/WalletWasabi): Privacy focused, ZeroLink compliant Bitcoin wallet.\n\n* [StratisBitcoinFullNode](http://github.com/stratisproject/StratisBitcoinFullNode): Bitcoin full node in C# https://stratisplatform.com\n\n* [Breeze](http://github.com/stratisproject/Breeze): Breeze Wallet, the first full-block SPV bitcoin wallet \n\n* [BlockExplorer](http://github.com/stratisproject/BlockExplorer): A set of projects that can index and query stratis blockchains on the fullnode. \n\n* [BTCPay Server](http://github.com/btcpayserver/btcpayserver): A cross platform, self-hosted server compatible with Bitpay API \n\n* [NTumbleBit](http://github.com/NTumbleBit/NTumbleBit): TumbleBit Implementation in .NET Core \n\n* [BitPoker](http://github.com/bitcoinbrisbane/BitPoker): Decentralised peer to peer poker, using bitcoin http://www.bitpoker.io\n\n* [Zen-Wallet](http://github.com/zenprotocol/zen-wallet): Node and GUI for the Zen Protocol. https://www.zenprotocol.com\n\n* [Metaco-Trader](http://github.com/MetacoSA/Metaco-Trader): Bitcoin Wallet for advanced user based on a NBitcoin.Server \n\n* [Swarmops](http://github.com/Swarmops/Swarmops): Admin backend for any bitcoin-native or swarm organization http://sandbox.swarmops.com/\n\n* [Nako](http://github.com/CoinVault/Nako): A Bitcoin and Altcoin server api that indexes blockchain transactions and addresses \n\n* [NBXplorer](http://github.com/dgarage/NBXplorer): A minimalist UTXO tracker for HD Wallets with bitcoin based altcoin support \n\n* [UnitCurrency](http://github.com/unitcurrency/unitcurrency): UnitCoin - a hybrid scrypt PoW + PoS based cryptocurrency.\n\n* [Openchain](http://github.com/openchain/openchain): Openchain node reference implementation. https://www.openchain.org/\n\n* [BreezeProject](http://github.com/BreezeHub/BreezeProject): Breeze Masternode and Wallet with Breeze Privacy Protocol \n\n* [geewallet](https://gitlab.com/nblockchain/geewallet/): Non-custodial, minimalistic \u0026 pragmatist opensource crossplatform lightweight brainwallet to hold the most important cryptoassets in the same application with ease \u0026 peace of mind\n\n* [blockcore](https://github.com/block-core/blockcore): Modular Bitcoin fullnode implementation. https://www.blockcore.net/\n\n## Useful doc :\n\n* **Ebook** [Programming The Blockchain in C#](https://www.gitbook.com/book/programmingblockchain/programmingblockchain/details)\n\n* **NBitcoin Github** : [https://github.com/NicolasDorier/NBitcoin](https://github.com/NicolasDorier/NBitcoin \"https://github.com/NicolasDorier/NBitcoin\")\n\n* **NBitcoin Nuget** : [https://www.nuget.org/packages/NBitcoin/](https://www.nuget.org/packages/NBitcoin/ \"https://www.nuget.org/packages/NBitcoin/\")\n\n* **Intro**: [http://www.codeproject.com/Articles/768412/NBitcoin-The-most-complete-Bitcoin-port-Part-Crypt](http://www.codeproject.com/Articles/768412/NBitcoin-The-most-complete-Bitcoin-port-Part-Crypt)\n\n* **Stealth Payment**, and **BIP38** : [http://www.codeproject.com/Articles/775226/NBitcoin-Cryptography-Part](http://www.codeproject.com/Articles/775226/NBitcoin-Cryptography-Part)\n\n* **How to build transaction** : [http://www.codeproject.com/Articles/835098/NBitcoin-Build-Them-All](http://www.codeproject.com/Articles/835098/NBitcoin-Build-Them-All \"http://www.codeproject.com/Articles/835098/NBitcoin-Build-Them-All\")\n\n* **Using the NBitcoin Indexer** : [http://www.codeproject.com/Articles/819567/NBitcoin-Indexer-A-scalable-and-fault-tolerant-blo](http://www.codeproject.com/Articles/819567/NBitcoin-Indexer-A-scalable-and-fault-tolerant-blo \"http://www.codeproject.com/Articles/819567/NBitcoin-Indexer-A-scalable-and-fault-tolerant-blo\")\n\n* **How to Scan the blockchain** : [http://www.codeproject.com/Articles/784519/NBitcoin-How-to-scan-the-Blockchain](http://www.codeproject.com/Articles/784519/NBitcoin-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)\n\nPlease, use github issues for questions or feedback. For confidential requests or specific demands, contact us on [Metaco support](mailto:support@metaco.com \"support@metaco.com\").\n\n\n## Useful link for a free IDE :\nVisual Studio Community Edition : [https://www.visualstudio.com/products/visual-studio-community-vs](https://www.visualstudio.com/products/visual-studio-community-vs \"https://www.visualstudio.com/products/visual-studio-community-vs\")\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMetacoSA%2FNBitcoin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMetacoSA%2FNBitcoin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMetacoSA%2FNBitcoin/lists"}