mirror of
https://github.com/aljazceru/BTCPayServerPlugins.git
synced 2026-02-19 14:44:20 +01:00
update
This commit is contained in:
@@ -63,7 +63,8 @@ public class AffiliateServerController:Controller
|
||||
[HttpGet("history")]
|
||||
public async Task<IActionResult> ViewRequests()
|
||||
{
|
||||
var path = Path.Combine(_dataDirectories.Value.DataDir, "Plugins", "CoinjoinAffiliate", "History.txt");
|
||||
|
||||
var path = Path.Combine(_dataDirectories.Value.DataDir, "Plugins", "CoinjoinAffiliate", $"History{DateTime.Today:dd_MM_yyyy}.txt");
|
||||
if (!System.IO.File.Exists(path))
|
||||
return NotFound();
|
||||
|
||||
@@ -73,8 +74,10 @@ public class AffiliateServerController:Controller
|
||||
|
||||
[AllowAnonymous]
|
||||
[HttpPost("get_status")]
|
||||
[HttpGet("get_status")]
|
||||
public async Task<IActionResult> GetStatus()
|
||||
{
|
||||
_logger.LogTrace("GetStatus Called");
|
||||
var settings =
|
||||
await _settingsRepository.GetSettingAsync<WabisabiAffiliateSettings>();
|
||||
if(settings?.Enabled is true&& !string.IsNullOrEmpty(settings.SigningKey))
|
||||
@@ -88,8 +91,11 @@ public class AffiliateServerController:Controller
|
||||
|
||||
[AllowAnonymous]
|
||||
[HttpPost("notify_coinjoin")]
|
||||
[HttpGet("notify_coinjoin")]
|
||||
public async Task<IActionResult> GetCoinjoinRequest()
|
||||
{
|
||||
|
||||
_logger.LogTrace("notify_coinjoin Called");
|
||||
var settings = await _settingsRepository.GetSettingAsync<WabisabiAffiliateSettings>();
|
||||
if (settings?.Enabled is not true)
|
||||
{
|
||||
@@ -106,12 +112,15 @@ public class AffiliateServerController:Controller
|
||||
{
|
||||
|
||||
var valid = ecdsa.VerifyData(payload.GetCanonicalSerialization(), request.Signature, HashAlgorithmName.SHA256);
|
||||
if(!valid)
|
||||
if (!valid)
|
||||
{
|
||||
|
||||
_logger.LogError($"Invalid coinjoin request sent\n{payload.GetCanonicalSerialization()}\n{request.Signature}" );
|
||||
return NotFound();
|
||||
|
||||
var path = Path.Combine(_dataDirectories.Value.DataDir, "Plugins", "CoinjoinAffiliate", "History.txt");
|
||||
}
|
||||
var path = Path.Combine(_dataDirectories.Value.DataDir, "Plugins", "CoinjoinAffiliate", $"History{DateTime.Today:dd_MM_yyyy}.txt");
|
||||
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path)!);
|
||||
await System.IO.File.AppendAllLinesAsync(path, new[] {JObject.FromObject(request).ToString(Formatting.None).Replace(Environment.NewLine, "")}, Encoding.UTF8);
|
||||
var response = new CoinJoinNotificationResponse(Array.Empty<byte>());
|
||||
return Json(response, AffiliationJsonSerializationOptions.Settings);
|
||||
|
||||
@@ -80,7 +80,7 @@ public class BTCPayCoinjoinCoinSelector : IRoundCoinSelector
|
||||
minCoins,
|
||||
new Dictionary<AnonsetType, int>() {{AnonsetType.Red, 1}, {AnonsetType.Orange, 1}, {AnonsetType.Green, 1}},
|
||||
_wallet.ConsolidationMode, liquidityClue);
|
||||
_logger.LogInformation(solution.ToString());
|
||||
_logger.LogTrace(solution.ToString());
|
||||
return solution.Coins.ToImmutableList();
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<PropertyGroup>
|
||||
<Product>Wabisabi Coinjoin</Product>
|
||||
<Description>Allows you to integrate your btcpayserver store with coinjoins.</Description>
|
||||
<Version>1.0.11</Version>
|
||||
<Version>1.0.12</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Plugin development properties -->
|
||||
@@ -43,7 +43,7 @@
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NNostr.Client" Version="0.0.18" />
|
||||
<PackageReference Include="NNostr.Client" Version="0.0.21" />
|
||||
</ItemGroup>
|
||||
<Target Name="DeleteExampleFile" AfterTargets="Publish">
|
||||
<RemoveDir Directories="$(PublishDir)\Microservices" />
|
||||
|
||||
@@ -575,7 +575,7 @@ public class BTCPayWallet : IWallet, IDestinationProvider
|
||||
}
|
||||
}
|
||||
|
||||
Logger.LogInformation($"unlocked utxos: {string.Join(',', unlocked)}");
|
||||
Logger.LogTrace($"unlocked utxos: {string.Join(',', unlocked)}");
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<IDestination>> GetNextDestinationsAsync(int count, bool preferTaproot, bool mixedOutputs)
|
||||
|
||||
@@ -1,32 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using BTCPayServer.Abstractions.Contracts;
|
||||
using BTCPayServer.Common;
|
||||
using BTCPayServer.Configuration;
|
||||
using BTCPayServer.Plugins.Wabisabi;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Hosting.Server;
|
||||
using Microsoft.AspNetCore.Hosting.Server.Features;
|
||||
using Microsoft.AspNetCore.Routing;
|
||||
using BTCPayServer.Services;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Options;
|
||||
using NBitcoin;
|
||||
using NBitcoin.RPC;
|
||||
using NBXplorer;
|
||||
using NBXplorer.Models;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NNostr.Client;
|
||||
using WalletWasabi.Affiliation;
|
||||
using WalletWasabi.Bases;
|
||||
using WalletWasabi.BitcoinCore.Rpc;
|
||||
using WalletWasabi.Cache;
|
||||
@@ -55,7 +43,8 @@ public class WabisabiCoordinatorService : PeriodicRunner
|
||||
public WabisabiCoordinatorService(ISettingsRepository settingsRepository,
|
||||
IOptions<DataDirectories> dataDirectories, IExplorerClientProvider clientProvider, IMemoryCache memoryCache,
|
||||
WabisabiCoordinatorClientInstanceManager instanceManager,
|
||||
IHttpClientFactory httpClientFactory) : base(TimeSpan.FromMinutes(15))
|
||||
IHttpClientFactory httpClientFactory,
|
||||
IServiceProvider serviceProvider) : base(TimeSpan.FromMinutes(15))
|
||||
{
|
||||
_settingsRepository = settingsRepository;
|
||||
_dataDirectories = dataDirectories;
|
||||
@@ -63,11 +52,13 @@ public class WabisabiCoordinatorService : PeriodicRunner
|
||||
_memoryCache = memoryCache;
|
||||
_instanceManager = instanceManager;
|
||||
_httpClientFactory = httpClientFactory;
|
||||
_socks5HttpClientHandler = serviceProvider.GetRequiredService<Socks5HttpClientHandler>();
|
||||
IdempotencyRequestCache = new(memoryCache);
|
||||
}
|
||||
|
||||
|
||||
private WabisabiCoordinatorSettings cachedSettings;
|
||||
private readonly Socks5HttpClientHandler _socks5HttpClientHandler;
|
||||
|
||||
public async Task<WabisabiCoordinatorSettings> GetSettings()
|
||||
{
|
||||
@@ -210,7 +201,7 @@ public class WabisabiCoordinatorService : PeriodicRunner
|
||||
{
|
||||
await Nostr.CreateCoordinatorDiscoveryEvent(network, s.NostrIdentity, s.UriToAdvertise,
|
||||
s.CoordinatorDescription)
|
||||
}, cancel);
|
||||
}, _socks5HttpClientHandler, cancel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using BTCPayServer.Services;
|
||||
using NBitcoin;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NNostr.Client;
|
||||
@@ -14,10 +15,15 @@ namespace BTCPayServer.Plugins.Wabisabi;
|
||||
public class Nostr
|
||||
{
|
||||
public static int Kind = 15750;
|
||||
public static string TypeTagIdentifier = "type";
|
||||
public static string TypeTagValue = "wabisabi";
|
||||
public static string NetworkTagIdentifier = "network";
|
||||
public static string EndpointTagIdentifier = "endpoint";
|
||||
|
||||
public static async Task Publish(
|
||||
Uri relayUri,
|
||||
NostrEvent[] evts,
|
||||
Socks5HttpClientHandler httpClientHandler,
|
||||
CancellationToken cancellationToken )
|
||||
{
|
||||
|
||||
@@ -69,12 +75,13 @@ public class Nostr
|
||||
CreatedAt = DateTimeOffset.UtcNow,
|
||||
Tags = new List<NostrEventTag>()
|
||||
{
|
||||
new() {TagIdentifier = "uri", Data = new List<string>() {new Uri(coordinatorUri, "plugins/wabisabi-coordinator").ToString()}},
|
||||
new() {TagIdentifier = "network", Data = new List<string>() {currentNetwork.Name.ToLower()}}
|
||||
new() {TagIdentifier = EndpointTagIdentifier, Data = new List<string>() {new Uri(coordinatorUri, "plugins/wabisabi-coordinator").ToString()}},
|
||||
new() {TagIdentifier = TypeTagIdentifier, Data = new List<string>() { TypeTagValue}},
|
||||
new() {TagIdentifier = NetworkTagIdentifier, Data = new List<string>() {currentNetwork.Name.ToLower()}}
|
||||
}
|
||||
};
|
||||
|
||||
await evt.ComputeIdAndSign(privateKey);
|
||||
await evt.ComputeIdAndSignAsync(privateKey);
|
||||
return evt;
|
||||
}
|
||||
|
||||
@@ -127,15 +134,18 @@ public class Nostr
|
||||
@event.CreatedAt < DateTimeOffset.UtcNow.AddMinutes(15) &&
|
||||
@event.Verify() &&
|
||||
@event.Tags.Any(tag =>
|
||||
tag.TagIdentifier == "uri" &&
|
||||
tag.TagIdentifier == EndpointTagIdentifier &&
|
||||
tag.Data.Any(s => Uri.IsWellFormedUriString(s, UriKind.Absolute))) &&
|
||||
@event.Tags.Any(tag =>
|
||||
tag.TagIdentifier == "network" && tag.Data.FirstOrDefault() == network)
|
||||
tag.TagIdentifier == TypeTagIdentifier &&
|
||||
tag.Data.FirstOrDefault() == TypeTagValue) &&
|
||||
@event.Tags.Any(tag =>
|
||||
tag.TagIdentifier == NetworkTagIdentifier && tag.Data.FirstOrDefault() == network)
|
||||
).Select(@event => new DiscoveredCoordinator()
|
||||
{
|
||||
Description = @event.Content,
|
||||
Name = @event.PublicKey,
|
||||
Uri = new Uri(@event.GetTaggedData("uri")
|
||||
Uri = new Uri(@event.GetTaggedData("endpoint")
|
||||
.First(s => Uri.IsWellFormedUriString(s, UriKind.Absolute)))
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
@@ -172,21 +172,13 @@ public class Smartifier
|
||||
|
||||
private void CoinPropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
if (sender is SmartCoin smartCoin)
|
||||
if (sender is SmartCoin smartCoin && e.PropertyName == nameof(SmartCoin.CoinJoinInProgress))
|
||||
{
|
||||
if (e.PropertyName == nameof(SmartCoin.CoinJoinInProgress))
|
||||
if (_utxoLocker is not null)
|
||||
{
|
||||
// _logger.LogInformation($"{smartCoin.Outpoint}.CoinJoinInProgress = {smartCoin.CoinJoinInProgress}");
|
||||
if (_utxoLocker is not null)
|
||||
{
|
||||
_ = (smartCoin.CoinJoinInProgress
|
||||
? _utxoLocker.TryLock(smartCoin.Outpoint)
|
||||
: _utxoLocker.TryUnlock(smartCoin.Outpoint)).ContinueWith(task =>
|
||||
{
|
||||
// _logger.LogInformation(
|
||||
// $"{(task.Result ? "Success" : "Fail")}: {(smartCoin.CoinJoinInProgress ? "" : "un")}locking coin for coinjoin: {smartCoin.Outpoint} ");
|
||||
});
|
||||
}
|
||||
_ = (smartCoin.CoinJoinInProgress
|
||||
? _utxoLocker.TryLock(smartCoin.Outpoint)
|
||||
: _utxoLocker.TryUnlock(smartCoin.Outpoint));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<td>
|
||||
@if (string.IsNullOrEmpty(coin.PayoutId))
|
||||
{
|
||||
@coin.AnonymitySet
|
||||
@coin.AnonymitySet.ToString("0.##")
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -73,10 +73,10 @@
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<span class="">@cjData.CoinsIn.Length (@cjData.CoinsIn.Sum(coin => coin.Amount) BTC) (@cjInWeightedAverage anonset wavg)</span>
|
||||
<span class="">@cjData.CoinsIn.Length (@cjData.CoinsIn.Sum(coin => coin.Amount) BTC) (@cjInWeightedAverage.ToString("0.##") anonset wavg)</span>
|
||||
</td>
|
||||
<td>
|
||||
<span class="">@cjData.CoinsOut.Length (@cjData.CoinsOut.Sum(coin => coin.Amount) BTC) (@cjOutWeightedAverage anonset wavg)</span>
|
||||
<span class="">@cjData.CoinsOut.Length (@cjData.CoinsOut.Sum(coin => coin.Amount) BTC) (@cjOutWeightedAverage.ToString("0.##") anonset wavg)</span>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
@@ -267,7 +267,8 @@
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@coin.AnonymitySet
|
||||
//print to 2 decimal places with no rounding
|
||||
@coin.AnonymitySet.ToString("0.##")
|
||||
</td>
|
||||
<td>
|
||||
@coin.Amount.ToDecimal(MoneyUnit.BTC) BTC
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
@using BTCPayServer
|
||||
@using BTCPayServer.Common
|
||||
@model WabisabiStoreController.SpendViewModel
|
||||
@inject ContentSecurityPolicies contentSecurityPolicies
|
||||
@inject IScopeProvider _scopeProvider
|
||||
@inject WalletProvider WalletProvider
|
||||
@{
|
||||
@@ -15,9 +14,6 @@
|
||||
Layout = "../Shared/_NavLayout.cshtml";
|
||||
ViewData["NavPartialName"] = "../UIStores/_Nav";
|
||||
ViewData.SetActivePage("Plugins", "BTCPayServer.Views.Stores.StoreNavPages", "Spend", storeId);
|
||||
var nonce = RandomUtils.GetUInt256().ToString().Substring(0, 32);
|
||||
contentSecurityPolicies.Add("script-src", $"'nonce-{nonce}'");
|
||||
contentSecurityPolicies.AllowUnsafeHashes();
|
||||
var wallet = (BTCPayWallet) await WalletProvider.GetWalletAsync(storeId);
|
||||
var coins = await wallet.GetAllCoins();
|
||||
}
|
||||
@@ -56,7 +52,7 @@
|
||||
<partial name="_ValidationScriptsPartial" />
|
||||
}
|
||||
|
||||
<script type="text/javascript" nonce="@nonce">
|
||||
<script type="text/javascript" >
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
});
|
||||
|
||||
@@ -1,66 +1,36 @@
|
||||
@using BTCPayServer.Plugins.Wabisabi
|
||||
@using BTCPayServer.Abstractions.Extensions
|
||||
@using BTCPayServer.Abstractions.Contracts
|
||||
@using BTCPayServer.Security
|
||||
@using NBitcoin
|
||||
@using System.Security.Claims
|
||||
@using BTCPayServer
|
||||
@using BTCPayServer.Client
|
||||
@using BTCPayServer.Common
|
||||
@using BTCPayServer.Services.Stores
|
||||
@using Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
@using WalletWasabi.Backend.Controllers
|
||||
@model BTCPayServer.Plugins.Wabisabi.WabisabiStoreSettings
|
||||
@inject ContentSecurityPolicies contentSecurityPolicies
|
||||
@inject WabisabiCoordinatorClientInstanceManager WabisabiCoordinatorClientInstanceManager
|
||||
@inject IScopeProvider _scopeProvider
|
||||
@inject IExplorerClientProvider ExplorerClientProvider;
|
||||
@inject IBTCPayServerClientFactory ClientFactory
|
||||
@inject StoreRepository StoreRepository
|
||||
@inject WalletProvider WalletProvider
|
||||
@inject BTCPayNetworkProvider BtcPayNetworkProvider
|
||||
@{
|
||||
var storeId = _scopeProvider.GetCurrentStoreId();
|
||||
Layout = "../Shared/_NavLayout.cshtml";
|
||||
ViewData["NavPartialName"] = "../UIStores/_Nav";
|
||||
ViewData.SetActivePage("Plugins", "BTCPayServer.Views.Stores.StoreNavPages", "Wabisabi coinjoin support", storeId);
|
||||
var nonce = RandomUtils.GetUInt256().ToString().Substring(0, 32);
|
||||
contentSecurityPolicies.Add("script-src", $"'nonce-{nonce}'");
|
||||
contentSecurityPolicies.AllowUnsafeHashes();
|
||||
var explorerClient = ExplorerClientProvider.GetExplorerClient("BTC");
|
||||
var userid = Context.User.Claims.Single(claim => claim.Type == ClaimTypes.NameIdentifier).Value;
|
||||
var anyEnabled = Model.Settings.Any(settings => settings.Enabled);
|
||||
var Client = await ClientFactory.Create(userid, storeId);
|
||||
ScriptPubKeyType? scriptType = null;
|
||||
try
|
||||
{
|
||||
var pm = await Client.GetStoreOnChainPaymentMethod(storeId, "BTC");
|
||||
scriptType = explorerClient.Network.DerivationStrategyFactory.Parse(pm.DerivationScheme).ScriptPubKeyType();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
Client = await ClientFactory.Create(userid);
|
||||
var stores = (await Client.GetStores())
|
||||
.Where(data => data.Id != storeId)
|
||||
.ToDictionary(s => s.Id, async s =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var sclient = await ClientFactory.Create(userid, s.Id, storeId);
|
||||
var pm = await sclient.GetStoreOnChainPaymentMethod(s.Id, "BTC");
|
||||
if (explorerClient.Network.DerivationStrategyFactory.Parse(pm.DerivationScheme).ScriptPubKeyType() != scriptType)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return s.Name;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
});
|
||||
await Task.WhenAll(stores.Values);
|
||||
ScriptPubKeyType? scriptType;
|
||||
|
||||
var stores = (await StoreRepository.GetStoresByUserId(userid))
|
||||
.ToDictionary(s => s.Id, s => (s, s.GetDerivationSchemeSettings(BtcPayNetworkProvider, "BTC")));
|
||||
|
||||
stores.TryGetValue(storeId, out var thisStore);
|
||||
scriptType = thisStore.Item2?.AccountDerivation.ScriptPubKeyType();
|
||||
var selectStores =
|
||||
stores.Where(pair => pair.Value.Result is not null)
|
||||
.Select(pair => new SelectListItem(pair.Value.Result, pair.Key, Model.MixToOtherWallet == pair.Key)).Prepend(new SelectListItem("None", ""));
|
||||
stores.Where(pair => pair.Key != storeId && pair.Value.Item2 is not null && pair.Value.Item2?.AccountDerivation.ScriptPubKeyType() == scriptType)
|
||||
.Select(pair => new SelectListItem(pair.Value.s.StoreName, pair.Key, Model.MixToOtherWallet == pair.Key)).Prepend(new SelectListItem("None", ""));
|
||||
}
|
||||
|
||||
<div class="row">
|
||||
@@ -73,6 +43,8 @@
|
||||
</div>
|
||||
<form method="post">
|
||||
@{
|
||||
|
||||
|
||||
var wallet = await WalletProvider.GetWalletAsync(storeId);
|
||||
if (wallet is BTCPayWallet btcPayWallet)
|
||||
{
|
||||
@@ -371,7 +343,7 @@
|
||||
<partial name="_ValidationScriptsPartial"/>
|
||||
}
|
||||
|
||||
<script type="text/javascript" nonce="@nonce">
|
||||
<script type="text/javascript" >
|
||||
|
||||
function handlePlebModeChange(evt){
|
||||
const isPlebMode = evt.target.value === "true";
|
||||
|
||||
@@ -195,7 +195,7 @@ public class WabisabiCoordinatorClientInstance
|
||||
switch (e)
|
||||
{
|
||||
case CoinJoinStatusEventArgs coinJoinStatusEventArgs:
|
||||
_logger.LogInformation(coinJoinStatusEventArgs.CoinJoinProgressEventArgs.GetType().ToString() + " :" +
|
||||
_logger.LogTrace(coinJoinStatusEventArgs.CoinJoinProgressEventArgs.GetType() + " :" +
|
||||
e.Wallet.WalletName);
|
||||
break;
|
||||
case CompletedEventArgs completedEventArgs:
|
||||
@@ -222,13 +222,11 @@ public class WabisabiCoordinatorClientInstance
|
||||
});
|
||||
break;
|
||||
}
|
||||
_logger.LogInformation("Coinjoin complete! :" +
|
||||
e.Wallet.WalletName);
|
||||
_logger.LogTrace("Coinjoin complete! :" + e.Wallet.WalletName);
|
||||
break;
|
||||
case LoadedEventArgs loadedEventArgs:
|
||||
var stopWhenAllMixed = !((BTCPayWallet)loadedEventArgs.Wallet).BatchPayments;
|
||||
_ = CoinJoinManager.StartAsync(loadedEventArgs.Wallet, stopWhenAllMixed, false, CancellationToken.None);
|
||||
_logger.LogInformation( "Loaded wallet :" + e.Wallet.WalletName + $"stopWhenAllMixed: {stopWhenAllMixed}");
|
||||
break;
|
||||
case StartErrorEventArgs errorArgs:
|
||||
_logger.LogInformation("Could not start wallet for coinjoin:" + errorArgs.Error.ToString() + " :" + e.Wallet.WalletName);
|
||||
@@ -237,7 +235,7 @@ public class WabisabiCoordinatorClientInstance
|
||||
_logger.LogInformation("Stopped wallet for coinjoin: " + stoppedEventArgs.Reason + " :" + e.Wallet.WalletName);
|
||||
break;
|
||||
default:
|
||||
_logger.LogInformation(e.GetType() + " :" + e.Wallet.WalletName);
|
||||
_logger.LogTrace(e.GetType() + " :" + e.Wallet.WalletName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ public class WabisabiPlugin : BaseBTCPayServerPlugin
|
||||
"onchain-wallet-send"));
|
||||
|
||||
// applicationBuilder.AddSingleton<IPayoutProcessorFactory, WabisabiPayoutProcessor>();
|
||||
Logger.SetMinimumLevel(LogLevel.Info);
|
||||
Logger.SetMinimumLevel(LogLevel.Warning);
|
||||
Logger.SetModes(LogMode.DotNetLoggers);
|
||||
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using NBitcoin;
|
||||
using NBitcoin.Payment;
|
||||
using NBitcoin.Secp256k1;
|
||||
@@ -45,8 +46,8 @@ namespace BTCPayServer.Plugins.Wabisabi
|
||||
private readonly IExplorerClientProvider _explorerClientProvider;
|
||||
private readonly WabisabiCoordinatorService _wabisabiCoordinatorService;
|
||||
private readonly IAuthorizationService _authorizationService;
|
||||
private readonly UserManager<ApplicationUser> _userManager;
|
||||
private readonly WabisabiCoordinatorClientInstanceManager _instanceManager;
|
||||
private readonly Socks5HttpClientHandler _socks5HttpClientHandler;
|
||||
|
||||
public WabisabiStoreController(WabisabiService WabisabiService, WalletProvider walletProvider,
|
||||
IBTCPayServerClientFactory btcPayServerClientFactory,
|
||||
@@ -54,7 +55,7 @@ namespace BTCPayServer.Plugins.Wabisabi
|
||||
WabisabiCoordinatorService wabisabiCoordinatorService,
|
||||
WabisabiCoordinatorClientInstanceManager instanceManager,
|
||||
IAuthorizationService authorizationService,
|
||||
UserManager<ApplicationUser> userManager)
|
||||
IServiceProvider serviceProvider)
|
||||
{
|
||||
_WabisabiService = WabisabiService;
|
||||
_walletProvider = walletProvider;
|
||||
@@ -62,8 +63,8 @@ namespace BTCPayServer.Plugins.Wabisabi
|
||||
_explorerClientProvider = explorerClientProvider;
|
||||
_wabisabiCoordinatorService = wabisabiCoordinatorService;
|
||||
_authorizationService = authorizationService;
|
||||
_userManager = userManager;
|
||||
_instanceManager = instanceManager;
|
||||
_socks5HttpClientHandler = serviceProvider.GetRequiredService<Socks5HttpClientHandler>();
|
||||
}
|
||||
|
||||
[HttpGet("")]
|
||||
@@ -118,7 +119,7 @@ var network = _explorerClientProvider.GetExplorerClient("BTC").Network.NBitcoinN
|
||||
new Uri($"https://{Guid.NewGuid()}.com"), "fake regtest coord test"));
|
||||
}
|
||||
|
||||
await Nostr.Publish(relayUri, evts.ToArray(), CancellationToken.None);
|
||||
await Nostr.Publish(relayUri, evts.ToArray(),_socks5HttpClientHandler ,CancellationToken.None);
|
||||
}
|
||||
|
||||
ViewBag.DiscoveredCoordinators = await Nostr.Discover(relayUri,
|
||||
|
||||
@@ -3,13 +3,10 @@ using System.Collections.Immutable;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using NBitcoin;
|
||||
using WalletWasabi.Backend.Models.Responses;
|
||||
using WalletWasabi.Bases;
|
||||
using WalletWasabi.WabiSabi.Backend.PostRequests;
|
||||
using WalletWasabi.WabiSabi.Client;
|
||||
using WalletWasabi.WabiSabi.Models;
|
||||
using WalletWasabi.WebClients.Wasabi;
|
||||
|
||||
namespace BTCPayServer.Plugins.Wabisabi;
|
||||
|
||||
@@ -40,7 +37,7 @@ public class WasabiCoordinatorStatusFetcher : PeriodicRunner, IWasabiBackendStat
|
||||
catch (Exception e)
|
||||
{
|
||||
Connected = false;
|
||||
_logger.LogError(e, "Could not connect to the coordinator ");
|
||||
_logger.LogError(e, "Could not connect to the coordinator");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
BIN
Plugins/BTCPayServer.Plugins.Wabisabi/docs/scientist_mode.png
Normal file
BIN
Plugins/BTCPayServer.Plugins.Wabisabi/docs/scientist_mode.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 65 KiB |
@@ -39,12 +39,27 @@ We realize this is a complex selection and are working on an easier UI to help w
|
||||
But the best way to spend privately is to use our unique **payment batching feature**, by utilizing BTCPay Server's [Payout](docs/https://docs.btcpayserver.org/Payouts/) system. Simply set the destination and amount and click on "Schedule transaction", and the payment will be embedded directly inside the next coinjoin that can fulfill it.
|
||||

|
||||
|
||||
## Pleb mode vs Scientist mode
|
||||
|
||||
Pleb mode comes with a curated set of configurations aimed to get you off the ground with coinjoining. Scientist mode is for those who want to experiment with different configurations and fine tune their coinjoin experience.
|
||||
|
||||
Scientist mode allows you to configure the following:
|
||||
* Anonscore target: What level of privacy you want to achieve. The higher the number, the more privacy you will gain, but the longer (and more expensive due to mining fees) it will take to achieve it. The pleb mode default is 5.
|
||||
* Coinsolidations: When this is turned on, the plugin will attempt to add many coins in comparison to usual. The maximum number of coins that can be added by this plugin is a random number computed for each round between 10 and 30. When coinsolidation mode is on, the likelihood to keep adding coins to the max number is probabilistic change of 90%, else it is current number of coins divided by the max number of coins. The pleb mode default is off.
|
||||
* Batched payments: When this is turned on, the plugin will attempt to batch BTC on-chain Payouts that are in the `AwaitingPayment` state. Please note that if the coordinator you are connected to does not allow creating outputs of the payout's address format ( such as a non segwit or taproot address), these payments will not be processed. The pleb mode default is on.
|
||||
* Cross mixing: Cross mixing allows you to mix your coins across multiple coordinators in parallel, bringing you the privacy benefits of multiple coordinator liquidity pools. The default option is `When Free` (pleb mode default), which means it will only remix coins on different coordinators if they are below the free threshold and will not be charged a coordinator fee. The other option is `Always`, which will mix coins across coordinators regardless of the fee. The last option is `Never`, which will not mix coins across coordinators.
|
||||
* Continuous coinjoins: When this is turned on, the plugin will attempt to join coinjoins even if all your coins are private. The chance to join is a random chance as defined by the value divided by 100 and then as a percentage. This means that if you enter `100`, there is a 1% chance of coinjoining every round. The pleb mode default is 0.
|
||||
* Send to other wallet: If you have other stores configured with an onchain wallet, with the same address format type, you can choose to send your coinjoin outputs to that wallet. This is useful if you want to keep your privacy gains separate from your main wallet, and can even send them directly to a hardware wallet! The pleb mode default is off.
|
||||
* Label coin selection: You are able to specify which labels will allow or disallow coins from joining coinjoins. If you exclude labels A,B, and C, then coins with those labels will not be used in coinjoins. If you include labels D, E, and F, then only coins with either of those labels will be used in coinjoins.
|
||||
|
||||

|
||||
|
||||
## Additional Coordinators
|
||||
|
||||
We realize that the weakest link in these coinjoin protocols is the centralized coordinator aspect, and so have opted to support multiple coordinators, in parallel, from the get-go. You can discover additional coordinators over Nostr.
|
||||
We realize that the weakest link in these coinjoin protocols is the centralized coordinator aspect, and so have opted to support multiple coordinators, in parallel, from the get-go. You can discover additional coordinators over Nostr, or you can add a coordinator manually by using the link at the bottom.
|
||||

|
||||
|
||||
Please be cautious as some coordinators may be malicious in nature. Once a coordinator has been added and a coinjoin round has been discovered, you can click on "Coordinator Config" to see what their fees and round requirements are set to.
|
||||
Please be cautious as some coordinators may be malicious in nature. Once a coordinator has been added and a coinjoin round has been discovered, you can click on "Coordinator Config" to see what their fees and round requirements are set to, but be aware that a coordinator can change these at will. Additional safeguards will be implemented soon.
|
||||
|
||||

|
||||
|
||||
@@ -57,7 +72,27 @@ In the spirit of "be the change you want to see in the world", this plugin ships
|
||||
|
||||

|
||||
|
||||
By default, the coordinator is configured to donate its generated fees to the [human rights foundation](docs/https://hrf.org/), and [opensats](docs/https://opensats.org/), along with a hardcoded plugin development fee split to continue expanding and maintaining the plugin.
|
||||
By default, the coordinator is configured to donate its generated fees to the [human rights foundation](docs/https://hrf.org/), and [opensats](docs/https://opensats.org/), along with a hardcoded plugin development fee split to continue expanding and maintaining the plugin. You can configure these using the `CoordinatorSplits` json key.
|
||||
The format is as follows:
|
||||
```
|
||||
[
|
||||
{
|
||||
"Ratio": 1.0,
|
||||
"Type": "hrf"
|
||||
},
|
||||
{
|
||||
"Ratio": 1.0,
|
||||
"Type": "opensats",
|
||||
"Value": "btcpayserver"
|
||||
}
|
||||
]
|
||||
```
|
||||
* If Type is `hrf`, the value of the fee equivalent to its ratio will be donated to the human rights foundation.
|
||||
* If Type is `opensats`, you must specify which project on its website will receive the value of the fee equivalent to its ratio. Available projects values are the file names listed [here](https://github.com/OpenSats/website/tree/master/docs/projects)
|
||||
* If Type is `btcpaybutton`, you must specify a url to a BTCPay Server instance store's [payment button](https://docs.btcpayserver.org/Apps/#payment-button). This must be enabled. The value usually looks as follows: `https://yourbtcpayserver.com/api/v1/invoices?storeId=yourstoreId¤cy=BTC`
|
||||
* If Type is `btcpaypos`, you must specify a url to a BTCPay Server instance store's [point of sale](https://docs.btcpayserver.org/Apps/#point-of-sale-app). The `Custom payments` option must be enabled. The value usually looks as follows: `https://yourbtcpayserver.com/apps/appid/pos`
|
||||
|
||||
|
||||
|
||||
One enabled, the local coordinator appears in the coinjoin configuration of your store, and, if you configures the nostr settings, published to a relay so that others may discover the coordinator.
|
||||

|
||||
|
||||
Submodule submodules/walletwasabi updated: 1123357709...85a7a0c2c9
Reference in New Issue
Block a user