cazfletch / node-red-contrib-fabric

Other
3 stars 3 forks source link

Added functionnalities to mid node (fabric-client 1.4.0) #4

Closed Andromelus closed 5 years ago

Andromelus commented 5 years ago

fabric-config node

Identity name and display name of the configuration are separated, allowing the user to insert a custom configuration name. This is useful in case the user uses identities from two organizations but with the same name (org1 admin and org2 admin for example). Previously, we could only see two "admin" configurations, forcing us to open the configuration to check which config correspond to which org.

fabric-mid node

Dynamic configuration

This node now handles dynamic configuration. It can be configured via the msg.payload object. Any configuration parameter passed to the msg.payload object will overwrite any manual configuration of the node. For the full list of the configuration parameters, depending on what action the node must perform, please check node description

Submit and Evaluate transaction

No change. They still use fabric-network 1.4.0

Listen for event(s)

It uses fabric-client 1.4.0

This node can listen for events. There are two "modes" of listening. This mode can be set with the timeout configuration parameter.

The default mode is timeout = true;

Listen for ever

timeout = false

If timeout is false, the listener never disconnect/unregister and keep listening. All the events are sent one by one to the next node in msg.payload.

Warning : If you specified an interval with an end block, the listener WILL NOT disconect or unregister. If an interval with an end block is specified, it is preferable to set timeout = true.

Listen "not for ever"

This is the default mode, with timeout = true.

The listener reset every time a transaction is found. The timeout's value is 2 seconds.

The timeout is needed because of a bug with the listener and because of the way it works. More information here: https://jira.hyperledger.org/browse/FABN-1207

The events are sent to the next node all together in an array in msg.payload.

Query world state

The mid node can now query the world state. This uses fabric-client 1.4.0.

Query block

The mid node can now query a block in the ledger. Block is queried by block number. This uses fabric-client 1.4.0.

Query transaction

The mid node can now query a transaction in the ledger. Transaction is queried by transaction ID. This uses fabric-client 1.4.0.