fabric-samples/asset-transfer-secured-agreement
Dave Enyeart 75b8419113
Sample apps should exit code 1 upon failure (#1003)
Ensure that all sample applications return exit code 1 upon failure
so that github actions can report the failure.

Signed-off-by: David Enyeart <enyeart@us.ibm.com>
2023-03-17 13:18:18 +00:00
..
application-gateway-typescript Sample apps should exit code 1 upon failure (#1003) 2023-03-17 13:18:18 +00:00
application-javascript Update secured asset transfer sample (#781) 2022-07-13 14:09:14 -04:00
chaincode-go Update Go and Go dependencies (#996) 2023-03-07 14:44:33 +00:00
README.md updated and improved asset-transfer-secured-agreement sample (#751) 2022-05-26 13:42:01 +01:00

Asset transfer secured agreement sample

The asset transfer events sample demonstrates how to transfer a private asset between two organizations without publicly sharing data .

About the sample

This sample includes smart contract and application code in multiple languages. This sample shows how Fabric features state based endorsement, private data, and access control to provide secured transactions.

Application

Refer Secured asset transfer in Fabric for application details .

Smart Contract

The smart contract (in folder chaincode-go) implements the following functions to support the application:

  • CreateAsset
  • ChangePublicDescription
  • AgreeToSell
  • AgreeToBuy
  • VerifyAssetProperties
  • TransferAsset
  • ReadAsset
  • GetAssetPrivateProperties
  • GetAssetSalesPrice
  • GetAssetBidPrice
  • GetAssetHashId
  • QueryAssetSaleAgreements
  • QueryAssetBuyAgreements
  • QueryAssetHistory

Running the sample

Like other samples, the Fabric test network is used to deploy and run this sample. Follow these steps in order:

  1. Create the test network and a channel (from the test-network folder).

    ./network.sh up createChannel -c mychannel -ca
    
  2. Deploy the smart contract implementations.

    # To deploy the go chaincode implementation
    ./network.sh deployCC -ccn secured -ccp ../asset-transfer-secured-agreement/chaincode-go/ -ccl go -ccep "OR('Org1MSP.peer','Org2MSP.peer')"
    
  3. Run the application (from the asset-transfer-secured-agreement folder).

    # To run the Typescript sample application
    cd application-gateway-typescript
    npm install
    npm start
    
    # To run the Javascript sample application
    cd application-javascript
    node app.js
    

Clean up

When you are finished, you can bring down the test network (from the test-network folder). The command will remove all the nodes of the test network, and delete any ledger data that you created.

./network.sh down