public void WalletCreation() { var wallet = new MogwaiWallet(); Assert.False(wallet.IsCreated); Assert.False(wallet.IsUnlocked); }
public static void TestWallet() { // "isvalid": true, // "address": "MQ6JnKWAiDkN2eo6c19647RBRzUecryRdP", // "scriptPubKey": "76a914b19db9a389dc6f62c2a1809ea3cdcd4c3a91c68988ac", // "ismine": true, // "iswatchonly": false, // "isscript": false, // "pubkey": "021cb06967a8ac6972165eb5535acabd91e5c1a72a679d99983e9a3ab3b90bd378", // "iscompressed": true, // "mirkey": "021cb069673db09b3ba3a9e38999d976a27a1c5e19dbaca5355be5612796ca8a78", // "mirkeyvalid": true, // "ismiraddrvalid": true, // "miraddress": "MQN7moivGfWPiwUfCX1PzfqqYN29gKsgEb" //Console.WriteLine(wallet.MnemonicWords); //MD9C1fPqFtF5Xqx66fes3Ro1GgCFSht2zC //var mogwaiKeys = wallet.GetMogwaiKeys(1001); //if (wallet.GetNewMogwaiKey(out MogwaiKeys mogwaiKeys)) //{ // Console.WriteLine(mogwaiKeys.Address); // Console.WriteLine(mogwaiKeys.HasMirrorAddress ? mogwaiKeys.MirrorAddress : "no"); //} MogwaiWallet wallet = new MogwaiWallet("1234", "ttttete.dat"); foreach (var mogwaiKey in wallet.MogwaiKeyDict.Values) { Console.WriteLine($"{mogwaiKey.Address},{mogwaiKey.MirrorAddress}"); } }
public void BurnMogs() { var wallet = new MogwaiWallet("1234", "test.dat"); MogwaiKeys mogwaiKeys0 = wallet.MogwaiKeyDict["MWG1HtzRAjZMxQDzeoFoHQbzDygGR13aWG"]; Assert.Equal("MWG1HtzRAjZMxQDzeoFoHQbzDygGR13aWG", mogwaiKeys0.Address); MogwaiKeys mogwaiKeys1 = wallet.MogwaiKeyDict["MNtnWbBjUhRvNnd9YxM2mnxeLPNkxb4Fio"]; Assert.Equal("MNtnWbBjUhRvNnd9YxM2mnxeLPNkxb4Fio", mogwaiKeys1.Address); var blockResponse0 = Blockchain.Instance.GetBalance("MWG1HtzRAjZMxQDzeoFoHQbzDygGR13aWG"); Assert.Equal(8.99999m, blockResponse0); var blockResponse1 = Blockchain.Instance.GetBalance("MNtnWbBjUhRvNnd9YxM2mnxeLPNkxb4Fio"); Assert.Equal(12.12344678m, blockResponse1); System.Collections.Generic.List <WoMWallet.Block.UnspentTx> unspentTxList = Blockchain.Instance.GetUnspent(6, 9999999, mogwaiKeys0.Address); var unspentAmount = unspentTxList.Sum(p => p.Amount); // create transaction NBitcoin.Transaction tx = mogwaiKeys0.CreateTransaction(unspentTxList, unspentAmount, new[] { mogwaiKeys1.Address }, 1.0m, 0.00001m); Assert.Equal("01000000019d0262999e5eacc32c2c6921e730d57a7e51938c2d3e22158979c72a7be318e3010000006a4730440220263c7d3955de95901f70fd66210a7ba095581e6261b3f71c1165d80583fe768b022062cd638398ba735d55dcaa17de225143997307c24e84b1a2be29bc4b7a73c61f012103007f99a5c4754d67c9fed1852ed451bec7371c1b0907b8488ee5aa6593b865c4ffffffff0200e1f505000000001976a914a477c1319360114de9f3ed88381cc4dfa9147f3288ac3000af2f000000001976a914f5440a1dd1ada4c5b4160b8c754f9148eb4a505388ac00000000", tx.ToHex()); //var blockResponse = Blockchain.Instance.SendRawTransaction(tx.ToHex()); //Assert.Equal("", blockResponse); }
public void WalletTestPersist() { var wallet = new MogwaiWallet("1234", "test.dat"); MogwaiKeys mogwaiKeys = wallet.MogwaiKeyDict["MWG1HtzRAjZMxQDzeoFoHQbzDygGR13aWG"]; Assert.Equal("MWG1HtzRAjZMxQDzeoFoHQbzDygGR13aWG", mogwaiKeys.Address); Assert.True(mogwaiKeys.HasMirrorAddress); Assert.Equal("MLTNLAojhmBHF3BMzG3RmzoQ1bnbnxxdeD", mogwaiKeys.MirrorAddress); }
public void WalletDeposit() { var wallet = new MogwaiWallet("test.dat"); Assert.Null(wallet.Deposit); wallet.Unlock("1234"); Assert.NotNull(wallet.Deposit); Assert.Equal("MBAdzUJU1zyUJLfiUDuvU8zWjenxzi7ZF6", wallet.Deposit.Address); }
public void WalletUnlock() { var wallet = new MogwaiWallet("test.dat"); Assert.True(wallet.IsCreated); Assert.False(wallet.IsUnlocked); wallet.Unlock("1234"); Assert.True(wallet.IsUnlocked); }
public static void TestRawTransaction() { MogwaiWallet wallet = new MogwaiWallet("1234", "test.dat"); var mogwaiKeys0 = wallet.MogwaiKeyDict["MWG1HtzRAjZMxQDzeoFoHQbzDygGR13aWG"]; var mogwaiKeys1 = wallet.MogwaiKeyDict["MNtnWbBjUhRvNnd9YxM2mnxeLPNkxb4Fio"]; var blockResponse0 = Blockchain.Instance.GetBalance("MWG1HtzRAjZMxQDzeoFoHQbzDygGR13aWG"); var blockResponse1 = Blockchain.Instance.GetBalance("MNtnWbBjUhRvNnd9YxM2mnxeLPNkxb4Fio"); var unspentTxList = Blockchain.Instance.GetUnspent(6, 9999999, mogwaiKeys0.Address); var unspentAmount = unspentTxList.Sum(p => p.Amount); // create transaction Transaction tx = mogwaiKeys0.CreateTransaction(unspentTxList, unspentAmount, new string[] { mogwaiKeys1.Address }, 1.0m, 0.00001m); //var blockResponse = Blockchain.Instance.SendRawTransaction(tx.ToHex()); //Console.WriteLine(blockResponse); //Console.ReadKey(); }