1. Knowledge Center
  2. TBSP for Developers

Node-RED and TBSP

TBSP uses Node-RED to write smart contracts and sample applications.


Node-RED is a flow-based development tool for visual programming and can be used to wire together hardware devices and APIs.

Available in a browser-based editor, you can wire together flows using nodes in the palette, including TBSP nodes, and then deploy to its runtime at a single click.

This light-weight runtime is built on Node.js. 

Thanks to the vast number of available Node.js modules, it is easy to extend the range of palette nodes to add new capabilities.

Communication between TBSP and Node-RED

If you have an active TBSP deployment, you can use the Node-RED UI to communicate with TBSP nodes. 

Specifically, we'll use a memory smart contract flow generated from Yeoman as an example, which you can find in the Node-RED UI, found at <instanceURL>:8144/red, for example. 

Let's take an example, the implementation of model.notifyObserversOf. DS_getEmail_and_Pubkey, which is the event that a node in Node-RED is listening to.

The parameter { key: recipient.pubKey } is required, and ctx is the object with the return parameters.

var model = server.models["uiObserver"];
async.eachSeries(recipients, function (recipient, callback) {
model.notifyObserversOf("DS_getEmail_and_Pubkey", { key: recipient.pubKey }).then(function (ctx) {

// CTX is being set by the logic in Node-RED

// Start of your your own Business logic
if (ctx.recipient) {
pubKey: ctx.key,
email: ctx.recipient
else {
pubKey: ctx.pubkey,
email: ctx.key
// End of your your own Business logic

}, function (err) {
return res.send({ variant: "OK", result: result });

Example 1:

Select the node 'ui listener' from the category 'Tymlez':


Example 2:

The event must have the same name as defined in the example above, 'DS_getEmail_and_Pubkey':


Example 3:

Create your business logic and set ctx for all values you want to return.