Search code examples
hyperledger-fabrichyperledgerethereum

How transaction confirmation handles in Hyperledger


In ethereum blockchain, to confirm transaction it uses gas price, in bitcoin, transactions are confirmed by miners (if understood correctly) but when i read about transactions in hyperledger fabric i couldn't find explanation for how transaction confirmed.

What concept and mechanism used to confirm transactions in hyperledger fabric ?

Thanks in advance.


Solution

  • Unlike blockchains like ethereum and bitcoin, Fabric does not rely on miners or gas to provide incentive to validating transactions. Fabric's validation process is known as consensus. Because it is a permissioned blockchain (not accessible to anyone who hasn't been granted express permission to participate), and parties have an incentive to participate honestly in the network (because they have some business stake or otherwise in the success of the network) there is no need for gas or mining.

    For example, if you have a consortium of 20 banks each running a peer, and 10 of these banks are also endorsing peers, then every transaction is submitted to the peers for "endorsement". At the time of creating the network you also specified an endorsement policy. So lets say in this case your policy was 7of(org1,org2,org3...) meaning we need 7 of the 10 orgs to endorse the transaction for it to be valid. So we submit a transaction, and each endorsing peer simulates the transaction (its not added to the ledger at this time), they sign the result, and send it back. Once 7 of the peers reach the same value (known as reaching consensus) from the output of the smart contract, the transaction is then submitted for ordering and committal, where the transaction is validated again making sure the value of the result is the same as it was in simulation, and then it safe to commit.

    Since the 10 banks all share a financial business interest its in no one banks interest to manipulate the network (for fear of repercussions, whether financially or legal). Moreover, if you wanted to attack and take over the network, in this scenario you would have to compromise 7 of the 10 peers to achieve consensus.

    You can read about the fabric ordering service and consensus in our doc: https://hyperledger-fabric.readthedocs.io/en/release-2.0/orderer/ordering_service.html