fabric-samples/asset-transfer-secured-agreement
Mark S. Lewis e23bc6714e Simplify Java client error-handling example
The latest fabric-gateway client API release (v1.7.0) includes the gRPC error
details in the GatewayExcetion stack trace so it is not necessary to
programmatically access them to demonstrate that they are present.

This change updates the asset-transfer-basic/application-gateway-java
sample to simplify the updateNonExistentAsset example method. It also:

- Updates all samples to use the latest fabric-gateway release.
- Adds equivalent Maven POM files for fabric-gateway application samples.

Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
2024-10-24 23:45:04 -04:00
..
application-gateway-typescript Simplify Java client error-handling example 2024-10-24 23:45:04 -04:00
chaincode-go Consistent Go version in go.mod and go.work files 2024-10-14 10:25:34 -04:00
README.md Remove legacy sample applications 2024-06-19 10:38:52 -04: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
    

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