Show latest coinjoins
MODIFY
WalletWasabi.Backend/Program.cs
WalletWasabi.Backend/Program.cs
@@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Hosting;
using NBitcoin;
using NBitcoin.RPC;
using System;
+using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
@@ -15,6 +16,9 @@ namespace WalletWasabi.Backend
public class Program
{
private static Money TotalVolume { get; set; } = Money.Zero;
+ private static List<string> Last5CoinJoins { get; set; } = new List<string>();
+ private static object UpdateUnversionedLock { get; } = new object();
+
#pragma warning disable IDE1006 // Naming Styles
public static async Task Main(string[] args)
@@ -66,6 +70,8 @@ namespace WalletWasabi.Backend
}
UnversionedWebBuilder.UpdateMixedTextHtml(TotalVolume);
+ Last5CoinJoins = allLines.TakeLast(5).Reverse().ToList();
+ UnversionedWebBuilder.UpdateCoinJoinsHtml(Last5CoinJoins);
Global.Coordinator.CoinJoinBroadcasted += Coordinator_CoinJoinBroadcasted;
}
catch (Exception ex)
@@ -92,10 +98,20 @@ namespace WalletWasabi.Backend
private static void Coordinator_CoinJoinBroadcasted(object sender, Transaction tx)
{
try
+ {
+ lock (UpdateUnversionedLock)
{
Money volume = tx.GetIndistinguishableOutputs().Where(x => x.count > 1).Sum(x => x.count * x.value);
TotalVolume += volume;
UnversionedWebBuilder.UpdateMixedTextHtml(TotalVolume);
+
+ if (Last5CoinJoins.Count > 4)
+ {
+ Last5CoinJoins.RemoveLast();
+ }
+ Last5CoinJoins.Insert(0, tx.GetHash().ToString());
+ UnversionedWebBuilder.UpdateCoinJoinsHtml(Last5CoinJoins);
+ }
}
catch (Exception ex)
{

MODIFY
WalletWasabi.Backend/UnversionedWebBuilder.cs
WalletWasabi.Backend/UnversionedWebBuilder.cs
@@ -37,5 +37,40 @@ namespace WalletWasabi.Backend
File.WriteAllText(filePath, content);
}
+
+ public static void UpdateCoinJoinsHtml(IEnumerable<string> coinJoins)
+ {
+ var filePath = CreateFilePath("coinjoins-table.html");
+
+ var content = HtmlStartLine + "<ul class=\"text-center\" style=\"list-style: none;\">";
+ var endContent = "</ul>";
+ string smartBitPath;
+ if (Global.Config.Network == Network.TestNet)
+ {
+ smartBitPath = "https://www.testnet.smartbit.com.au/tx/";
+ }
+ else
+ {
+ smartBitPath = "https://www.smartbit.com.au/tx/";
+ }
+
+ var coinJoinsList = coinJoins.ToList();
+ for (int i = 0; i < coinJoinsList.Count; i++)
+ {
+ string cjHash = coinJoinsList[i];
+
+ if (i % 2 == 0)
+ {
+ content += $"<li style=\"background:#e6e6e6; margin:5px;\"><a href=\"{smartBitPath}{cjHash}\">{cjHash}</a></li>";
+ }
+ else
+ {
+ content += $"<li><a href=\"{smartBitPath}/{cjHash}\">{cjHash}</a></li>";
+ }
+ }
+
+ content += endContent;
+ File.WriteAllText(filePath, content);
+ }
}
}

MODIFY
WalletWasabi.Backend/wwwroot/index.html
WalletWasabi.Backend/wwwroot/index.html
<div class="row">
<div class="container">
<iframe src="unversioned/mixed-text.html" frameborder=0 width=1000 height="60"></iframe>
+ <iframe src="unversioned/coinjoins-table.html" frameborder=0 width=700 height="170"></iframe>
</div>
</div>
</div>

Show latest coinjoins