Catenis Flow Guide

Read Message Node

The “Read Message” node retrieves a message that was either inserted into a Bitcoin transaction or had its hash inserted into a Bitcoin transaction and contents placed on IPFS. It takes as input the  ID of the message you wish to retrieve and returns a JSON object containing the content of the message.

Image of the Read Message Node

Node Properties Panel Field Description

Node property configuration slide-out panel (this panel is accessed by double-clicking on the node).

Properties Configuration Panel of the Read Message Node

Node-RED Specific Fields

  1. Name Field:  Add a descriptive name of your choice that will help differentiate this node from others of the same type on the Node-RED workspace (not required).
  2. Connection Field: This drop-down selection is required.  Set a previously configured Catenis connection (virtual device). If you need to configure a new virtual device click the pencil button to the right of the field and follow the direction on setting up a new virtual device that can be found here.

Catenis Flow Setting Fields

  1. Encoding Drop-Down: Catenis Flow will automatically encode the content you send into one of three types you designate:
    1. UTF-8: Typically associated with textual content and is the default encoding type Catenis uses
    2. Base-64: Typically used when one wants to handle data stored in the form of a document.
    3. Hexadecimal: Typically used when one wants to express binary numbers in hex. It makes it easier than using any other base number system.
  2. Data Chunk Size: Enter the size, in bytes, of the largest message data chunk that should be returned.
  3. Async: Indicate whether processing should be done asynchronously.

How to use

  1. Drag and drop this node from the Catenis Flow pallet area to the Node-RED workspace. Double-click it to display its properties slide-out panel.
  2. On the “Device” drop-down field of the properties slide-out panel, choose the Catenis virtual device you previously configured. The virtual device is a configuration node containing the Catenis Virtual device information (device ID and API Secret key). If you do not have a virtual device configured see the section titled: “Configure your first virtual device on Node-RED” 
  3. Add the node’s configuration information based on your needs to each field of the properties slide-out panel.  Please refer to the description of each field under the section named “Node Properties Panel Field Description” on proper usage.
  4. Wire this node to a debug node. 
  5. Next, drag and drop an “inject” node to the Node-RED workspace.
  6. Wire the “inject” node to the  “Read Message” node, then double click the inject node to open its properties slide-out panel. 
  7. Alter the information in the inject node’s properties slide-out panel by selecting the drop-down “Payload” field and choose the “String” type.
  8. Enter the message ID you wish to pass as input to the Catenis Node (an example String input is below). After entering your message ID entry click the red Done button. Then click the Done button again to exit the properties dialogue box.
  9. Click the red Deploy button on the upper right-hand side of the Node-RED dashboard to deploy this flow.
  10. Now let’s test the flow: Click the button on the left attached to the inject node to send the input from the inject node to the flow.
  11. The debug sidebar should display the returned JSON object containing the API call results to the right side of the workspace.

Example of String that can be passed to this node


Note: Inputs injected into this node via a JSON object (instead of a simple string) containing alternate node properties will override the properties set on this node's slide-out properties panel.

Note: After importing this flow you will need to set the “read message” node in this flow to use a previously configured virtual devices. You will also need to set the message ID (the payload in the inject node) to the id of a message you have previously logged.

Example Flow - Import Into Node-Red to Get Started

[{"id":"c5460b6c.702968","type":"read message","z":"5788c14b.dfa14","name":"","device":"","encoding":"utf8","dataChunkSize":"","async":false,"x":420,"y":120,"wires":[["5b532efe.c8c3a"]]},{"id":"e1073ce7.b277e","type":"inject","z":"5788c14b.dfa14","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":190,"y":180,"wires":[["c5460b6c.702968"]]},{"id":"5b532efe.c8c3a","type":"debug","z":"5788c14b.dfa14","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":680,"y":120,"wires":[]},{"id":"127a1751.4a36c9","type":"comment","z":"5788c14b.dfa14","name":"Set virtual device for this Catenis node","info":"All Catenis nodes require that you set the proper virtual device on its slideout property panel on the device field.\n\nNot setting the device properly will result in a \"TypeError: Cannot read property 'ctnApiClient' of null\" ","x":410,"y":80,"wires":[]},{"id":"fa0aa315.7be4c","type":"comment","z":"5788c14b.dfa14","name":"Double click for instructions","info":"Warning: You must enter your own message ID. Not the example provided.\n\nPlease use your own  message ID generated when you submitted a message to the blockchain either using the Catenis Flow “Log Message” node or the Catenis Flow “Send Message” node.\n\nSTEPS:\n1) Double click the \"inject\" node to alter the information in the inject node. Select the drop-down payload field and choose the “String” Type.\n\n2) Enter a Catenis message ID in the String type field.\n\n\n","x":190,"y":220,"wires":[]}]

Related Articles

How can we make things Better for you?
  • Accepted file types: jpg, gif, png, pdf.
  • This field is for validation purposes and should be left unchanged.