If you call a constant function from a smart contract, that is, a function that just returns data without changing the state, is the return value trustless? I'm assuming not, because whatever node is giving you the return value could make anything up for the return value, as the return values don't have to be verified by all the other nodes since the transaction is never recorded in the blockchain. So I'm assuming the only way to get instant trustless data from the blockchain without running your own node is through merkle trees or something, but I don't believe Ethereum has support for light clients of that caliber yet.
1 Answer
You always need to connect to the blockchain through a node. Function calls to pure
and view
(these being the old constant
) are performed in your own node - or whoever's node you are using to connect to the blockchain.
Typically you connect with your own node, but you can (in theory) use whatever node is accessible for you. If you don't trust the node, you shouldn't trust its contents either. But typically this isn't an issue as you are querying your own node for the data and you know your own node to be honest.
So in the end it's all up to you what you decide to trust.