.NET Bitcoin & Altcoins library
Dallar Tutorial
Simple quick Dallar tutorial is available on YouTube.
Features
- Fully compatible and up-to-date with Bitcoin Core 0.11.2 RPC API.
- 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.
- Custom RPC exceptions.
- Supports all Bitcoin clones.
- Can operate on unlimited daemons with a single library reference.
- Bitcoin, Litecoin, Dogecoin, SmartCash and Dash integrations included.
- Each coin instance can be fully parametrized at run-time and implement its own constants.
- Demo client included.
- Disconnected raw RPC connector included for quick'n'dirty debugging.
- Handles and relays RPC internal server errors along with their error code.
- Can work without a
.configfile. - Fully compatible with Mono.
- Test Network (testnet) and Regression Test Mode (regtest) ready.
- Fully configurable.
Donations
This library took a significant amount of time and effort to build and requires continuous maintenance in order to keep up with changes introduced with every new Bitcoin-Core release. Keep it up by donating at: 15Nb3RhMd13zp5Pc7yngUon83nFtEZUyBA
Support
Premium Support is available by our team of experts for $350/h (min 1 hour) at: hello@cryptean.com.
License
See LICENSE.
NuGet packages
BitcoinLib is available on NuGet:
- BitcoinLib
- [BitcoinLib_Dallar](https://www.nuget.org/packages/BitcoinLib_Dallar/
Install-Package BitcoinLib_Dallar
Versioning
From version 1.4.0, BitcoinLib follows Semantic Versioning 2.0.0.
Building from source
To build BitcoinLib from source, you will need either the .NET Core SDK or Visual Studio.
Linux-specific
If you are using Linux you will also need Mono installed (in order to run Paket). The full install sequence (for Ubuntu) will be something like this.
Building & running tests
With Visual Studio you can build BitcoinLib and run the tests
from inside the IDE, otherwise with the dotnet command-line
tool you can execute:
dotnet build src/BitcoinLib.sln
The first time you run it, this will use Paket to restore all the packages, and then build the code.
Instructions for Bitcoin
- Locate your
bitcoin.conffile (in Windows it's under:%AppData%\Roaming\Bitcoin, if it's not there just go ahead and create it) and add these lines:rpcuser = MyRpcUsername rpcpassword = MyRpcPassword server=1 txindex=1 - Edit the
app.configfile in the Console test client to best fit your needs. Make sure you also update thebitcoin.conffile when you alter theBitcoin_RpcUsernameandBitcoin_RpcPasswordparameters.
Instructions for Litecoin and other Bitcoin clones
- Perform the same steps as those mentioned above for Bitcoin.
- Litecoin configuration file is:
litecoin.confunder:%AppData%\Roaming\Litecoinand its daemon is:litecoind. - Each coin can be initialized by its own interface specification:
IBitcoinService BitcoinService = new BitcoinService();ILitecoinService LitecoinService = new LitecoinService();
- Any bitcoin clone can be adopted without any further installation steps with the use of the generic
ICryptocoinService:ICryptocoinService cryptocoinService = new CryptocoinService("daemonUrl", "rpcUsername", "rpcPassword", "walletPassword");
- Use
(ICryptocoinService).Parametersto fully configure each coin pointer at run-time.
Configuration
Sample configuration:
<?xml version="1.0" encoding="utf-8"?> <configuration> <appSettings> <!-- BitcoinLib settings start --> <!-- Shared RPC settings start --> <add key="RpcRequestTimeoutInSeconds" value="10" /> <!-- Shared RPC settings end --> <!-- Bitcoin settings start --> <add key="Bitcoin_DaemonUrl" value="http://localhost:8332" /> <add key="Bitcoin_DaemonUrl_Testnet" value="http://localhost:18332" /> <add key="Bitcoin_WalletPassword" value="MyWalletPassword" /> <add key="Bitcoin_RpcUsername" value="MyRpcUsername" /> <add key="Bitcoin_RpcPassword" value="MyRpcPassword" /> <!-- Bitcoin settings end --> <!-- BitcoinLib settings end --> </appSettings> </configuration>