Test Catenis Flow Connectivity To the Catenis APIs

After you have installed Catenis Flow on Node-RED and configured your first virtual device you should test that you properly configured connectivity by logging a message into a Bitcoin transaction on the blockchain. To do this, let’s start by creating your first flow by using the Catenis Flow “Log Message” Node.

  1. Drag and drop from the Common category, the Input “inject” node from the left pallet menu (this node will read “timestamp” once dropped on the pallet)
  2. Drag and drop from the Catenis category the “Log Message Node” from the left Pallet menu on to the right of the “inject” node
  3. Drag and drop from the Common category the Output “Debug Node” from the left pallet menu on to the right of the “Log message node” from the previous step (this node once dropped will read “msg.payload)
Setting Up Nodes To Test Connectivity

Now, let’s wire the nodes together so each node knows where to take input and where to inject output. Nodes are wired together by pressing the left mouse button on a node’s port (the gray square box that becomes orange color), dragging to the destination node and releasing the mouse button. To do this:

  1. The inject node (left-most in the color blue) should be connected to the log node (purple one in the middle) by clicking the gray square box on its right side and dragging the mouse to the gray square box on the left side of the log node.
  2. The log node should be wired to the debug output node in the same manner (dragging the gray square box on the right-hand side of the log node and connecting it to the gray square box on the left side of the debug node.
Wiring Nodes Together

Let’s configure each node so we can test logging a “Hello World” message on the blockchain

Note: Whenever we add a Catenis Flow node on the workspace it is required to assign a Virtual device that you have previously configured to the node.

First, we are going to enter a payload message for the inject node (i.e. the data it will inject into a connected node).

  1. Double click the inject node to bring up the properties panel for that node. Click on the drop-down menu next to the “Payload” property, which should be set to “timestamp” by default and change it to “string”. This enables the node to inject the text you enter in the data field. 
  2. In this case, we will enter the sample text “Hello World”. Do not alter any of the other properties for now. 
  3. Click Done
Entering Hello World in the Inject Node

Next, we will set up the log message node and assign it to the proper Virtual Device (Bitcoin Connector) that you should have already created and configured. To do this:

  1. Double click on the log message node (purple one in the middle).
  2. Uncheck the Encrypt checkbox so we can see the message directly on the blockchain using a block explorer.
  3. Uncheck the off-chain message so a bitcoin transaction is created in real-time for testing. Note: When building an application, you should always use off-chain messages. Standard messages incur higher fees, cost more Catenis credits and create unneeded bitcoin transactions
  4. Click the drop-down menu of the “Device” property of the node
  5. Assign the device to what you created in the previous steps (in this case we named our Virtual Device “Bitcoin Connector”). 
  6. Click the “Done” button.
Setting A Catenis Node With The Preconfigured Credentials

Now, we can test if your flow successfully logs the Hello World message to the blockchain. To do this we must deploy the flow and then inject the message using the log message node. Do the following:

  1. Click the red button to the top right-hand side of the workspace that says “Deploy”. You should see a pop-up notifying you the flow was successfully deployed. 
  2. Click the gray square box to the left of the inject node (which contains the Hello World string) to pass the “Hello World” message from the inject node to the log message node and through the flow. If successful, the message ID should print to the debug sidebar on the right.
Deploying The Project and Sending a Message to the blockchain

Now, we are going to retrieve from the blockchain the location of the message we just logged. To do this we will inject the message ID that was returned from the previous step into the “retrieve container” node. This “retrieve container node” will return the “Bitcoin Transaction ID” and the location of the content of this message if successful. General steps are as follows:

  1. Insert from the common category a new “inject” node, from the Catenis Flow category a “retrieve message container” node, and from the common category a “debug” node into the workspace side by side.
  2. Set the parameter of the properties of the “inject” node’s payload field to “string” and enter the message ID generated that was returned when you logged the message (the message ID will be displayed at the right sidebar. Click “copy value” icon and paste it into the payload area)
  3. Configure the device parameter of the “retrieve message container” node to the same device used in the “log message” node.
  4. Wire the inject node to the “retrieve message container” and the “retrieve message container” node to the debug node.
  5. Click the “Deploy” button and then click the button to the left of the inject node to send the message payload to Catenis and the bitcoin transaction.
Deploying The Project and Sending a Message to the blockchain
Setting the Value of the Inject Node to the MSG ID
Setting the Retrieve Message Container Node Configuration
Wire the 3 Nodes Together
Switching to the Debug Panel

You should see a JSON object output on the debug sidebar with a blockchain object containing name-value pairs. To see its content click to expand on the “object arrow” and once again click on the “blockchain arrow”. It will expand and display a “txid” and “isConfirmed” name-value pairs.  The txid is the Bitcoin transaction ID and the location of where the logged message is stored on the Bitcoin blockchain.

Retreiving the BTC TX ID of the Message

You can verify that your Bitcoin transaction has been successfully logged on the Bitcoin blockchain by using a testnet block explorer.  For this example, we will use the Bitaps testnet block explorer located at https://tbtc.bitaps.com

Entering your Bitcoin transaction ID in the search field and pressing the enter button on your keyboard should display the “Hello World” message in the “Data Text” section (this is the Bitcoin transactions OP_RETURN, also known as Null Data).

NOTE: All messages added to Bitcoin transactions will have a “CTN” in the beginning because Catenis appends all messages logged to the Blockchain with this prefix.

Viewing A Message Through a Block Explorer

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.