Example #1
0
        public static bool LockUnspent()
        {
            Console.WriteLine("Starting LockUnspent tests...");

            Bitcoind.RawTxInput[] inputs1 = new Bitcoind.RawTxInput[1];
            Bitcoind.RawTxInput   input1  = new Bitcoind.RawTxInput();
            input1.txID = "fff17832d351c12476dc3d6f902fd2e0666992135ffe49ac343d9db15dfcddf7";
            input1.vout = "0";
            inputs1 [0] = input1;

            Bitcoind.RawTxInput[] inputs2 = new Bitcoind.RawTxInput[2];
            Bitcoind.RawTxInput   input2  = new Bitcoind.RawTxInput();
            input2.txID = "f7d882aea4204b2dbe2d3941c1ee280c7c34551f005f5e7ef52f4c19cfea3db8";
            input2.vout = "0";
            inputs2 [0] = input1;
            inputs2 [1] = input2;

            Console.WriteLine("LockUnspent: " + Bitcoind.LockUnspent(false));
            Console.WriteLine("LockUnspent: " + Bitcoind.LockUnspent(true));
            Console.WriteLine("LockUnspent: " + Bitcoind.LockUnspent(false, inputs1));
            Console.WriteLine("LockUnspent: " + Bitcoind.LockUnspent(true, inputs1));
            Console.WriteLine("LockUnspent: " + Bitcoind.LockUnspent(false, inputs2));
            Console.WriteLine("LockUnspent: " + Bitcoind.LockUnspent(true, inputs2));

            return(true);
        }
Example #2
0
 public static bool BackupWallet()
 {
     Console.WriteLine("Starting BackupWallet tests...");
     Bitcoind.BackupWallet("C:/Test/backup.dat");
     Bitcoind.BackupWallet("C:/Test/backup.dat.ass");
     return(true);
 }
Example #3
0
        public static bool SendMany()
        {
            Console.WriteLine("Starting SendMany tests...");

            Bitcoind.PayToAddress[] outputsToCB2 = new Bitcoind.PayToAddress[1];
            Bitcoind.PayToAddress   outputToCB2  = new Bitcoind.PayToAddress();
            outputToCB2.address = "msvqm9b8qV3cFLGXDifiEpPunZunwKwDaZ";
            outputToCB2.amount  = "0.1";
            outputsToCB2 [0]    = outputToCB2;

            Bitcoind.PayToAddress[] outputsToCust2 = new Bitcoind.PayToAddress[1];
            Bitcoind.PayToAddress   outputToCust2  = new Bitcoind.PayToAddress();
            outputToCust2.address = "n1dPhwHRC8jNwUEJD7jThf4RkFVvcYLqmz";
            outputToCust2.amount  = "0.1";
            outputsToCust2 [0]    = outputToCust2;

            Bitcoind.PayToAddress[] outputs2 = new Bitcoind.PayToAddress[2];
            outputs2 [0] = outputToCB2;
            outputs2 [1] = outputToCust2;

            Console.WriteLine("SendMany: " + Bitcoind.SendMany("cust2", outputsToCB2));
            Console.WriteLine("SendMany: " + Bitcoind.SendMany("cb2", outputsToCust2));
            Console.WriteLine("SendMany: " + Bitcoind.SendMany("cust2", outputs2, "3"));
            Console.WriteLine("SendMany: " + Bitcoind.SendMany("cb2", outputs2, "3", "refund"));

            return(true);
        }
Example #4
0
 public static bool CreateMultiSig()
 {
     Console.WriteLine("Starting CreateMultiSig tests...");
     // Note that you can use pubKeys or addresses.
     string[] pubKeys3 = { "mpNT4J4PEpTFab68QvH7tMQ8hYS4JhunFK",
                           "n3ZGGJ1Mhqq39LUaP2umiqnZu7GVpqVh1r",
                           "mtMS6D2y4wbEiKZa6qJuXbibnQ26HdtY7J" };
     Bitcoind.CreateMultiSigResult multiSig1 = Bitcoind.CreateMultiSig(2, pubKeys3);
     if (multiSig1.address.Length != 35)
     {
         return(false);
     }
     if (multiSig1.redeemScript.Length < 40)
     {
         return(false);
     }
     Bitcoind.CreateMultiSigResult multiSig2 = Bitcoind.CreateMultiSig(3, pubKeys3);
     if (multiSig2.address.Length != 35)
     {
         return(false);
     }
     if (multiSig2.redeemScript.Length < 40)
     {
         return(false);
     }
     return(true);
 }
