I'm always getting this error without understanding why.

TypeError: Cannot read property 'toTrytes' of undefined


// Require the use of IOTA library
const Iota = require('@iota/core')

// Create a new instance of the IOTA class object.
// Use 'provider' variable to specify which Full Node to talk to
const iota = Iota.composeAPI({
  provider: 'https://nodes.devnet.iota.org:443'

// Call the 'getNodeInfo call to check that the node is working
    .then(info => console.log(info))
    .catch(err => {})

//Actual Transaction
const address =
const seed =
const message = iota.utils.toTrytes('Hello World!')

const transfers = [
    value: 0,
    address: address,
    message: message

  .prepareTransfers(seed, transfers)
  .then(trytes => iota.sendTrytes(trytes, 3, 9))
  .then(bundle => {
  .catch(err => {
    // catch any errors

Maybe this will work:

const Converter = require('@iota/converter') const message = Converter.asciiToTrytes('MAYBE LIKE THAT')

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.