Log Message Node

The “Log Message” node on Catenis Flow allows individuals to easily log information to the Bitcoin blockchain by inserting message content or IPFS message hash references into a Bitcoin transaction. Information is logged directly to a Bitcoin Transaction if data is 75 bytes (75 characters) or less. When content  is above 75 bytes Catenis Flow employs automated content size detection, then hashes the content and places the content’s hash into the bitcoin blockchain and places the actual content on to IPFS.

Note: Content’s IPFS hash placed in a Bitcoin transaction is base 56 encoded. If you would like to decode the entry into a UTF8 hash, there is a nifty base 56 decoder/encoder written by James Stanley that can be found here: https://incoherency.co.uk/base58/

Image of the LogMessage Node

Node Properties Panel Field Description

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

Image of The Log 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.
  2. Encrypt Checkbox: Catenis Flow defaults to encrypting all content it logs with military-grade encryption. Deselect this checkbox if you want your data to be logged in clear-text
  3. Off-Chain Checkbox: All Catenis messages default to being sent via the Catenis off-chain protocol. You can choose to disable off-chain messages and sent a standard message instead. Disabling off-chain messages is highly discouraged as standard messages incur higher fees, cost more Catenis credits and create unneeded bitcoin transactions.
  4. Storage Drop-Down: Catenis Flow supports two different modes of storage and adds automatic detection based on content size:
    1. Auto – This mode will automatically detect the size of the content you are logging and if the content is 75 bytes or less it will place the content in a Bitcoin transaction. If the content is above 75 bytes is will create a signature hash of the content and placed the signature hash in the Bitcoin transaction and place the content on IPFS.
    2. Embed – This setting will force the content being logged to be embedded within a Bitcoin transaction.  If the content is above 75 bytes Catenis Flow will return an error message.
    3. External – This setting will force the content being logged to be hashed, it’s hash will be placed within a Bitcoin transaction and its content will be placed in external IPFS storage even if the content is smaller than 75 bytes.
  5. Async Checkbox: This setting forces the content to be logged asynchronously and is useful when handling content that is large, typically above 10 Megabytes.

Additional properties can be set by passing a JSON object when handling large content. Please refer to handling large content that can be found here

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, please refer 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 “Log 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 “JSON” Type. An Ellipse button “…” will appear to the right of the field. Click this ellipse button to display a JSON edit box. 
  8. Enter the JSON information you wish to pass as input to the Catenis Node (an example JSON input is below). After entering your JSON text 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 JSON Object that can be passed to this node

    "message": {
        "data": "Hello World",
        "isFinal": true
    "options": {
        "encrypt": true,
        "encoding": "utf8",
        "storage": "auto"

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

Example Flow - Import Into Node-Red to Get Started

[{"id":"6cc529ee.1db8b8","type":"tab","label":"Flow 4","disabled":false,"info":""},{"id":"72f56e11.5e858","type":"log message","z":"6cc529ee.1db8b8","name":"","device":"","encoding":"utf8","encrypt":false,"storage":"embedded","async":false,"x":430,"y":160,"wires":[["e276bdbe.e464"]]},{"id":"85bba758.1d2708","type":"inject","z":"6cc529ee.1db8b8","name":"Object payload","topic":"","payload":"{\"message\":{\"data\":\"Hello World\",\"isFinal\":true},\"options\":{\"encrypt\":true,\"encoding\":\"utf8\",\"storage\":\"auto\"}}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":"","x":200,"y":160,"wires":[["72f56e11.5e858"]]},{"id":"853d7532.246de8","type":"comment","z":"6cc529ee.1db8b8","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":441,"y":123,"wires":[]},{"id":"e276bdbe.e464","type":"debug","z":"6cc529ee.1db8b8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":670,"y":160,"wires":[]}]

Note: After importing this flow you will need to set the Catenis Flow node(s) in this flow to use a previously configured virtual device. Instructions on how to set up your virtual device on Node-RED can be found here: https://blockchainofthings.com/docs/configure-your-first-virtual-device-on-catenis-flow/

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.