问题
In case of Bitcoin transaction the verification/validation involves looking at the input UTXO balance etc...
But in Hyperledger the transaction (if I may) "just" carries the data (function name and data-string) for the target smart contract.
Does it mean that there is no necessity of validation (apart from the syntax) of the transaction? If yes what has to checked and against what? Can anyone pls give me an example use-case?
If there is no validation, then is my understanding correct that the blockchain is "just" a ledger without any verification on the transactions. If something goes wrong (which is human detected, e.g. account not settled) then we go back to the blockchain to read all the related transactions and spot why the money was not transacted?
回答1:
in HL v0.x, the consensus process 'validates' transactions in the sense that it orders transactions submitted at different peer nodes in the network into a global order. This consensus process is performed by the validating peers only, who use the PBFT protocol to ensure that there is a quorum of validating peers who get the same result for each transaction (i.e. the execution of a smart contract)- in a fairly involved set of message flows between them ("pre-prepare", "prepare", "commit" etc. (See more on PBFT in detail or summary).
If consensus is achieved, then each validating peer applies the transaction result at its node, otherwise the transaction is thrown out. Non-validating peers connected to these validating peers get the data and transaction updates replicated to them - they do not participate in the transaction process.
This whole process ensures that the ledger remains constant across all the peers (validating and non-validating), which of course is the meaning of consensus. In this way the double spend problem is avoided.
HL makes consensus a pluggable feature, so that in theory it's possible to have a different consensus model for different blockchains. That's quite tricky at the moment, but it remains a design principle. Note that the consensus mechanism doesn't affect how smart contracts are written, or the fact that the ledger remains consistent - it's a purely operational concern (but nonetheless important for that, of course).
Finally, there's work going on in HL v1 for a more sophisticated consensus protocol which includes which validating peers see which transactions.
来源:https://stackoverflow.com/questions/38991530/hyperledger-transaction-verification