fabric-samples/asset-transfer-secured-agreement
sapthasurendran 4681fe7865
Secured agreement samples using gateway (#630)
* initial commit

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

Code refactor

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

* readme

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

* lint fix

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

* adopted best practises

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

* code refactor

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

* updated azure pipeline to include the app

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

* mapped json and client object

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

* Moved contract interactions to contractWrapper

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

* salt value unexported

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

* moved try catch from contract wrapper to app

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

* contract wrapper refactor
moved interfaces from utils to contract wrapper

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

* exported data objects

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>
2022-05-23 14:17:10 +01:00
..
application-gateway-typescript Secured agreement samples using gateway (#630) 2022-05-23 14:17:10 +01:00
application-javascript * Made consistent lint command (#495) 2021-10-06 13:33:29 +01:00
chaincode-go Updates to asset-transfer-basic Gateway sample to align with docs (#553) 2021-12-09 10:20:52 +00:00
README.md Secured agreement samples using gateway (#630) 2022-05-23 14:17:10 +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
  • 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