Last active
September 24, 2019 10:30
-
-
Save Hribek25/6694be45719d1809c96188fa9e4f0927 to your computer and use it in GitHub Desktop.
Preparing IOTA transactions to be broadcasted
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The snippet is a part of the IOTA Developer Essentials project. You can reach it at https://hribek25.github.io/IOTA101/ | |
// Complete description and story behind the snippet is available at: https://hribek25.github.io/IOTA101/Allchapters_csharp.ipynb.html#445C2B9485C6 | |
// Requirement: Tangle.Net library (!nuget install Tangle.Net) | |
// Requirement: Newtonsoft Json library (!nuget install Newtonsoft.Json) | |
#r "Tangle.Net.dll" | |
#r "Newtonsoft.Json.dll" | |
using Tangle.Net.Entity; | |
using Newtonsoft.Json; | |
var MySeed = "HGW9HB9LJPYUGVHNGCPLFKKPNZAIIFHZBDHKSGMQKFMANUBASSMSV9TAJSSMPRZZU9SFZULXKJ9YLAIUA"; | |
var TargetAddress1 = "CXDUYK9XGHC9DTSPDMKGGGXAIARSRVAFGHJOCDDHWADLVBBOEHLICHTMGKVDOGRU9TBESJNHAXYPVJ9R9"; | |
var TargetAddress2 = "CYJV9DRIE9NCQJYLOYOJOGKQGOOELTWXVWUYGQSWCNODHJAHACADUAAHQ9ODUICCESOIVZABA9LTMM9RW"; | |
var NowIs = DateTime.Now.ToShortDateString(); //this is not important - just to have some meaningful message | |
var pt = new Transfer() // creating a first transfer (a proposed transaction) | |
{ | |
Address=new Address(TargetAddress1), | |
ValueToTransfer=0, | |
Message=TryteString.FromUtf8String("Here comes a first message. Now is " + NowIs), | |
Tag=new Tag("HRIBEK999IOTA999TUTORIAL"), | |
Timestamp = Timestamp.UnixSecondsTimestamp // please note, Tangle.Net library does not enter timestamp for you | |
}; | |
var pt2 = new Transfer() // creating a second transfer (a proposed transaction) | |
{ | |
Address = new Address(TargetAddress2), | |
ValueToTransfer = 0, | |
Message = TryteString.FromUtf8String("Here comes a second message. Now is " + NowIs), | |
Tag = new Tag("HRIBEK999IOTA999TUTORIAL"), | |
Timestamp = Timestamp.UnixSecondsTimestamp // please note, Tangle.Net library does not enter timestamp for you | |
}; | |
Console.WriteLine("Created transaction objects - mandatory fields only:"); | |
Console.WriteLine(JsonConvert.SerializeObject(pt, Formatting.Indented)); | |
Console.WriteLine(JsonConvert.SerializeObject(pt2, Formatting.Indented)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment