gvlax
gvlax

Reputation: 788

What are applications of an endorsement logic in hyperledger?

I am trying to understand the idea of a transactions endorsing by hyperledger peers.

While the example described in the Next-Consensus-Architecture-Proposal.md document about a required endorser set is quite straightforward, I wonder whether an endorsement logic can do, during Invoke calls on a chaincode, such things like the following example:

"if a value A is even and a value B is odd then return transaction_is_not_valid otherwise return transaction_is_valid " ?

(ref. chaincode_example0x) I am not sure if I correctly interpret the whole idea.

Upvotes: 0

Views: 570

Answers (1)

guillaume
guillaume

Reputation: 244

From Next-Consensus-Architecture-Proposal.md:

An endorsement shall be evaluated locally by every peer such that a peer does not need to interact with other peers, yet all correct peers evaluate the endorsement policy in the same way.

...

The assignment of stake in the previous example condition could be static (fixed in the metadata of the chaincode) or dynamic (e.g., dependent on the state of the chaincode and be modified during the execution).

=> Invoke transaction is forbidden but querying value of world state is possible. So the logic above could be expressed as an endorsement policy. However, I believe that endorsement policy is not supposed to hold state consistency logic and validity rules are better implemented inside the chaincode itself (and method invocation that violate it should be prevented by marking the transaction as invalid).

Upvotes: 1

Related Questions