Example #5
0
        public static bool GetGenerate()
        {
            Console.WriteLine("Starting GetGenerate tests...");

            Console.WriteLine("GetGenerate: " + Bitcoind.GetGenerate());

            return(true);
        }
Example #6
0
        public static bool GetDifficulty()
        {
            Console.WriteLine("Starting GetDifficulty tests...");

            Console.WriteLine("Difficulty: " + Bitcoind.GetDifficulty());

            return(true);
        }
Example #7
0
        public static bool GetConnectionCount()
        {
            Console.WriteLine("Starting GetConnectionCount tests...");

            Console.WriteLine("ConnectionCount: " + Bitcoind.GetConnectionCount());

            return(true);
        }
Example #8
0
        public static bool GetBlockHash()
        {
            Console.WriteLine("Starting GetBlockHash tests...");

            Console.WriteLine("GetBlockHash: " + Bitcoind.GetBlockHash("0"));

            return(true);
        }
Example #9
0
        public static bool GetBlock()
        {
            Console.WriteLine("Starting GetBlock tests...");

            Console.WriteLine("GetBlock: " + Bitcoind.GetBlock("00008a3534145aad5d0dfd04cb0da07e8d87eeb4dfc7f54680a05f0f75094922"));

            return(true);
        }
Example #10
0
        public static bool GetHashesPerSec()
        {
            Console.WriteLine("Starting GetHashesPerSec tests...");

            Console.WriteLine("GetHashesPerSec: " + Bitcoind.GetHashesPerSec());

            return(true);
        }
Example #11
0
        public static bool GetRawChangeAddress()
        {
            Console.WriteLine("Starting GetRawChangeAddress tests...");

            Console.WriteLine("GetRawChangeAddress: " + Bitcoind.GetRawChangeAddress("cs"));

            return(true);
        }
Example #12
0
        public static bool ListLockUnspent()
        {
            Console.WriteLine("Starting ListLockUnspent tests...");

            Console.WriteLine("ListLockUnspent: " + Bitcoind.ListLockUnspent());

            return(true);
        }
Example #13
0
        public static bool ListAddressGroupings()
        {
            Console.WriteLine("Starting ListAddressGroupings tests...");

            Console.WriteLine("ListAddressGroupings: " + Bitcoind.ListAddressGroupings());

            return(true);
        }
Example #14
0
        public static bool KeyPoolRefill()
        {
            Console.WriteLine("Starting KeyPoolRefill tests...");

            Bitcoind.KeyPoolRefill();

            return(true);
        }
Example #15
0
        public static bool GetReceivedByAccount()
        {
            Console.WriteLine("Starting GetReceivedByAccount tests...");

            Console.WriteLine("GetReceivedByAccount: " + Bitcoind.GetReceivedByAccount("cs"));

            return(true);
        }
Example #16
0
        public static bool GetTxOutSetInfo()
        {
            Console.WriteLine("Starting GetTxOutSetInfo tests...");

            Console.WriteLine("GetTxOutSetInfo: " + Bitcoind.GetTxOutSetInfo());

            return(true);
        }
Example #17
0
        public static bool GetRawMemPool()
        {
            Console.WriteLine("Starting GetRawMemPool tests...");

            Console.WriteLine("GetRawMemPool: " + Bitcoind.GetRawMemPool());

            return(true);
        }
