using APIs in fabric #fabric #fabric-questions #fabric-endorser


elmira
 

Hi,

 What kind of external services are we allowed to use in fabric? Can we use any APIs? Or we must just use fabric SDK.

 For example, an external service is a bank ATM API, and our transaction is calling the ATM withdrawal operation.

 We have defined in our policies that four endorsers must approve it. When the endorser nodes call that external service, are the withdrawal operations performed four times separately; and change the bank account's balance outside the blockchain each time? (so we have trouble in the commitment phase) How can we handle external calls?

I appreciate any help you can provide.


David Enyeart
 

Remember that chaincode execution is only a transaction simulation that builds a read/write set. The transaction doesn't get validated and committed until after it is ordered into a block. Therefore you don't want to call any external services that take action from a chaincode. Rather, your application can listen for the block commit events, and then take action for any validated and committed transactions.


"elmira" ---04/19/2021 07:54:35 AM---Hi, What kind of external services are we allowed to use in fabric? Can we use any APIs? Or we must

From: "elmira" <elmira.ebrahimi@...>
To: fabric@...
Date: 04/19/2021 07:54 AM
Subject: [EXTERNAL] [Hyperledger Fabric] using APIs in fabric #fabric-questions #fabric-endorser #fabric
Sent by: fabric@...





Hi,  What kind of external services are we allowed to use in fabric? Can we use any APIs? Or we must just use fabric SDK.  For example, an external service is a bank ATM API, and our transaction is calling the ATM withdrawal operation. ‍‍‍‍ZjQcmQRYFpfptBannerStart
This Message Is From an External Sender
This message came from outside your organization.
ZjQcmQRYFpfptBannerEnd
Hi,
 What kind of external services are we allowed to use in fabric? Can we use any APIs? Or we must just use fabric SDK.
 For example, an external service is a bank ATM API, and our transaction is calling the ATM withdrawal operation.
 We have defined in our policies that four endorsers must approve it. When the endorser nodes call that external service, are the withdrawal operations performed four times separately; and change the bank account's balance outside the blockchain each time? (so we have trouble in the commitment phase) How can we handle external calls?
I appreciate any help you can provide.





Mark Lewis
 

A good approach to achieve what Dave suggests is to use chaincode events to trigger business processes in response to committed transactions on the ledger. You emit an chaincode event from your smart contract transaction function, and this event is delivered to clients only after the transaction is successfully committed to the ledger.


The SDKs provide a "checkpointer" feature that can make it easier to resume listening from the same block/transaction position in the event of listener client application restart.