public void TestVerifying() { var signing = new Signing(null); Assert.IsTrue(signing.ValidateSignatures( RemoveChecksum(SIXTH_ADDR), new[] { SIGNATURE1, SIGNATURE2 }, RemoveChecksum(FIRST_ADDR))); }
public void BasicMultiSigTest() { Multisig ms = new Multisig(); // First co-signer uses security level 3 and index 0 for the private key string digestOne = ms.GetDigest(TestSeed1, 3, 0); // We initiate the multisig address generation by absorbing the key digest ms.AddAddressDigest(new[] { digestOne }); // Second cosigner also uses security level 3 and index 0 for the private key string digestTwo = ms.GetDigest(TestSeed2, 3, 0); // Add the multisig by absorbing the second cosigners key digest ms.AddAddressDigest(new[] { digestTwo }); // finally we generate the multisig address itself string multiSigAddress = ms.FinalizeAddress(); Console.WriteLine("MultisigAddress = " + multiSigAddress); bool isValidMultisigAddress = ms.ValidateAddress(multiSigAddress, new[] { Converter.ToTrits(digestOne), Converter.ToTrits(digestTwo) }); Console.WriteLine("Is a valid multisig address " + isValidMultisigAddress); Assert.IsTrue(isValidMultisigAddress, "Address is not a valid multisigAddress"); List <Transfer> transfers = new List <Transfer> { new Transfer(ReceiveAddress.AddChecksum(), 999, "", TestTag) }; List <Transaction> trxs = _iotaAPI.InitiateTransfer(6, multiSigAddress.AddChecksum(), RemainderAddress, transfers, null, true); Bundle bundle = new Bundle(trxs, trxs.Count); bundle = ms.AddSignature(bundle, multiSigAddress, ms.GetKey(TestSeed1, 0, 3)); bundle = ms.AddSignature(bundle, multiSigAddress, ms.GetKey(TestSeed2, 0, 3)); Signing sgn = new Signing(new Kerl()); bool isValidSignature = sgn.ValidateSignatures(bundle, multiSigAddress); Console.WriteLine("Result of multi-signature validation is " + isValidSignature); Assert.IsTrue(isValidSignature, "MultiSignature not valid"); }