Example #18
0
        public static bool CreateRawTransaction()
        {
            Console.WriteLine("Starting CreateRawTransaction tests...");

            // NOTE: scriptPubKey and redeemScript are not being tested in this case.

            Bitcoind.RawTxInput[] inputs1 = new Bitcoind.RawTxInput[1];
            Bitcoind.RawTxInput   input1  = new Bitcoind.RawTxInput();
            input1.txID = "fff17832d351c12476dc3d6f902fd2e0666992135ffe49ac343d9db15dfcddf7";
            input1.vout = "0";
            inputs1 [0] = input1;

            Bitcoind.RawTxInput[] inputs2 = new Bitcoind.RawTxInput[2];
            Bitcoind.RawTxInput   input2  = new Bitcoind.RawTxInput();
            input2.txID = "e69899e5bd2020b99c67b258e5d56ca5c091c9b065f412381ce44a9e438721c1";
            input2.vout = "1";
            inputs2 [0] = input1;
            inputs2 [1] = input2;

            Bitcoind.PayToAddress[] outputs1 = new Bitcoind.PayToAddress[1];
            Bitcoind.PayToAddress   output1  = new Bitcoind.PayToAddress();
            output1.address = "mjkTKcq27UHMoydoQPrq74fCgyBZ5DCAwf";
            output1.amount  = "1.5";
            outputs1 [0]    = output1;

            Bitcoind.PayToAddress[] outputs2 = new Bitcoind.PayToAddress[2];
            Bitcoind.PayToAddress   output2  = new Bitcoind.PayToAddress();
            output2.address = "miKXJCSnAYyMNPX1emfd7QGXdCFTJRm9Bi";
            output2.amount  = "10.123456";
            outputs2 [0]    = output1;
            outputs2 [1]    = output2;

            // Test 1 tx with 1 output
            _rawTx1To1 = Bitcoind.CreateRawTransaction(inputs1, outputs1);
            if (_rawTx1To1 == null || _rawTx1To1.Length == 0)
            {
                return(false);
            }
            // Test 1 tx with 2 output
            _rawTx1To2 = Bitcoind.CreateRawTransaction(inputs1, outputs2);
            if (_rawTx1To2 == null || _rawTx1To2.Length == 0)
            {
                return(false);
            }
            // Test 2 tx with 1 output
            _rawTx2To1 = Bitcoind.CreateRawTransaction(inputs2, outputs1);
            if (_rawTx2To1 == null || _rawTx2To1.Length == 0)
            {
                return(false);
            }
            // Test 2 tx with 2 output
            _rawTx2To2 = Bitcoind.CreateRawTransaction(inputs2, outputs2);
            if (_rawTx2To2 == null || _rawTx2To2.Length == 0)
            {
                return(false);
            }
            return(true);
        }
Example #19
0
        public static bool GetReceivedByAddress()
        {
            Console.WriteLine("Starting GetReceivedByAddress tests...");

            Console.WriteLine("GetReceivedByAddress: " + Bitcoind.GetReceivedByAddress("mhm2QuUhVaNMFcehWN5P9KiSNh1QxVunKk"));
            Console.WriteLine("GetReceivedByAddress: " + Bitcoind.GetReceivedByAddress("mhm2QuUhVaNMFcehWN5P9KiSNh1QxVunKk", "6"));

            return(true);
        }
Example #20
0
        public static bool ListAccounts()
        {
            Console.WriteLine("Starting ListAccounts tests...");

            Console.WriteLine("ListAccounts: " + Bitcoind.ListAccounts());
            Console.WriteLine("ListAccounts with 50 confirmations: " + Bitcoind.ListAccounts("50"));

            return(true);
        }
Example #21
0
        public static bool GetTxOut()
        {
            Console.WriteLine("Starting GetTxOut tests...");

            Console.WriteLine("GetTxOut: " + Bitcoind.GetTxOut("fff17832d351c12476dc3d6f902fd2e0666992135ffe49ac343d9db15dfcddf7", "0"));
            Console.WriteLine("GetTxOut: " + Bitcoind.GetTxOut("fff17832d351c12476dc3d6f902fd2e0666992135ffe49ac343d9db15dfcddf7", "0"));

            return(true);
        }
