How are Data Streams validated in Multichain ?

+2 votes
From what i understand, data streams allow you to publish data to onto the blockchain. And that too, in the form of transactions.

As far as blockchains like Bitcoin go, all the data is verified by mining nodes, BEFORE being inserted onto the blockchain. but i don't see any such mining activity present, for a data stream validation, in  multichain.

so, how does a node validate that the data being sent to the chain is the correct data ? how do we know some node is not publishing suspicious or erroneous data on to the data stream ?

is there some sort of mining mechanism for data streams ? are data stream transactions mined for the sake of validation ?

 

Please let me know about this as i have a project that is critically dependent on the Multichain platform and it uses data streams as a core feature.

 

Many thanks
asked Nov 13, 2018 by Yasir

1 Answer

0 votes
If you want to perform data stream validation, you should probably use stream filters which are available in MultiChain 2.0 (now in alpha, but fully functional):

https://www.multichain.com/developers/smart-filters/

Please note that stream filter validation is not performed by miners, but it is performed by both honest publisher and honest subscribers. So data that violates a stream filter will not be retrieved via the stream querying APIs.

If you need stricter stream data validation than this, you can use transaction filters. But this will only be effective for on-chain stream data, not off-chain data.
answered Nov 14, 2018 by MultiChain
I have a couple of questions.

1. If the data streams are not mined, then what's the point of having them ? any erroneous data can be added to them and it will stay there without any check and balance !

2. If the data streams are not validated by nodes, how are they any better than any distributed database ? It seems to me they are like glorified distributed databases and nothing more. they don't look like they have any of the blockchain functionality. Please elaborate this.
The data streams are certainly mined, but the stream filters are not applied by miners or other nodes at the time the transaction is created. So stream filters do not prevent a malicious node from publishing data. They just mean that data is hidden and flagged with an error when retrieved, and this will happen the same on every node which is retrieving that stream data.

If you want to perform strict validation of stream data at the time of writing, which is safe against malicious nodes, you can use a transaction filter to detect and verify the stream data inside transactions. But please note this cannot be used with off-chain stream items, since for those the data is not inside transactions.

Finally please note that data validation is only one way in which blockchains different from distributed databases. For example, blockchains have signatures on every transaction (and therefore every piece of data) and they do not allow one node to delete the data created by another.
"  blockchains have signatures on every transaction (and therefore every piece of data) and they do not allow one node to delete the data created by another. "

That is the immutablity principle, right ? that once the data is on the blockchain, you cannot change it or delete it, unless you wipe out every single node hosting that blockchain ?

Also, if i want to upgrade multichain, will my application's functionality be affected in any way ? I am afraid updating multichain cause issues with my application? can you confirm if you have made any significant changes in multichain software since MultiChain 1.0 beta 1 ?
Immutability is a bit more complex than that, but yes, the basic idea is that once data is on the chain, it is very difficult to tamper with it and requires a significant proportion of malicious nodes.

You should be safe to upgrade MultiChain 1.0 beta 1 to any later version, but we recommend making a backup of your blockchain directory first (while MultiChain is not running). If you want to experiment with 2.0 (alphas), please see the list of incompatible API changes at the bottom of this page: https://www.multichain.com/developers/multichain-2-0-preview-releases/
Thankyou, much appreciated.
"The data streams are certainly mined, but the stream filters are not applied by miners or other nodes at the time the transaction is created. So stream filters do not prevent a malicious node from publishing data. They just mean that data is hidden and flagged with an error when retrieved, and this will happen the same on every node which is retrieving that stream data"

That means data which is published in stream only can be verified by transaction filter not by stream filter right?
we can not see stream data has error or not while publishing , Is it?
If that is the case then no use of stream filter because at the time of retrieving stream data you will come to know that it is flagged with error...

and another thing is like when we create any filter and we run in our cli mode when it will compile and where does my filter rely and stored in network ?

As you are stating that miner node and any other node does not run any filters what does that mean please give some example so that i can understand more???

thanks
If you want to absolutely prevent bad stream data being published on the blockchain by malicious users who have modified the MultiChain software, you need to use on-chain data and a transaction filter.

You can use a stream filter if you can be satisfied with a lower level of security, where an unmodified version of MultiChain prevents publishing data that violates the filter, and also would flag any bad data when retrieving from the stream.

Filters are stored inside the blockchain itself and compiled and run by every node, in order to verify transactions or stream items.
so lets say i am running my admin node and in interactive mode when i run any filter code then that will be apply for every other node in network.......because if i compare it to ethereum where smart contract will be compiled and then deployed in network that would be stored in every node and applied for every node
Yes, it's like Ethereum in this respect. Every transaction filter is installed in the blockchain and run by every node on every transaction. It's effectively an additional transaction rule.
Installed in blockchain means install in every node connected to chain right
and whenever transaction comes in network then every node takes it and run through filter which is installed in their node correct!!
Yes, that is correct.
...