IOTA, Not: Bitcoin, Ethereum, Litecoin

So I made another bit of code to show how easy it is to send real IOTA (Reminder, I am not endorsing IOTA, I just love easy to code projects). The github is at https://github.com/hpssjellis/easy-nodejs-iota-send-token

Here is the main app.js. Their really are no other files except the package.son file which simply auto loads npm install @iota/core and npm install @iota/converter

/////////////////////////////////////////////////////////////////
////
//// Easy send IOTA Tokens
////
////////////////////////////////////////////////////////////////

const iotaLibrary = require('@iota/core')
const Converter   = require('@iota/converter')


            //   'ABCDEFGHIJKLMNOPQRSTUVWXYZ9ABCDEFGHIJKLMNOPQRSTUVWXYZ9ABCDEFGHIJKLMNOPQRSTUVWXYZ9'
const mySeed =   'DONOTSTOREYOURSEEDONAPUBLICGITHUBSITEASANYONECANSTEALALLYOUR9IOTATOKENSKEEPITSAFE' // Your secret 81 seed [A-Z9]



const iota = iotaLibrary.composeAPI({
    provider: 'https://nodes.iota.cafe:443'   // This is the main net not development
})

// find other nodes at https://nodes.iota.works/

// https://nodes.iota.cafe:443
// https://www.iotaqubic.us:443
// https://ultranode.iotatoken.nl:443
// https://perma.iota.partners:443

// https://iotanode.us:443  // I may have over used this!
// https://nodes.devnet.thetangle.org:443'  // DEV NET must use sendTrytes(trytes, 3, 9) these iota are not real!






async function mySendFunction(){

  const myReceivingAddress = await iota.getNewAddress(mySeed, {checksum: true, security: 2})

  // or use below any address you are given or make using the Trinity App https://trinity.iota.org/
  //const myReceivingAddress = ''   // You can generate your own receive address


  const myValueIOTA = 6    // amount of IOTA to send.

  console.log('Sending: '+myValueIOTA+' iota to '+myReceivingAddress)

  const myTransfers = [{
      value: myValueIOTA,
      address: myReceivingAddress,
      message: Converter.asciiToTrytes('Sent: '+myValueIOTA+' iota to '+myReceivingAddress)
    }]

    const myTrytes = await iota.prepareTransfers(mySeed, myTransfers)

    // with security depth 3 and minWeightMagnitude for Mainnet = 14
    const myResponse = await iota.sendTrytes(myTrytes, 3, 14)

    console.log('Completed TXs. You sent: '+myValueIOTA+' IOTA to '+myReceivingAddress)
   // response.map(tx => console.log(tx))    // very useful, shows lots of information: the hash, value, message incoded etc

}

// run the async function to be able to use 'await'
mySendFunction()

That’s it for sending IOTA! Reminder the seed is everything. You randomly make up your seed (A-Z or the number 9) but if anyone finds it, they can take all your IOTA. The IOTA is not stored in wallets, it is stored in the cloud using what they call the Tangle. The seed is the only way to interact with your tokens. Anywhere you store your seed could be a security hole. Best to print it out and use the QR code to load it when needed.

Presently 1 penny ~= 25,000 IOTA. You can not send a decimal amount of an IOTA.

2 Likes