Streamfilter deployment

+1 vote
Hello team,

I am testing transaction filter in cli mode but , i want to know after compiling how its deploying in blockchain network Unlike ethereum it creates and byte file and deploy in network ?


How this deployement of smart filter and compilation using node js project?
asked Feb 4, 2019 by kheteshrotangan

1 Answer

0 votes
You don't compile the filter before passing it to MultiChain – instead you pass the JavaScript source code and MultiChain takes care of everything else.
answered Feb 4, 2019 by MultiChain
yes that's correct but i want that to implement in node js project.
So instead of running js cod in terminal i want it to try in my nodejs project like run js filter by nodejs web service where I will build UI and will pass js code to multichain network and it should run on chain.

If you take example of hyperledger then in that we used to build chaincode(smart contract) and install in every peer in network then every peer will execute that chaincode for validating transaction.

How that can be achieve in multichain using nodejs sdk?

One more thing txfilter example , that you provided in multichain  which will prevent new transaction being created that is only applicable if we use createfrom command other then that every simple transaction it will accept.

create txfilter filter1 '{}' 'function filtertransaction() { var tx=getfiltertransaction(); if (tx.create) return "Stream creation temporarily disabled"; }'

Why this is so?
You just need to set up the Node.js SDK to call the right MultiChain API command.

As for your second question, the behavior of a filter in terms of accepting/rejecting transactions is not related to how those transactions are created - whether the create API, or createfrom API, or createrawsendfrom API, or whatever.
i mean to say for testing this transaction filter i have used createfrom as mentioned in documents ("createfrom 1... stream stream1 true") but if i try to test this filter by create command like ("create stream stream1 ") it will not accept because in both way i am trying to create stream right ...
Then what is the difference why filter is accepting second way of creating stream?

Also may i know if there is any api method for createfrom rpc command ?
Are you saying the filter accepts the "create stream" transaction but not the "createfrom 1... stream" transaction?

and please let me know is there any node js api for calling createfrom api command?
On the first point, please show a transcript of the API calls you are making and the responses received, so we can see exactly what is going on.

On the second point, if createfrom is not currently supported by the Node.js library you are using, it should be quite easy to extend to add it. I'm afraid we don't ourselves know the details of the library you are using.
For your information i am refering npm node module for multichain

and your github library also
This library has not yet been updated for MultiChain 2.0, so it might not support creating stream filters. But it does seem to support the basic createfrom command.
can you guide me which library should i refer for version 2.0 for smart filter test for example cretefrom and approvefrom?
We've just updated the MultiChain Web Demo with support for testing, creating and approving Smart Filters, so that might be a good place to start:
I have configured web demo but i do not understand how to launch and start web demo in browser?

In readme file below instruction ids metioned what does that mean ?
Launch the Web Demo
No additional configuration or setup is required. Based on where you installed the web demo, open the appropriate address in your web browser, and you are ready to go!
It means the web demo can be served up automatically by your web server, so long as it is compatible with PHP files.