How to use Stream filters ?

+1 vote

Hello Guys ,

I am learning stream filter in multichain so i am just going through it and now i just reach to this points :

Smart Filter Tutorial

Below is an example set of multichain-cli commands that demonstrate the creation and application of a transaction filter and a smart filter.

First, run listpermissions admin and copy and paste the displayed address here: 

Now create a transaction filter that prevents new streams being created:

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

See the filter listed, retrieve its code and approve it:

listtxfilters
getfiltercode filter1
approvefrom 1Xs5ZRKETcsATQp4AgZPodfco14Amcx4FvYoc1 filter1 true

1)The point which i have highlighted for that i am having already running chain is running on my node But the point is i was not able to figure out how can i achieve this smart filters concept in cli interactive mode?
Or how can i embedded smartfilter code in existing multichain network?? how that embedded code can be used by everynode for validation?
2)In custom permissions what do you mean by high1,high2 and low1 , low 2 permission means?

asked Jan 16, 2019 by kheteshrotangan
edited Jan 16, 2019 by kheteshrotangan

1 Answer

0 votes
1) You can use multichain-cli to create the transaction filter with exactly the command shown:

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

Once the filter is approved it will automatically be used by every node for validation.

2) These are new permissions that can be used to tag addresses for different roles. More here:

https://www.multichain.com/developers/permissions-management/
answered Jan 16, 2019 by MultiChain
After running this create filetr command it gives JSON Parse error to me:
chain1: create txfilter filter1 '{}' 'function filtertransaction() { var tx=getfiltertransaction(); if (tx.create) return "Stream creation temporarily disabled"; }'
error: Error parsing JSON:function filtertransaction() { var tx=getfiltertransaction(); if (tx.create) return "Stream creation temporarily disabled"; }
Are you on MultiChain 2.0, both multichain-cli and multichaind?
...