Skip to content

Commit

Permalink
Improve signature parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasDorier committed Sep 5, 2024
1 parent e6a6492 commit 18e92e7
Show file tree
Hide file tree
Showing 5 changed files with 279 additions and 155 deletions.
126 changes: 64 additions & 62 deletions NBitcoin.Tests/BIP322Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace NBitcoin.Tests
{
[Trait("UnitTest", "UnitTest")]
public class BIP322Tests
{
//from https://github.com/ACken2/bip322-js/tree/main/test && https://github.com/bitcoin/bitcoin/pull/24058/files#diff-2bd57d7fbec4bb262834d155c304ebe15d26f73fea87c75ff273df3529a15510
Expand All @@ -18,16 +19,16 @@ public async Task CanHandleLegacyBIP322Message()
var addressWrongRegtest = BitcoinAddress.Create("mipcBbFg9gMiCh81Kj8tqqdgoZub1ZJRfn", Network.RegTest);
var message = "This is an example of a signed message.";
var messageWrong = "";
var signature = "H9L5yLFjti0QTHhPyFrZCT1V/MMnBtXKmoiKDZ78NDBjERki6ZTQZdSMCtkgoNmp17By9ItJr8o7ChX0XxY91nk=";
Assert.True(await BIP322.Verify(message, address, signature));
Assert.True(await BIP322.Verify(message, addressTestnet, signature));
Assert.True(await BIP322.Verify(message, addressRegtest, signature));
Assert.False(await BIP322.Verify(messageWrong, address, signature));
Assert.False(await BIP322.Verify(messageWrong, addressTestnet, signature));
Assert.False(await BIP322.Verify(messageWrong, addressRegtest, signature));
Assert.False(await BIP322.Verify(message, addressWrong, signature));
Assert.False(await BIP322.Verify(message, addressWrongTestnet, signature));
Assert.False(await BIP322.Verify(message, addressWrongRegtest, signature));
var signature = BIP322.BIP322Signature.Parse("H9L5yLFjti0QTHhPyFrZCT1V/MMnBtXKmoiKDZ78NDBjERki6ZTQZdSMCtkgoNmp17By9ItJr8o7ChX0XxY91nk=", address.Network);

Check failure on line 22 in NBitcoin.Tests/BIP322Tests.cs

View workflow job for this annotation

GitHub Actions / 6.0 with netstandard2.0

The name 'BIP322' does not exist in the current context
Assert.True(await BIP322o.Verify(message, address, signature));

Check failure on line 23 in NBitcoin.Tests/BIP322Tests.cs

View workflow job for this annotation

GitHub Actions / 6.0 with netstandard2.0

The name 'BIP322o' does not exist in the current context
Assert.True(await BIP322o.Verify(message, addressTestnet, signature));

Check failure on line 24 in NBitcoin.Tests/BIP322Tests.cs

View workflow job for this annotation

GitHub Actions / 6.0 with netstandard2.0

The name 'BIP322o' does not exist in the current context
Assert.True(await BIP322o.Verify(message, addressRegtest, signature));

Check failure on line 25 in NBitcoin.Tests/BIP322Tests.cs

View workflow job for this annotation

GitHub Actions / 6.0 with netstandard2.0

The name 'BIP322o' does not exist in the current context
Assert.False(await BIP322o.Verify(messageWrong, address, signature));

Check failure on line 26 in NBitcoin.Tests/BIP322Tests.cs

View workflow job for this annotation

GitHub Actions / 6.0 with netstandard2.0

The name 'BIP322o' does not exist in the current context
Assert.False(await BIP322o.Verify(messageWrong, addressTestnet, signature));

Check failure on line 27 in NBitcoin.Tests/BIP322Tests.cs

View workflow job for this annotation

GitHub Actions / 6.0 with netstandard2.0

The name 'BIP322o' does not exist in the current context
Assert.False(await BIP322o.Verify(messageWrong, addressRegtest, signature));

Check failure on line 28 in NBitcoin.Tests/BIP322Tests.cs

View workflow job for this annotation

GitHub Actions / 6.0 with netstandard2.0

The name 'BIP322o' does not exist in the current context
Assert.False(await BIP322o.Verify(message, addressWrong, signature));

Check failure on line 29 in NBitcoin.Tests/BIP322Tests.cs

View workflow job for this annotation

GitHub Actions / 6.0 with netstandard2.0

The name 'BIP322o' does not exist in the current context
Assert.False(await BIP322o.Verify(message, addressWrongTestnet, signature));

Check failure on line 30 in NBitcoin.Tests/BIP322Tests.cs

View workflow job for this annotation

GitHub Actions / 6.0 with netstandard2.0

The name 'BIP322o' does not exist in the current context
Assert.False(await BIP322o.Verify(message, addressWrongRegtest, signature));

Check failure on line 31 in NBitcoin.Tests/BIP322Tests.cs

View workflow job for this annotation

GitHub Actions / 6.0 with netstandard2.0

The name 'BIP322o' does not exist in the current context


var privateKey = new BitcoinSecret("L3VFeEujGtevx9w18HD1fhRbCH67Az2dpCymeRE1SoPK6XQtaN2k", Network.Main)
Expand All @@ -36,15 +37,15 @@ public async Task CanHandleLegacyBIP322Message()
addressTestnet = privateKey.GetAddress(ScriptPubKeyType.Legacy, Network.TestNet);
addressRegtest = privateKey.GetAddress(ScriptPubKeyType.Legacy, Network.RegTest);
message = "Hello World";
signature = await BIP322.SignEncoded(address, message, BIP322.SignatureType.Legacy, privateKey);
signature = await BIP322o.SignEncoded(address, message, BIP322o.SignatureType.Legacy, privateKey);
var signatureTestnet =
await BIP322.SignEncoded(addressTestnet, message, BIP322.SignatureType.Legacy, privateKey);
await BIP322o.SignEncoded(addressTestnet, message, BIP322o.SignatureType.Legacy, privateKey);
var signatureRegtest =
await BIP322.SignEncoded(addressRegtest, message, BIP322.SignatureType.Legacy, privateKey);
await BIP322o.SignEncoded(addressRegtest, message, BIP322o.SignatureType.Legacy, privateKey);

Assert.True(await BIP322.Verify(message, address, signature));
Assert.True(await BIP322.Verify(message, addressTestnet, signatureTestnet));
Assert.True(await BIP322.Verify(message, addressRegtest, signatureRegtest));
Assert.True(await BIP322o.Verify(message, address, signature));
Assert.True(await BIP322o.Verify(message, addressTestnet, signatureTestnet));
Assert.True(await BIP322o.Verify(message, addressRegtest, signatureRegtest));
}

[Fact]
Expand All @@ -63,11 +64,11 @@ public async Task CanSign()
var addressRegtest = BitcoinAddress.Create("2N8zi3ydDsMnVkqaUUe5Xav6SZqhyqEduap", Network.RegTest);
var message = "Hello World";

var signature = await BIP322.SignEncoded(address, message, BIP322.SignatureType.Simple, privateKey);
var signature = await BIP322o.SignEncoded(address, message, BIP322o.SignatureType.Simple, privateKey);
var signatureTestnet =
await BIP322.SignEncoded(addressTestnet, message, BIP322.SignatureType.Simple, privateKeyTestnet);
await BIP322o.SignEncoded(addressTestnet, message, BIP322o.SignatureType.Simple, privateKeyTestnet);
var signatureRegtest =
await BIP322.SignEncoded(addressRegtest, message, BIP322.SignatureType.Simple, privateKeyTestnet);
await BIP322o.SignEncoded(addressRegtest, message, BIP322o.SignatureType.Simple, privateKeyTestnet);

Assert.Equal(signatureTestnet, signature);
Assert.Equal(signatureRegtest, signature);
Expand All @@ -88,37 +89,37 @@ public async Task CanSign()
var message2of3 = "This will be a 2-of-3 multisig BIP 322 signed message";
await Assert.ThrowsAsync<InvalidOperationException>(async () =>
{
await BIP322.SignEncoded(p2shAddress, message2of3, BIP322.SignatureType.Simple, redeem, null,k2, k3);
await BIP322o.SignEncoded(p2shAddress, message2of3, BIP322o.SignatureType.Simple, redeem, null,k2, k3);
});
var p2sh_signature2of3_k2_k3 =
await BIP322.SignEncoded(p2shAddress, message2of3, BIP322.SignatureType.Full, redeem, null,k2, k3);
await BIP322o.SignEncoded(p2shAddress, message2of3, BIP322o.SignatureType.Full, redeem, null,k2, k3);
var p2sh_signature2of3_k1_k3 =
await BIP322.SignEncoded(p2shAddress, message2of3, BIP322.SignatureType.Full, redeem, null,k1, k3);
await BIP322o.SignEncoded(p2shAddress, message2of3, BIP322o.SignatureType.Full, redeem, null,k1, k3);
await Assert.ThrowsAsync<InvalidOperationException>(async () =>
{
await BIP322.SignEncoded(p2shAddress, message2of3, BIP322.SignatureType.Full, redeem, null,k1);
await BIP322o.SignEncoded(p2shAddress, message2of3, BIP322o.SignatureType.Full, redeem, null,k1);
});
Assert.True(await BIP322.Verify(message2of3, p2shAddress, p2sh_signature2of3_k2_k3));
Assert.True(await BIP322.Verify(message2of3, p2shAddress, p2sh_signature2of3_k1_k3));
Assert.True(await BIP322o.Verify(message2of3, p2shAddress, p2sh_signature2of3_k2_k3));
Assert.True(await BIP322o.Verify(message2of3, p2shAddress, p2sh_signature2of3_k1_k3));

var p2wsh_signature2of3_k2_k3 =
await BIP322.SignEncoded(p2wshAddress, message2of3, BIP322.SignatureType.Simple, redeem, null,k2, k3);
await BIP322o.SignEncoded(p2wshAddress, message2of3, BIP322o.SignatureType.Simple, redeem, null,k2, k3);
var p2wsh_signature2of3_k1_k3 =
await BIP322.SignEncoded(p2wshAddress, message2of3, BIP322.SignatureType.Simple, redeem, null,k1, k3);
await BIP322o.SignEncoded(p2wshAddress, message2of3, BIP322o.SignatureType.Simple, redeem, null,k1, k3);
await Assert.ThrowsAsync<InvalidOperationException>(async () =>
{
await BIP322.SignEncoded(p2wshAddress, message2of3, BIP322.SignatureType.Simple, redeem, null,k1);
await BIP322o.SignEncoded(p2wshAddress, message2of3, BIP322o.SignatureType.Simple, redeem, null,k1);
});
Assert.True(await BIP322.Verify(message2of3, p2wshAddress, p2wsh_signature2of3_k2_k3));
Assert.True(await BIP322.Verify(message2of3, p2wshAddress, p2wsh_signature2of3_k1_k3));
Assert.True(await BIP322o.Verify(message2of3, p2wshAddress, p2wsh_signature2of3_k2_k3));
Assert.True(await BIP322o.Verify(message2of3, p2wshAddress, p2wsh_signature2of3_k1_k3));
}


[Fact]
public async Task CanVerifyBIP322Message()
{
var emptyStringHash = BIP322.CreateMessageHash("");
var helloWorldHash = BIP322.CreateMessageHash("Hello World");
var emptyStringHash = BIP322o.CreateMessageHash("");
var helloWorldHash = BIP322o.CreateMessageHash("Hello World");

Assert.Equal(new uint256("c90c269c4f8fcbe6880f72a721ddfbf1914268a794cbb21cfafee13770ae19f1"),
emptyStringHash);
Expand All @@ -133,52 +134,53 @@ public async Task CanVerifyBIP322Message()


var emptyStringToSpendTx =
BIP322.CreateToSpendTransaction(Network.Main, emptyStringHash, segwitAddress.ScriptPubKey);
BIP322o.CreateToSpendTransaction(Network.Main, emptyStringHash, segwitAddress.ScriptPubKey);
var helloWorldToSpendTx =
BIP322.CreateToSpendTransaction(Network.Main, helloWorldHash, segwitAddress.ScriptPubKey);
BIP322o.CreateToSpendTransaction(Network.Main, helloWorldHash, segwitAddress.ScriptPubKey);
Assert.Equal("c5680aa69bb8d860bf82d4e9cd3504b55dde018de765a91bb566283c545a99a7",
emptyStringToSpendTx.GetHash().ToString());
Assert.Equal("b79d196740ad5217771c1098fc4a4b51e0535c32236c71f1ea4d61a2d603352b",
helloWorldToSpendTx.GetHash().ToString());

var emptyStringToSignTx = BIP322.CreateToSignTransaction(Network.Main, emptyStringToSpendTx.GetHash());
var helloWorldToSignTx = BIP322.CreateToSignTransaction(Network.Main, helloWorldToSpendTx.GetHash());
var emptyStringToSignTx = BIP322o.CreateToSignTransaction(Network.Main, emptyStringToSpendTx.GetHash());
var helloWorldToSignTx = BIP322o.CreateToSignTransaction(Network.Main, helloWorldToSpendTx.GetHash());

Assert.Equal("1e9654e951a5ba44c8604c4de6c67fd78a27e81dcadcfe1edf638ba3aaebaed6",
emptyStringToSignTx.GetHash().ToString());
Assert.Equal("88737ae86f2077145f93cc4b153ae9a1cb8d56afa511988c149c5c8c9d93bddf",
helloWorldToSignTx.GetHash().ToString());

var simpleHelloWorldSignature = await
BIP322.SignEncoded(segwitAddress, "Hello World", BIP322.SignatureType.Simple, key);
BIP322o.SignEncoded(segwitAddress, "Hello World", BIP322o.SignatureType.Simple, key);
var simpleEmptySignature = await
BIP322.SignEncoded(segwitAddress, "", BIP322.SignatureType.Simple, key);
BIP322o.SignEncoded(segwitAddress, "", BIP322o.SignatureType.Simple, key);

var fullHelloWorldSignature = await
BIP322.SignEncoded(segwitAddress, "Hello World", BIP322.SignatureType.Full, key);
var fullEmptySignature = await BIP322.SignEncoded(segwitAddress, "", BIP322.SignatureType.Full, key);
BIP322o.SignEncoded(segwitAddress, "Hello World", BIP322o.SignatureType.Full, key);
var fullEmptySignature = await BIP322o.SignEncoded(segwitAddress, "", BIP322o.SignatureType.Full, key);


Assert.True(await BIP322.Verify("Hello World", segwitAddress, simpleHelloWorldSignature));
Assert.True(await BIP322.Verify("", segwitAddress, simpleEmptySignature));
Assert.True(await BIP322.Verify("Hello World", segwitAddress, fullHelloWorldSignature));
Assert.True(await BIP322.Verify("", segwitAddress, fullEmptySignature));
Assert.True(await BIP322o.Verify("Hello World", segwitAddress, simpleHelloWorldSignature));
Assert.True(await BIP322o.Verify("", segwitAddress, simpleEmptySignature));
Assert.True(await BIP322o.Verify("Hello World", segwitAddress, fullHelloWorldSignature));
Assert.True(await BIP322o.Verify("", segwitAddress, fullEmptySignature));

Assert.False(await BIP322.Verify("nuhuh", segwitAddress, simpleHelloWorldSignature));
Assert.False(await BIP322.Verify("nuhuh", segwitAddress, simpleEmptySignature));
Assert.False(await BIP322.Verify("nuhuh", segwitAddress, fullHelloWorldSignature));
Assert.False(await BIP322.Verify("nuhuh", segwitAddress, fullEmptySignature));
Assert.False(await BIP322o.Verify("nuhuh", segwitAddress, simpleHelloWorldSignature));
Assert.False(await BIP322o.Verify("nuhuh", segwitAddress, simpleEmptySignature));
Assert.False(await BIP322o.Verify("nuhuh", segwitAddress, fullHelloWorldSignature));
Assert.False(await BIP322o.Verify("nuhuh", segwitAddress, fullEmptySignature));


Assert.True(await BIP322.Verify("", segwitAddress,
"AkcwRAIgM2gBAQqvZX15ZiysmKmQpDrG83avLIT492QBzLnQIxYCIBaTpOaD20qRlEylyxFSeEA2ba9YOixpX8z46TSDtS40ASECx/EgAxlkQpQ9hYjgGu6EBCPMVPwVIVJqO4XCsMvViHI="));

Assert.True(await BIP322.Verify("", segwitAddress,
"AkgwRQIhAPkJ1Q4oYS0htvyuSFHLxRQpFAY56b70UvE7Dxazen0ZAiAtZfFz1S6T6I23MWI2lK/pcNTWncuyL8UL+oMdydVgzAEhAsfxIAMZZEKUPYWI4BruhAQjzFT8FSFSajuFwrDL1Yhy"));
Assert.True(await BIP322.Verify("Hello World", segwitAddress,
"AkcwRAIgZRfIY3p7/DoVTty6YZbWS71bc5Vct9p9Fia83eRmw2QCICK/ENGfwLtptFluMGs2KsqoNSk89pO7F29zJLUx9a/sASECx/EgAxlkQpQ9hYjgGu6EBCPMVPwVIVJqO4XCsMvViHI="));
Assert.True(await BIP322.Verify("Hello World", segwitAddress,
"AkgwRQIhAOzyynlqt93lOKJr+wmmxIens//zPzl9tqIOua93wO6MAiBi5n5EyAcPScOjf1lAqIUIQtr3zKNeavYabHyR8eGhowEhAsfxIAMZZEKUPYWI4BruhAQjzFT8FSFSajuFwrDL1Yhy"));
foreach (var t in new[]
{
("", "AkcwRAIgM2gBAQqvZX15ZiysmKmQpDrG83avLIT492QBzLnQIxYCIBaTpOaD20qRlEylyxFSeEA2ba9YOixpX8z46TSDtS40ASECx/EgAxlkQpQ9hYjgGu6EBCPMVPwVIVJqO4XCsMvViHI="),
("", "AkgwRQIhAPkJ1Q4oYS0htvyuSFHLxRQpFAY56b70UvE7Dxazen0ZAiAtZfFz1S6T6I23MWI2lK/pcNTWncuyL8UL+oMdydVgzAEhAsfxIAMZZEKUPYWI4BruhAQjzFT8FSFSajuFwrDL1Yhy"),
("Hello World", "AkcwRAIgZRfIY3p7/DoVTty6YZbWS71bc5Vct9p9Fia83eRmw2QCICK/ENGfwLtptFluMGs2KsqoNSk89pO7F29zJLUx9a/sASECx/EgAxlkQpQ9hYjgGu6EBCPMVPwVIVJqO4XCsMvViHI="),
("Hello World", "AkgwRQIhAOzyynlqt93lOKJr+wmmxIens//zPzl9tqIOua93wO6MAiBi5n5EyAcPScOjf1lAqIUIQtr3zKNeavYabHyR8eGhowEhAsfxIAMZZEKUPYWI4BruhAQjzFT8FSFSajuFwrDL1Yhy")
})
{
(var message, var sig) = t;
Assert.True(await BIP322o.Verify(message, segwitAddress, sig));
}

// // 2-of-3 p2sh multisig BIP322 signature (created with the buidl-python library)
// // Keys are defined as (HDRootWIF, bip322_path)
Expand All @@ -192,7 +194,7 @@ public async Task CanVerifyBIP322Message()
// "AAAAAAHNcfHaNfl8f/+ZC2gTr8aF+0KgppYjKM94egaNm/u1ZAAAAAD8AEcwRAIhAJ6hdj61vLDP+aFa30qUZQmrbBfE0kiOObYvt5nqPSxsAh9IrOKFwflfPRUcQ/5e0REkdFHVP2GGdUsMgDet+sNlAUcwRAIgH3eW/VyFDoXvCasd8qxgwj5NDVo0weXvM6qyGXLCR5YCIEwjbEV6fS6RWP6QsKOcMwvlGr1/SgdCC6pW4eH87/YgAUxpUiECKJfGy28imLcuAeNBLHCNv3NRP5jnJwFDNRXCYNY/vJ4hAv1RQtaZs7+vKqQeWl2rb/jd/gMxkEjUnjZdDGPDZkMLIQL65cH2X5O7LujjTLDL2l8Pxy0Y2UUR99u1qCfjdz7dklOuAAAAAAEAAAAAAAAAAAFqAAAAAA==",
// "This will be a p2sh 2-of-3 multisig BIP 322 signed message"),
// MessageVerificationResult::OK);
Assert.True(await BIP322.Verify("This will be a p2sh 2-of-3 multisig BIP 322 signed message",
Assert.True(await BIP322o.Verify("This will be a p2sh 2-of-3 multisig BIP 322 signed message",
BitcoinAddress.Create("3LnYoUkFrhyYP3V7rq3mhpwALz1XbCY9Uq", Network.Main),
"AAAAAAHNcfHaNfl8f/+ZC2gTr8aF+0KgppYjKM94egaNm/u1ZAAAAAD8AEcwRAIhAJ6hdj61vLDP+aFa30qUZQmrbBfE0kiOObYvt5nqPSxsAh9IrOKFwflfPRUcQ/5e0REkdFHVP2GGdUsMgDet+sNlAUcwRAIgH3eW/VyFDoXvCasd8qxgwj5NDVo0weXvM6qyGXLCR5YCIEwjbEV6fS6RWP6QsKOcMwvlGr1/SgdCC6pW4eH87/YgAUxpUiECKJfGy28imLcuAeNBLHCNv3NRP5jnJwFDNRXCYNY/vJ4hAv1RQtaZs7+vKqQeWl2rb/jd/gMxkEjUnjZdDGPDZkMLIQL65cH2X5O7LujjTLDL2l8Pxy0Y2UUR99u1qCfjdz7dklOuAAAAAAEAAAAAAAAAAAFqAAAAAA=="));

Expand All @@ -206,7 +208,7 @@ public async Task CanVerifyBIP322Message()
// "bc1qlqtuzpmazp2xmcutlwv0qvggdvem8vahkc333usey4gskug8nutsz53msw", "BQBIMEUCIQDQoXvGKLH58exuujBOta+7+GN7vi0lKwiQxzBpuNuXuAIgIE0XYQlFDOfxbegGYYzlf+tqegleAKE6SXYIa1U+uCcBRzBEAiATegywVl6GWrG9jJuPpNwtgHKyVYCX2yfuSSDRFATAaQIgTLlU6reLQsSIrQSF21z3PtUO2yAUseUWGZqRUIE7VKoBSDBFAiEAgxtpidsU0Z4u/+5RB9cyeQtoCW5NcreLJmWXZ8kXCZMCIBR1sXoEinhZE4CF9P9STGIcMvCuZjY6F5F0XTVLj9SjAWlTIQP3dyWvTZjUENWJowMWBsQrrXCUs20Gu5YF79CG5Ga0XSEDwqI5GVBOuFkFzQOGH5eTExSAj2Z/LDV/hbcvAPQdlJMhA17FuuJd+4wGuj+ZbVxEsFapTKAOwyhfw9qpch52JKxbU64=",
// "This will be a p2wsh 3-of-3 multisig BIP 322 signed message"),
// MessageVerificationResult::OK);
Assert.True(await BIP322.Verify("This will be a p2wsh 3-of-3 multisig BIP 322 signed message",
Assert.True(await BIP322o.Verify("This will be a p2wsh 3-of-3 multisig BIP 322 signed message",
BitcoinAddress.Create("bc1qlqtuzpmazp2xmcutlwv0qvggdvem8vahkc333usey4gskug8nutsz53msw", Network.Main),
"BQBIMEUCIQDQoXvGKLH58exuujBOta+7+GN7vi0lKwiQxzBpuNuXuAIgIE0XYQlFDOfxbegGYYzlf+tqegleAKE6SXYIa1U+uCcBRzBEAiATegywVl6GWrG9jJuPpNwtgHKyVYCX2yfuSSDRFATAaQIgTLlU6reLQsSIrQSF21z3PtUO2yAUseUWGZqRUIE7VKoBSDBFAiEAgxtpidsU0Z4u/+5RB9cyeQtoCW5NcreLJmWXZ8kXCZMCIBR1sXoEinhZE4CF9P9STGIcMvCuZjY6F5F0XTVLj9SjAWlTIQP3dyWvTZjUENWJowMWBsQrrXCUs20Gu5YF79CG5Ga0XSEDwqI5GVBOuFkFzQOGH5eTExSAj2Z/LDV/hbcvAPQdlJMhA17FuuJd+4wGuj+ZbVxEsFapTKAOwyhfw9qpch52JKxbU64="));

Expand All @@ -219,7 +221,7 @@ public async Task CanVerifyBIP322Message()
// "AUHd69PrJQEv+oKTfZ8l+WROBHuy9HKrbFCJu7U1iK2iiEy1vMU5EfMtjc+VSHM7aU0SDbak5IUZRVno2P5mjSafAQ==",
// "Hello World"),
// MessageVerificationResult::OK);
Assert.True(await BIP322.Verify("Hello World",
Assert.True(await BIP322o.Verify("Hello World",
BitcoinAddress.Create("bc1ppv609nr0vr25u07u95waq5lucwfm6tde4nydujnu8npg4q75mr5sxq8lt3", Network.Main),
"AUHd69PrJQEv+oKTfZ8l+WROBHuy9HKrbFCJu7U1iK2iiEy1vMU5EfMtjc+VSHM7aU0SDbak5IUZRVno2P5mjSafAQ=="));
#endif
Expand Down Expand Up @@ -254,7 +256,7 @@ public async Task CanDoProofOfFunds()

var message = "I own these coins";

var signature = await BIP322.SignEncoded(addr, message, BIP322.SignatureType.Full, null, coins, key, key2);
var signature = await BIP322o.SignEncoded(addr, message, BIP322o.SignatureType.Full, null, coins, key, key2);



Expand Down
Loading

0 comments on commit 18e92e7

Please sign in to comment.