0

Thank you in advance.

I would like to have a working example using the node.js client of iota, where i give an index to a function and the function returns to me the messages or the message ids.

I have tried using

const mes= client.getMessage();

const add=await mes.initialAddressIndex(index);

but give me the error

mes.initialAddressIndex is not a function

Also i would like to ask if you know how is the best form to check if a message was sent by a certain trusted source. A minimal example will be much appreciated.

2 Answers2

1

Check out the iota.js lib:

https://github.com/iotaledger/iota.js/blob/main/examples/browser/index.html

const client = new Iota.SingleNodeClient("https://chrysalis-nodes.iota.org/");
const message = await client.message(messageID);
console.log(message);
IOTAphp
  • 31
  • 2
0

To fetch a Message by index take a look at:

https://github.com/iota-community/javascript-iota-workshop/blob/main/code/3-fetch-hello.js

IOTAphp
  • 31
  • 2