static void Main(string[] args) { Console.WriteLine("Finding an IOTA node"); INodeFinder nodeFinder = new IotaDanceNodeFinder(); var nodes = nodeFinder.FindNodes().Result; var bestNodeUrl = nodes.ElementAt(1).Url; Console.WriteLine($"Creating transfer now. This may take a few seconds."); var transferItem = new TransferItem() { Address = "FAKEADDRESS9999999999999999999999999999999999999999999999999999999999999999999999", Message = "TESTMESSAGE" }; var api = new IotaApi(bestNodeUrl); var apiResult = api.AttachTransfer(transferItem, CancellationToken.None).Result; if (apiResult.Successful) { var transactions = apiResult.Result; Console.WriteLine($"Your transaction hash is: {transactions[0].Hash}"); } else { Console.WriteLine($"{apiResult.ErrorMessage} Exception: {apiResult.ExceptionInfo}"); } Console.WriteLine($"Press any key to close"); Console.ReadKey(); }
static void Main(string[] args) { Console.WriteLine("Finding an IOTA node"); INodeFinder nodeFinder = new IotaDanceNodeFinder(); var node = nodeFinder.GetBestNode().Result; var api = new IotaApi(node); Console.WriteLine("Found node: " + node); Console.WriteLine($"Creating transfer now. This may take a few seconds."); var transferItem = new TransferItem() { Address = "FAKEADDRESS9999999999999999999999999999999999999999999999999999999999999999999999", Message = "PROMOTE9TEST" }; var response = api.AttachTransfer(transferItem, CancellationToken.None).Result; if (response.Successful) { var transaction = response.Result; var hash = transaction[0].Hash; Console.WriteLine($"Your transaction hash is: {hash}"); Promote(api, hash); } else { Console.WriteLine($"Error Create Transaction: {response.ErrorMessage} Exception: {response.ExceptionInfo}"); } Console.WriteLine($"All done."); Console.WriteLine($"Press any key to close"); Console.ReadKey(); }
static void Main(string[] args) { Console.WriteLine("Finding an IOTA node"); INodeFinder nodeFinder = new IotaDanceNodeFinder(); var node = nodeFinder.FindNodes().Result.First(); Console.WriteLine($"Creating transfer now. This may take a few seconds."); // We'll create out 2 transactions. var transaction1 = new TransactionItem("FAKEADDRESS9999999999999999999999999999999999999999999999999999999999999999999999", 0, "BEEFROG") { SignatureFragment = BeeFrog.Iota.Api.Utils.Converter.AsciiToTrytes("Message part 1") }; var transaction2 = new TransactionItem("FAKEADDRESS9999999999999999999999999999999999999999999999999999999999999999999999", 0, "BEEFROG") { SignatureFragment = BeeFrog.Iota.Api.Utils.Converter.AsciiToTrytes("Message part 2") }; // Create an array and bundle the transactions together. var trans = new TransactionItem[] { transaction1, transaction2 }; trans.FinalizeBundleHash(new Curl()); // Now we can send them. var api = new IotaApi(node.Url); var apiResult = api.AttachTransactions(trans, CancellationToken.None).Result; if (apiResult.Successful) { var transaction = apiResult.Result; Console.WriteLine($"Your transaction bundle is: {transaction[0].Bundle}"); } else { Console.WriteLine($"{apiResult.ErrorMessage} Exception: {apiResult.ExceptionInfo}"); } Console.WriteLine($"Press any key to close"); Console.ReadKey(); }