Use proof of ownerships instead of compact signatures (server part)
MODIFY
WalletWasabi.Tests/Helpers/WabiSabiFactory.cs
WalletWasabi.Tests/Helpers/WabiSabiFactory.cs
@@ -25,19 +25,13 @@ namespace WalletWasabi.Tests.Helpers
public static InputRoundSignaturePair CreateInputRoundSignaturePair(Key? key = null, uint256? roundHash = null)
{
var rh = roundHash ?? BitcoinFactory.CreateUint256();
- if (key is null)
- {
- using Key k = new();
- return new InputRoundSignaturePair(
- BitcoinFactory.CreateOutPoint(),
- k.SignCompact(rh));
- }
- else
- {
+ var outpoint = BitcoinFactory.CreateOutPoint();
+ var coinJoinInputCommitmentData = new CoinJoinInputCommitmentData("CoinJoinCoordinatorIdentifier", rh);
+
+ var signingKey = key ?? new();
return new InputRoundSignaturePair(
- BitcoinFactory.CreateOutPoint(),
- key.SignCompact(rh));
- }
+ outpoint,
+ OwnershipProof.GenerateCoinJoinInputProof(signingKey, coinJoinInputCommitmentData).ToBytes());
}
public static InputRoundSignaturePair[] CreateInputRoundSignaturePairs(int count, uint256? roundHash = null)

MODIFY
WalletWasabi/Crypto/OwnershipProof.cs
WalletWasabi/Crypto/OwnershipProof.cs
@@ -36,8 +36,8 @@ namespace WalletWasabi.Crypto
private byte[] coordinatorIdentifier;
private byte[] roundIdentifier;
- public CoinJoinInputCommitmentData(string coordinatorIdentifier, Guid roundIdentifier)
- : this (Encoding.ASCII.GetBytes(coordinatorIdentifier), roundIdentifier.ToByteArray())
+ public CoinJoinInputCommitmentData(string coordinatorIdentifier, uint256 roundIdentifier)
+ : this (Encoding.ASCII.GetBytes(coordinatorIdentifier), roundIdentifier.ToBytes())
{
}

MODIFY
WalletWasabi/WabiSabi/Backend/PostRequests/InputRegistrationHandler.cs
WalletWasabi/WabiSabi/Backend/PostRequests/InputRegistrationHandler.cs
@@ -5,6 +5,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WalletWasabi.BitcoinCore.Rpc;
+using WalletWasabi.Crypto;
using WalletWasabi.Logging;
using WalletWasabi.WabiSabi.Backend.Banning;
using WalletWasabi.WabiSabi.Backend.Models;
@@ -95,8 +96,9 @@ namespace WalletWasabi.WabiSabi.Backend.PostRequests
{
var coin = coinRoundSignaturePair.Key;
var signature = coinRoundSignaturePair.Value;
- var address = (BitcoinWitPubKeyAddress)coin.TxOut.ScriptPubKey.GetDestinationAddress(network);
- if (!address.VerifyMessage(round.Hash, signature))
+
+ var coinJoinInputCommitmentData = new CoinJoinInputCommitmentData("CoinJoinCoordinatorIdentifier", round.Hash);
+ if (!OwnershipProof.VerifyCoinJoinInputProof(signature, coin.TxOut.ScriptPubKey, coinJoinInputCommitmentData))
{
throw new WabiSabiProtocolException(WabiSabiProtocolErrorCode.WrongRoundSignature);
}

Use proof of ownerships instead of compact signatures (server part)