Skip to content

Instantly share code, notes, and snippets.

@dioptx
Created December 27, 2018 10:14
Show Gist options
  • Save dioptx/fbcc155fc6307aac0e520afe6db91854 to your computer and use it in GitHub Desktop.
Save dioptx/fbcc155fc6307aac0e520afe6db91854 to your computer and use it in GitHub Desktop.
Code supposed to send 1 iota to test address
const Iota = require('@iota/core');
const Converter = require('@iota/converter');
const iota = Iota.composeAPI({
provider: 'https://nodes.devnet.iota.org:443'
});
iota.getNodeInfo()
.then(info => console.log(info))
.catch(err => {});
const address =
'HELLOWORLDHELLOWORLDHELLOWORLDHELLOWORLDHELLOWORLDHELLOWORLDHELLOWORLDHELLODENNIS';
const seed =
'ZODJGSIITXFNKKICPVXSFIWJNGLROFMZAEYTJAIKUU9TERRFQFFSQHZWWITVDACAYWXZABODDJQIYVSYS';
const message = Converter.asciiToTrytes('Hello Dennis!');
const transfers = [
{
value: 1,
address: address,
message: message
}
];
iota.prepareTransfers(seed, transfers)
.then(trytes => iota.sendTrytes(trytes, (depth = 3), (mwm = 9)))
.then(bundle => {
console.log(bundle)
}).catch(err => {
// catch any errors
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment