public void Setup() { _iotaClient = new IotaApi("node.iotawallet.info", 14265) { LocalPow = new PearlDiverLocalPoW() }; }
static void Main(string[] args) { var api = new IotaApi("https://nodes.thetangle.org/"); // Get one address. Console.WriteLine($"Checking if addresses have been used before."); var addresses = new[] { "FAKEADDRESS9999999999999999999999999999999999999999999999999999999999999999999999", "ALVYY9WDRDISRKUVSVGD9LVLDPBVETCSJQBXKFC9FNBYPVDEUSOCIWMVAESUOPCAAJTMXNPKHHIYTOH9X" }; var response = api.IriApi.WereAddressesSpentFrom(addresses).Result; if (response.Successful) { var data = response.Result; for (int i = 0; i < addresses.Length; i++) { Console.WriteLine($"Address {addresses[i]} used={data[i]}"); } } else { Console.WriteLine($"{response.ErrorMessage} Exception: {response.ExceptionInfo}"); } Console.WriteLine($"Press any key to close"); Console.ReadKey(); }
static void Main(string[] args) { // Your seed is an 81 char TRYTE string. The Tryte alphabet is upper care A-Z and 9. Use a tool to create your own seed. // The seed below is the full alphabet repeated 3 times. NEVER user this seed to transfer Iota as your IOTA will not be safe. var seed = "ABCDEFGHIJKLMNOPQRSTUVWXYZ9ABCDEFGHIJKLMNOPQRSTUVWXYZ9ABCDEFGHIJKLMNOPQRSTUVWXYZ9"; // Get an address without hitting the Internet. var address1 = BeeFrog.Iota.Api.Utils.IotaUtils.GenerateAddress(seed, 0); Console.WriteLine($"Your address is: {address1.Address}"); var api = new IotaApi("https://nodes.thetangle.org/"); // Get one address. Console.WriteLine($"Creating an address and checking it's balance."); var address1WithBalance = api.GetAddress(seed, 0).Result; Console.WriteLine($"Your address is: {address1WithBalance.Address} Your balance is: {address1WithBalance.Balance} Iota"); // Get multiple address. Console.WriteLine($"Getting 3 addresses and checking their balance."); var addresses = api.GetAddresses(seed, 1, 3, CancellationToken.None).Result; foreach (var address in addresses) { Console.WriteLine($"Another address is: {address.Address} Your balance is: {address.Balance} Iota"); } 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 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 GetTrytesMine22() { var trytes = "999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999S9XDEUXLTPUKULJXMV9IUKBMLGRHLXPCIMWFE9UHIGQGJEZSJRPYFBDSNNSMDEHBSTUEGAGBX9QZNKDNY999999999999999999999999999IGYNONE99999999999999999999IEJLTYD99999999999999999999XX9TDOEWQGKQNJTZPFAJJLOREYICWGHIIZEQFFFBACSYTKQJBPJVNJTHRAUKQT9AEWVGXACCVZFJICPJWT9LVYFQGF9WQHDQNLHPAKNFAC9VXPHNJPDFIQIELAYMBHCPDQBQSSXPLZRVSVSQHGPXKMVNGKRWN99999A9VWVUZWGPPYCBOTNJZAQMUDWZVXFLTCQZZJHWGSOAUTXPSMEFJQZKOKAIIJYMPYLUSPODTIL9WS99999PAYNONE99999999999999999999LASLSZBJE999999999MMMMMMMMMCAMDTIYKYAYPIZOMMTZAFODTEIS"; var api = new IotaApi("https://nodes.thetangle.org:443"); var bundle = api.GetBundleTransactionItems("XX9TDOEWQGKQNJTZPFAJJLOREYICWGHIIZEQFFFBACSYTKQJBPJVNJTHRAUKQT9AEWVGXACCVZFJICPJW").Result; var tran = bundle.Result[0]; Assert.AreEqual(trytes, tran.RawTrytes); }
public void GetTrytes() { var api = new IotaApi("https://nodes.thetangle.org:443"); var bundle = api.GetBundleTransactionItems("NLAVEPNFGLLJXER9VKTTBQSHTXZGBLNH9ILHB9TXH9YEGGETCQAWIYPKKWSAODFORD9TWJHPHLNYHWIQX").Result; foreach (var tran in bundle.Result) { var rTrytes = tran.RawTrytes; var x = tran.ToString(); } }
private IotaApi CreateIotaClient() { // "http://iota.bitfinex.com:80" // "http://node.iotawallet.info:14265" // "http://node.deviceproof.org:14265" // "http://88.198.230.98:14265" // "http://iota.digits.blue:14265" var api = new IotaApi("http://node.iotawallet.info:14265"); return(api); }
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("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(); }
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(); }
public void CreateApiClientInstance() { _iotaClient = new IotaApi("node.iotawallet.info", 14265); }
public void createProxyInstance() { iotaApi = new IotaApi("node.iotawallet.info", 14265); }
public static void EnsureTransferAddresses(this IotaApi iotaApi, TransferAddresses transferAddresses) { }
private static void Promote(IotaApi api, string hash) { while (true) { Console.WriteLine("Waiting 60 seconds before promoting. Press any key to stop."); for (int i = 0; i < 240; i++) { if (i % 4 == 0) { Console.Write("."); } Thread.Sleep(250); if (Console.KeyAvailable) { Console.ReadKey(); return; } } var states = api.IriApi.GetInclusionStates(new[] { hash }).Result; if (states.Successful && states.Result.Any() && states.Result[0]) { Console.WriteLine("Your transaction has been confirmed!"); return; } var consistencyResponse = api.IriApi.CheckConsistency(hash, hash).Result; if (consistencyResponse.Successful) { if (consistencyResponse.Result == false) { Console.WriteLine("Your transaction needs to be re-attached!"); var response = api.GetTransactionItems(hash).Result; if (response.Successful) { Console.WriteLine("Re-attaching!"); var reattachResponse = api.AttachTransactions(response.Result, CancellationToken.None).Result; if (reattachResponse.Successful) { hash = reattachResponse.Result[0].Hash; Console.WriteLine("Success! Your new hash is:" + hash); continue; } else { Console.WriteLine($"Re-attach Failed! Reason: {reattachResponse.ErrorMessage} Exception:{reattachResponse.ExceptionInfo}"); } } else { Console.WriteLine($"Get Transaction Failed! Reason: {response.ErrorMessage} Exception:{response.ExceptionInfo}"); } } Console.WriteLine(" Promoting."); var promoteResponse = api.PromoteTransaction(hash, CancellationToken.None).Result; if (promoteResponse.Successful) { Console.WriteLine(promoteResponse.Result.Hash); } else { Console.WriteLine($"Promotion failed!! Reason: {promoteResponse.ErrorMessage} Exception:{promoteResponse.ExceptionInfo}"); } } else { Console.WriteLine($"CheckConsistency failed! Reason: {consistencyResponse.ErrorMessage} Exception:{consistencyResponse.ExceptionInfo}"); } } }
private void Initialise() { client = new IotaApi(_host, _port); Debug.Write("test"); }