npm audit reveals several high and one critical vulnerabilities in the dependencies: ansi-regex 4.0.0 - 4.1.0 Severity: high Inefficient Regular Expression Complexity in chalk/ansi-regex - https://github.com/advisories/GHSA-93q8-gq69-wqmw fix available via `npm audit fix` node_modules/nyc/node_modules/ansi-regex minimist <=1.2.5 Severity: critical Prototype Pollution in minimist - https://github.com/advisories/GHSA-xvch-5gv4-984h Prototype Pollution in minimist - https://github.com/advisories/GHSA-vh95-rmgr-6w4m fix available via `npm audit fix --force` Will install mocha@10.0.0, which is a breaking change node_modules/minimist node_modules/ts-node/node_modules/minimist mkdirp 0.4.1 - 0.5.1 Depends on vulnerable versions of minimist node_modules/mkdirp mocha 1.21.5 - 6.2.2 || 7.0.0-esm1 - 7.1.0 Depends on vulnerable versions of mkdirp node_modules/mocha protobufjs 6.11.0 - 6.11.2 Severity: high Prototype Pollution in protobufjs - https://github.com/advisories/GHSA-g954-5hwp-pp24 fix available via `npm audit fix` node_modules/protobufjs 5 vulnerabilities (2 moderate, 2 high, 1 critical) This change (from running npm audit fix --force) removes all of them: npm audit found 0 vulnerabilities Signed-off-by: Arnaud J Le Hors <lehors@us.ibm.com> |
||
|---|---|---|
| .. | ||
| application-gateway-go | ||
| application-gateway-java | ||
| application-gateway-typescript | ||
| application-go | ||
| application-java | ||
| application-javascript | ||
| application-typescript | ||
| application-typescript-hsm | ||
| chaincode-external | ||
| chaincode-go | ||
| chaincode-java | ||
| chaincode-javascript | ||
| chaincode-typescript | ||
| rest-api-typescript | ||
| .gitignore | ||
| README.md | ||
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:
-
Create the test network and a channel (from the
test-networkfolder)../network.sh up createChannel -c mychannel -ca -
Deploy one of the smart contract implementations (from the
test-networkfolder).# 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 -
Run the application (from the
asset-transfer-basicfolder).# 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