public void TestPoWSrvPoWTypeSingleNode()
        {
            var repository = IotaRepositoryFactory.Create("http://somenode.uri:1234", PoWType.PoWSrv);
            var powService = repository.GetType().GetProperty("PoWService", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(repository);

            Assert.IsInstanceOfType(powService, typeof(PoWSrvService));
        }
Exemplo n.º 2
0
        public void Execute()
        {
            // Create a repository with a single node and with PoW
            var repository = IotaRepositoryFactory.Create("http://somenode.uri:12345");

            // Create a repository with a single node with PoW on the node
            repository = IotaRepositoryFactory.Create("http://somenode.uri:12345", PoWType.Remote);

            // Create a repository with a single node with PoW done by PoWSrv
            repository = IotaRepositoryFactory.Create("http://somenode.uri:12345", PoWType.PoWSrv);

            // Create a repository with multiple circuited nodes with local PoW
            repository = IotaRepositoryFactory.CreateWithFallback(new List <string> {
                "http://somenode.uri:12345", "http://someothernode.uri:12345"
            });

            // Create a repository with multiple circuited nodes with PoW on the nodes
            repository = IotaRepositoryFactory.CreateWithFallback(new List <string> {
                "http://somenode.uri:12345", "http://someothernode.uri:12345"
            }, PoWType.Remote);

            // Create a repository with multiple circuited nodes with PoW done by PoWSrv
            repository = IotaRepositoryFactory.CreateWithFallback(new List <string> {
                "http://somenode.uri:12345", "http://someothernode.uri:12345"
            }, PoWType.PoWSrv);
        }
Exemplo n.º 3
0
        public static void SendBalance()
        {
            var s1 = Seed.Random();
            var s2 = Seed.Random();

            var repository = IotaRepositoryFactory.Create("https://nodes.devnet.thetangle.org");
            var nodeInfo   = repository.GetNodeInfo();

            var mainDevnetSeed = new Seed("PHIDOZJCOJGGYHMP9DPZQGHXYCBMJEJWESNEXGAEUY9OGUOKKUYYEBREJBXRWRSHCWSFPILJBPVCDKGVA");
            //var depositSeed = repository.GetNewAddresses(s1, 0, 1, SecurityLevel.Medium);
            //var mainDevnetSeedsenderBalance = repository.GetAccountData(mainDevnetSeed, true, 2, 0, 5);


            //var senderSeed = new Seed("VJEFRYYWLYMKGGQPERQISOAIJRCLKDJKDYFPQYTAEKQVLEFTEYKYKVSEFBWBCLVNBUPNYCUDNXSJQLKWV");
            //var recipientSeed = new Seed("NYLBCMVKSWQJCIVWUSHLOYRAGGJQTMUOUXJKQTT9LYIV9ZWTYANOWRFTUKNVPVEJGHUXNPAPNCSKLFSAC");

            //var senderBalance = repository.GetAccountData(senderSeed, true, 2, 0, 10);
            //var recipientBalance = repository.GetAccountData(recipientSeed, true, 2, 0, 10);

            ////Generate one new recipient address
            //var recipientAddress = repository.GetNewAddresses(recipientSeed, 0, 1, SecurityLevel.Medium);

            //Prepare transaction
            var transfer1 = new Transfer(
                address: "TJGKASWXRYEQUILZBVBYVORFXWZBOGHGOEMLZBMFYFKURXGBBDNCFFODEPZLTP9E9ZNOZDDUEPSUNIKXDIRBMM9PHB",
                tag: "PATRIQTUTORIALS",
                message: "PatriQ tutorials testing https://patriq.gitbook.io/iota/",
                timestamp: DateTime.Now,
                value: 10);

            //Create a bundle
            var bundle = new Bundle();

            bundle.AddTransfer(transfer1);

            //Send the bundle
            var result = repository.SendTransfer(mainDevnetSeed, bundle, SecurityLevel.Medium, depth: 4, minWeightMagnitude: 9);

            //Check the result in Tangle Explorer
            Console.WriteLine("Link to Tangle Explorer: {0}{1}", "https://devnet.thetangle.org/bundle/", result.Hash);
        }
 public void TestIncorrectUriShouldThrowException()
 {
     IotaRepositoryFactory.Create("asasfa");
 }