Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions demo/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@
<add key="Sarcoin_RpcPassword" value="MyRpcPassword" />
<!-- Sarcoin settings end -->

<!-- Dash settings start -->
<add key="Dash_DaemonUrl" value="http://localhost:9998" />
<add key="Dash_DaemonUrl_Testnet" value="http://localhost:19998" />
<add key="Dash_WalletPassword" value="MyWalletPassword" />
<add key="Dash_RpcUsername" value="MyRpcUsername" />
<add key="Dash_RpcPassword" value="MyRpcPassword" />
<!-- Dash settings end -->

<!-- Demo client settings start -->
<add key="ExtractMyPrivateKeys" value="false" />
<!-- Demo client settings end -->
Expand Down
4 changes: 4 additions & 0 deletions src/BitcoinLib/BitcoinLib.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
<Compile Include="Auxiliary\Encoders\HexEncoder.cs" />
<Compile Include="Auxiliary\GlobalConstants.cs" />
<Compile Include="Auxiliary\Hashing.cs" />
<Compile Include="CoinParameters\Dash\DashConstants.cs" />
<Compile Include="CoinParameters\Dash\IDashConstants.cs" />
<Compile Include="CoinParameters\Dogecoin\DogecoinConstants.cs" />
<Compile Include="CoinParameters\Dogecoin\IDogecoinConstants.cs" />
<Compile Include="ExceptionHandling\RawTransactions\RawTransactionExcessiveFeeException.cs" />
Expand Down Expand Up @@ -118,6 +120,8 @@
</Compile>
<Compile Include="Services\Coins\Cryptocoin\CryptocoinService.cs" />
<Compile Include="Services\Coins\Cryptocoin\ICryptocoinService.cs" />
<Compile Include="Services\Coins\Dash\DashService.cs" />
<Compile Include="Services\Coins\Dash\IDashService.cs" />
<Compile Include="Services\Coins\Dogecoin\DogecoinService.cs" />
<Compile Include="Services\Coins\Dogecoin\IDogecoinService.cs" />
<Compile Include="Services\Coins\Litecoin\ILitecoinService.cs" />
Expand Down
40 changes: 40 additions & 0 deletions src/BitcoinLib/CoinParameters/Base/CoinParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using BitcoinLib.Services.Coins.Base;
using BitcoinLib.Services.Coins.Bitcoin;
using BitcoinLib.Services.Coins.Cryptocoin;
using BitcoinLib.Services.Coins.Dash;
using BitcoinLib.Services.Coins.Dogecoin;
using BitcoinLib.Services.Coins.Litecoin;
using BitcoinLib.Services.Coins.Sarcoin;
Expand Down Expand Up @@ -219,6 +220,45 @@ public CoinParameters(ICoinService coinService,

#endregion

#region Dash

else if (coinService is DashService)
{
if (!IgnoreConfigFiles)
{
DaemonUrl = ConfigurationManager.AppSettings.Get("Dash_DaemonUrl");
DaemonUrlTestnet = ConfigurationManager.AppSettings.Get("Dash_DaemonUrl_Testnet");
RpcUsername = ConfigurationManager.AppSettings.Get("Dash_RpcUsername");
RpcPassword = ConfigurationManager.AppSettings.Get("Dash_RpcPassword");
WalletPassword = ConfigurationManager.AppSettings.Get("Dash_WalletPassword");
}

CoinShortName = "DASH";
CoinLongName = "Dash";
IsoCurrencyCode = "DASH";

TransactionSizeBytesContributedByEachInput = 148;
TransactionSizeBytesContributedByEachOutput = 34;
TransactionSizeFixedExtraSizeInBytes = 10;

FreeTransactionMaximumSizeInBytes = 1000;
FreeTransactionMinimumOutputAmountInCoins = 0.0001M;
FreeTransactionMinimumPriority = 57600000;
FeePerThousandBytesInCoins = 0.0001M;
MinimumTransactionFeeInCoins = 0.001M;
MinimumNonDustTransactionAmountInCoins = 0.0000543M;

TotalCoinSupplyInCoins = 18900000;
EstimatedBlockGenerationTimeInMinutes = 2.7;
BlocksHighestPriorityTransactionsReservedSizeInBytes = 50000;

BaseUnitName = "Duff";
BaseUnitsPerCoin = 100000000;
CoinsPerBaseUnit = 0.00000001M;
}

#endregion

#region Agnostic coin (cryptocoin)

else if (coinService is CryptocoinService)
Expand Down
18 changes: 18 additions & 0 deletions src/BitcoinLib/CoinParameters/Dash/DashConstants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using BitcoinLib.CoinParameters.Base;

namespace BitcoinLib.CoinParameters.Dash
{
public static class DashConstants
{
public sealed class Constants : CoinConstants<Constants>
{
public readonly ushort CoinReleaseHalfsEveryXInYears = 7;
public readonly ushort DifficultyIncreasesEveryXInBlocks = 34560;
public readonly uint OneDashInDuffs = 100000000;
public readonly decimal OneDuffInDash = 0.00000001M;
public readonly decimal OneMicrodashInDash = 0.000001M;
public readonly decimal OneMillidashInDash = 0.001M;
public readonly string Symbol = "DASH";
}
}
}
7 changes: 7 additions & 0 deletions src/BitcoinLib/CoinParameters/Dash/IDashConstants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace BitcoinLib.CoinParameters.Dash
{
public interface IDashConstants
{
DashConstants.Constants Constants { get; }
}
}
33 changes: 33 additions & 0 deletions src/BitcoinLib/Services/Coins/Dash/DashService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using BitcoinLib.CoinParameters.Dash;
using BitcoinLib.RPC.Specifications;

namespace BitcoinLib.Services.Coins.Dash
{
public class DashService : CoinService, IDashService
{
public DashService(bool useTestnet = false) : base(useTestnet)
{
}

public DashService(string daemonUrl, string rpcUsername, string rpcPassword, string walletPassword)
: base(daemonUrl, rpcUsername, rpcPassword, walletPassword)
{
}

public DashService(string daemonUrl, string rpcUsername, string rpcPassword, string walletPassword,
short rpcRequestTimeoutInSeconds)
: base(daemonUrl, rpcUsername, rpcPassword, walletPassword, rpcRequestTimeoutInSeconds)
{
}

/// <inheritdoc />
public string SendToAddress(string dashAddress, decimal amount, string comment = null, string commentTo = null,
bool subtractFeeFromAmount = false, bool useInstantSend = false, bool usePrivateSend = false)
{
return _rpcConnector.MakeRequest<string>(RpcMethods.sendtoaddress, dashAddress, amount, comment, commentTo,
subtractFeeFromAmount, useInstantSend, usePrivateSend);
}

public DashConstants.Constants Constants => DashConstants.Constants.Instance;
}
}
32 changes: 32 additions & 0 deletions src/BitcoinLib/Services/Coins/Dash/IDashService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using BitcoinLib.CoinParameters.Dash;
using BitcoinLib.Services.Coins.Base;

namespace BitcoinLib.Services.Coins.Dash
{
public interface IDashService : ICoinService, IDashConstants
{
/// <summary>
/// Send an amount to a given address.
/// </summary>
/// <param name="dashAddress">The dash address to send to.</param>
/// <param name="amount">The amount in DASH to send. eg 0.1.</param>
/// <param name="comment">
/// A comment used to store what the transaction is for. This is not part of the transaction,
/// just kept in your wallet.
/// </param>
/// <param name="commentTo">
/// A comment to store the name of the person or organization to which you're sending the
/// transaction. This is not part of the transaction, just kept in your wallet.
/// </param>
/// <param name="subtractFeeFromAmount">
/// The fee will be deducted from the amount being sent. The recipient will receive
/// less amount of Dash than you enter in the amount field.
/// </param>
/// <param name="useInstantSend">Send this transaction as InstantSend.</param>
/// <param name="usePrivateSend">Use anonymized funds only.</param>
/// <returns>The transaction id.</returns>
string SendToAddress(string dashAddress, decimal amount, string comment = null,
string commentTo = null, bool subtractFeeFromAmount = false, bool useInstantSend = false,
bool usePrivateSend = false);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace BitcoinLib.Services
// Implementation of API calls list, as found at: https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_Calls_list (note: this list is often out-of-date so call "help" in your bitcoin-cli to get the latest signatures)
public partial class CoinService : ICoinService
{
private readonly IRpcConnector _rpcConnector;
protected readonly IRpcConnector _rpcConnector;

public CoinService()
{
Expand Down