fabric-samples/asset-transfer-basic
Mark S. Lewis c077dae79c Update TypeScript implementations
- Dependency updates
- ESLint flat configuration format, replacing deprecated configuration
- Minor fixes to compile and lint issues
- Consistent TypeScript formatting with .editorconfig

Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
2024-06-18 06:51:58 -04:00
..
application-gateway-go Update Go gRPC dependency 2024-04-24 16:24:37 +09:00
application-gateway-java Read first client cert from cert directory 2024-03-04 09:50:43 -05:00
application-gateway-typescript Update TypeScript implementations 2024-06-18 06:51:58 -04:00
application-go asset-transfer-basic CI improvements (#998) 2023-03-07 09:43:10 +00:00
application-java Use latest v2.5 fabric-chaincode-java 2024-02-25 22:13:26 -05:00
application-javascript Fixes for build breakages 2023-09-19 13:08:40 -04:00
application-typescript Fixes for build breakages 2023-09-19 13:08:40 -04:00
application-typescript-hsm Fixes for build breakages 2023-09-19 13:08:40 -04:00
chaincode-external Fix docs and scripts for asset-transfer-basic as an external service 2024-04-11 15:24:37 -04:00
chaincode-go Update Go and Go dependencies (#996) 2023-03-07 14:44:33 +00:00
chaincode-java Update test dependencies for Java chaincode 2024-05-21 22:19:39 -04:00
chaincode-javascript Use more specific chaincode package versions 2024-06-14 00:24:08 -04:00
chaincode-typescript Update TypeScript implementations 2024-06-18 06:51:58 -04:00
rest-api-go Update Go gRPC dependency 2024-04-24 16:24:37 +09:00
rest-api-typescript Update TypeScript implementations 2024-06-18 06:51:58 -04:00
.gitignore Adding NodeJS app for asset-transfer-basic sample. (#206) 2020-06-30 15:36:47 -04:00
README.md Add README to asset-transfer-basic sample (#638) 2022-02-10 13:52:46 +00:00

Asset transfer basic sample

The asset transfer basic sample demonstrates:

  • Connecting a client application to a Fabric blockchain network.
  • Submitting smart contract transactions to update ledger state.
  • Evaluating smart contract transactions to query ledger state.
  • Handling errors in transaction invocation.

About the sample

This sample includes smart contract and application code in multiple languages. This sample shows create, read, update, transfer and delete of an asset.

For a more detailed walk-through of the application code and client API usage, refer to the Running a Fabric Application tutorial in the main Hyperledger Fabric documentation.

Application

Follow the execution flow in the client application code, and corresponding output on running the application. Pay attention to the sequence of:

  • Transaction invocations (console output like "--> Submit Transaction" and "--> Evaluate Transaction").
  • Results returned by transactions (console output like "*** Result").

Smart Contract

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

  • CreateAsset
  • ReadAsset
  • UpdateAsset
  • DeleteAsset
  • TransferAsset

Note that the asset transfer implemented by the smart contract is a simplified scenario, without ownership validation, meant only to demonstrate how to invoke transactions.

Running the sample

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 one of the smart contract implementations (from the test-network folder).

    # To deploy the TypeScript chaincode implementation
    ./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-typescript/ -ccl typescript
    
    # To deploy the Go chaincode implementation
    ./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-go/ -ccl go
    
    # To deploy the Java chaincode implementation
    ./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-java/ -ccl java
    
  3. Run the application (from the asset-transfer-basic folder).

    # To run the Typescript sample application
    cd application-gateway-typescript
    npm install
    npm start
    
    # To run the Go sample application
    cd application-gateway-go
    go run .
    
    # To run the Java sample application
    cd application-gateway-java
    ./gradlew run
    

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