Example #22
0
        public static bool GetTransaction()
        {
            Console.WriteLine("Starting GetTransaction tests...");

            Console.WriteLine("GetTransaction: " + Bitcoind.GetTransaction("fff17832d351c12476dc3d6f902fd2e0666992135ffe49ac343d9db15dfcddf7"));
            Console.WriteLine("GetTransaction: " + Bitcoind.GetTransaction("e69899e5bd2020b99c67b258e5d56ca5c091c9b065f412381ce44a9e438721c1"));

            return(true);
        }
Example #23
0
        public static bool EncryptWallet()
        {
            Console.WriteLine("Starting DumpPrivKey tests...");

            Bitcoind.EncryptWallet(_walletPassPhrase);                              // Locks
            Bitcoind.WalletPassPhrase(_walletPassPhrase, _walletPassPhraseTimeout); // Unlocks

            return(true);
        }
Example #24
0
        public static bool GetBalance()
        {
            Console.WriteLine("Starting GetBalance tests...");

            Console.WriteLine("GetBalance: " + Bitcoind.GetBalance("cs"));
            Console.WriteLine("GetBalance: " + Bitcoind.GetBalance("cs", "6"));

            return(true);
        }
Example #25
0
        public static bool ValidateAddress()
        {
            Console.WriteLine("Starting ValidateAddress tests...");

            Console.WriteLine("ValidateAddress: " + Bitcoind.ValidateAddress("msvqm9b8qV3cFLGXDifiEpPunZunwKwDaZ"));
            Console.WriteLine("ValidateAddress: " + Bitcoind.ValidateAddress("n1dPhwHRC8jNwUEJD7jThf4RkFVvcYLqmz"));

            return(true);
        }
Example #26
0
        public static bool WalletLock()
        {
            Console.WriteLine("Starting WalletLock tests...");

            Bitcoind.WalletLock();              // relocks
            Bitcoind.WalletPassPhrase(_walletPassPhrase, _walletPassPhraseTimeout);

            return(true);
        }
Example #27
0
        public static bool SetAccount()
        {
            Console.WriteLine("Starting SetAccount tests...");

            Bitcoind.SetAccount("mmx8vJ6F4sBcBuhbEF1UAGevAMmyaSfLxx", "cs3");
            Bitcoind.SetAccount("mmx8vJ6F4sBcBuhbEF1UAGevAMmyaSfLxx", "cs2");

            return(true);
        }
Example #28
0
        public static bool ListUnspent()
        {
            Console.WriteLine("Starting ListUnspent tests...");

            Console.WriteLine("ListUnspent: " + Bitcoind.ListUnspent());
            Console.WriteLine("ListUnspent: " + Bitcoind.ListUnspent(_walletPassPhraseTimeout));
            Console.WriteLine("ListUnspent: " + Bitcoind.ListUnspent(_walletPassPhraseTimeout, "15"));

            return(true);
        }
Example #29
0
        public static bool SendToAddress()
        {
            Console.WriteLine("Starting SendToAddress tests...");

            Console.WriteLine("SendToAddress: " + Bitcoind.SendToAddress("mmx8vJ6F4sBcBuhbEF1UAGevAMmyaSfLxx", "0.1"));
            Console.WriteLine("SendToAddress: " + Bitcoind.SendToAddress("mmx8vJ6F4sBcBuhbEF1UAGevAMmyaSfLxx", "0.001", "test"));
            Console.WriteLine("SendToAddress: " + Bitcoind.SendToAddress("mmx8vJ6F4sBcBuhbEF1UAGevAMmyaSfLxx", "0.0001", "test", "test2"));

            return(true);
        }
Example #30
0
        public static bool Move()
        {
            Console.WriteLine("Starting Move tests...");

            Console.WriteLine("Move: " + Bitcoind.Move("cust2", "cb2", "1.0"));
            Console.WriteLine("Move: " + Bitcoind.Move("cust2", "cb2", "0.0123", "3"));
            Console.WriteLine("Move: " + Bitcoind.Move("cb2", "cust2", "1.0123", "3", "refund"));

            return(true);
        }