Instantly share code, notes, and snippets.

Embed
What would you like to do?
Preparing IOTA transactions to be broadcasted
// 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_javascript.ipynb.html#445C2B9485C6
// Requirement: IOTA Javascript Library (!npm install iota.lib.js)
var IOTA = require('../../node_modules/iota.lib.js/lib/iota');
var NodeURL = "https://field.deviota.com:443";
var iota = new IOTA({
'provider': NodeURL
});
var MySeed = "HGW9HB9LJPYUGVHNGCPLFKKPNZAIIFHZBDHKSGMQKFMANUBASSMSV9TAJSSMPRZZU9SFZULXKJ9YLAIUA";
var TargetAddress1 = "CXDUYK9XGHC9DTSPDMKGGGXAIARSRVAFGHJOCDDHWADLVBBOEHLICHTMGKVDOGRU9TBESJNHAXYPVJ9R9";
var TargetAddress2 = "CYJV9DRIE9NCQJYLOYOJOGKQGOOELTWXVWUYGQSWCNODHJAHACADUAAHQ9ODUICCESOIVZABA9LTMM9RW";
var NowIs = new Date() //get a actual date & time - just to have some meaningfull info
// preparing transactions
var pt = {
'address': TargetAddress1, //81 trytes long address
'value': 0,
'message': iota.utils.toTrytes('Here comes a first message. Now is ' + NowIs),
'tag': 'HRIBEK999IOTA999TUTORIAL' //Up to 27 trytes
}
var pt2 = {
'address': TargetAddress2, //81 trytes long address
'value': 0,
'message': iota.utils.toTrytes('Here comes a second message. Now is ' + NowIs),
'tag': 'HRIBEK999IOTA999TUTORIAL' //Up to 27 trytes
}
console.log("Created transaction objects - mandatory fields only:")
console.log(pt)
console.log(pt2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment