From 973f46248b8c4b008121db5025ff1c5285d5e77d Mon Sep 17 00:00:00 2001 From: CryptoManiac Date: Thu, 20 Aug 2015 23:52:50 +0300 Subject: [PATCH] Multisig destination parsing example --- NovacoinTest/Program.cs | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/NovacoinTest/Program.cs b/NovacoinTest/Program.cs index 4459f0a..eca8cbd 100644 --- a/NovacoinTest/Program.cs +++ b/NovacoinTest/Program.cs @@ -138,7 +138,23 @@ namespace NovacoinTest Console.WriteLine("\tscriptDestinationTest solved: {0}", ScriptCode.Solver(scriptDestinationTest, out typeRet, out solutions)); Console.WriteLine("\tscriptDestinationTest address: {0}\n", new CKeyID(new Hash160(solutions.First())).ToString()); + Console.WriteLine("Multisig with three random keys:"); + CKeyPair k1 = new CKeyPair(), k2 = new CKeyPair(), k3 = new CKeyPair(); + + scriptDestinationTest.SetMultiSig(2, new CPubKey[] { k1.PubKey, k2.PubKey, k3.PubKey }); + Console.WriteLine("\tscriptDestinationTest solved: {0}", ScriptCode.Solver(scriptDestinationTest, out typeRet, out solutions)); + Console.WriteLine("\tscriptDestinationTest addresses: \n"); + + int nRequired = solutions.First().First(); + int nKeys = solutions.Last().First(); + + foreach (IEnumerable keyBytes in solutions.Skip(1).Take(nKeys)) + { + Console.WriteLine("\t\t{0}", (new CPubKey(keyBytes)).KeyID.ToString()); + } + + Console.WriteLine("\n\tnRequired={0}", nRequired); Console.ReadLine(); } -- 1.7.1