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(); }
public void SendZeroTran() { var api = new IotaApi("https://nodes.thetangle.org:443"); var tran = new TransferItem() { Address = "S9XDEUXLTPUKULJXMV9IUKBMLGRHLXPCIMWFE9UHIGQGJEZSJRPYFBDSNNSMDEHBSTUEGAGBX9QZNKDNY", Tag = "UNITTEST" }; var result = api.AttachTransfer(tran, CancellationToken.None).Result; Assert.IsNotNull(result); }
static void Main(string[] args) { Console.WriteLine("Connecting to a Node!"); // !!Use a secure seed!! not this one! var seed = "CBM9PSNQPZVDXCHYJXDKUQITXAWQPBWZGYTBGTEIFWXOZTMHESEVHYLXWASWQFEJHUAKHIKSCA9AL9KMG"; var api = new IotaApi(Url, 14); var address1 = api.GetAddress(seed, 0).Result; Console.WriteLine("your first address:" + address1.Address); var address2 = api.GetAddress(seed, 1).Result; Console.WriteLine("your second address:" + address2.Address); var stopwatch = Stopwatch.StartNew(); // Sending a message without using any funds. var transfer = new TransferItem() { Address = address2.Address, Value = 0, Message = "MY9FIRST9MESSAGE", Tag = "TAGGOESHERE" }; var transactionItem = api.AttachTransfer(transfer, CancellationToken.None).Result; Console.WriteLine($"You transaction took: {stopwatch.Elapsed.TotalSeconds} seconds."); Console.WriteLine($"Your transaction hash (might be): {transactionItem[0].Hash}"); Console.WriteLine($"Press any key to exit"); Console.ReadKey(); }