├── .editorconfig ├── .github ├── actions │ ├── fsat-setup │ │ └── action.yaml │ └── test-network-setup │ │ └── action.yaml ├── dependabot.yml ├── settings.yml └── workflows │ ├── lint.yaml │ ├── rest-sample.yaml │ ├── test-fsat.yaml │ ├── test-network-basic.yaml │ ├── test-network-bft-orderer.yaml │ ├── test-network-events.yaml │ ├── test-network-hsm.yaml │ ├── test-network-k8s.yaml │ ├── test-network-ledger.yaml │ ├── test-network-off-chain.yaml │ ├── test-network-private.yaml │ ├── test-network-sbe.yaml │ └── test-network-secured.yaml ├── .gitignore ├── CHANGELOG.md ├── CODEOWNERS ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── MAINTAINERS.md ├── README.md ├── SECURITY.md ├── asset-transfer-abac ├── README.md └── chaincode-go │ ├── go.mod │ ├── go.sum │ ├── smart-contract │ └── abac.go │ └── smartContract.go ├── asset-transfer-basic ├── .gitignore ├── README.md ├── application-gateway-go │ ├── assetTransfer.go │ ├── go.mod │ └── go.sum ├── application-gateway-java │ ├── build.gradle │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── pom.xml │ ├── settings.gradle │ └── src │ │ └── main │ │ └── java │ │ └── App.java ├── application-gateway-javascript │ ├── .gitignore │ ├── .npmrc │ ├── eslint.config.mjs │ ├── package.json │ └── src │ │ └── app.js ├── application-gateway-typescript │ ├── .gitignore │ ├── .npmrc │ ├── eslint.config.mjs │ ├── package.json │ ├── src │ │ └── app.ts │ └── tsconfig.json ├── chaincode-external │ ├── .dockerignore │ ├── .gitignore │ ├── Dockerfile │ ├── README.md │ ├── assetTransfer.go │ ├── chaincode.env │ ├── chaincode1.env │ ├── chaincode2.env │ ├── connection.json │ ├── crypto │ │ └── .gitkeep │ ├── docker-compose-chaincode.yaml │ ├── go.mod │ ├── go.sum │ ├── metadata.json │ └── sampleBuilder │ │ └── bin │ │ ├── build │ │ ├── detect │ │ └── release ├── chaincode-go │ ├── assetTransfer.go │ ├── chaincode │ │ ├── mocks │ │ │ ├── chaincodestub.go │ │ │ ├── statequeryiterator.go │ │ │ └── transaction.go │ │ ├── smartcontract.go │ │ └── smartcontract_test.go │ ├── go.mod │ └── go.sum ├── chaincode-java │ ├── .gitattributes │ ├── .gitignore │ ├── Dockerfile │ ├── README.md │ ├── build.gradle │ ├── config │ │ └── checkstyle │ │ │ ├── checkstyle.xml │ │ │ └── suppressions.xml │ ├── docker │ │ └── docker-entrypoint.sh │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── settings.gradle │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── hyperledger │ │ │ └── fabric │ │ │ └── samples │ │ │ └── assettransfer │ │ │ ├── Asset.java │ │ │ └── AssetTransfer.java │ │ └── test │ │ └── java │ │ └── org │ │ └── hyperledger │ │ └── fabric │ │ └── samples │ │ └── assettransfer │ │ ├── AssetTest.java │ │ └── AssetTransferTest.java ├── chaincode-javascript │ ├── .eslintignore │ ├── .eslintrc.js │ ├── .gitignore │ ├── index.js │ ├── lib │ │ └── assetTransfer.js │ ├── npm-shrinkwrap.json │ ├── package.json │ └── test │ │ └── assetTransfer.test.js ├── chaincode-typescript │ ├── .dockerignore │ ├── .gitignore │ ├── Dockerfile │ ├── docker │ │ └── docker-entrypoint.sh │ ├── eslint.config.mjs │ ├── npm-shrinkwrap.json │ ├── package.json │ ├── src │ │ ├── asset.ts │ │ ├── assetTransfer.ts │ │ └── index.ts │ └── tsconfig.json ├── rest-api-go │ ├── .gitignore │ ├── README.md │ ├── go.mod │ ├── go.sum │ ├── main.go │ └── web │ │ ├── app.go │ │ ├── initialize.go │ │ ├── invoke.go │ │ └── query.go └── rest-api-typescript │ ├── .dockerignore │ ├── .editorconfig │ ├── .env.sample │ ├── .eslintrc.json │ ├── .gitignore │ ├── Dockerfile │ ├── README.md │ ├── demo.http │ ├── docker-compose.yaml │ ├── jest.config.ts │ ├── package-lock.json │ ├── package.json │ ├── scripts │ └── generateEnv.sh │ ├── src │ ├── __tests__ │ │ └── api.test.ts │ ├── assets.router.ts │ ├── auth.ts │ ├── config.spec.ts │ ├── config.ts │ ├── errors.spec.ts │ ├── errors.ts │ ├── fabric.spec.ts │ ├── fabric.ts │ ├── health.router.ts │ ├── index.ts │ ├── jobs.router.ts │ ├── jobs.spec.ts │ ├── jobs.ts │ ├── logger.ts │ ├── redis.spec.ts │ ├── redis.ts │ ├── server.ts │ └── transactions.router.ts │ └── tsconfig.json ├── asset-transfer-events ├── README.md ├── application-gateway-go │ ├── app.go │ ├── connect.go │ ├── go.mod │ └── go.sum ├── application-gateway-java │ ├── build.gradle │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── pom.xml │ ├── settings.gradle │ └── src │ │ └── main │ │ └── java │ │ ├── App.java │ │ └── Connections.java ├── application-gateway-typescript │ ├── .gitignore │ ├── .npmrc │ ├── eslint.config.mjs │ ├── package.json │ ├── src │ │ ├── app.ts │ │ └── connect.ts │ └── tsconfig.json ├── chaincode-go │ ├── assetTransferEvents.go │ ├── chaincode │ │ └── smartcontract.go │ ├── go.mod │ └── go.sum ├── chaincode-java │ ├── build.gradle │ ├── config │ │ └── checkstyle │ │ │ ├── checkstyle.xml │ │ │ └── suppressions.xml │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── settings.gradle │ └── src │ │ └── main │ │ └── java │ │ └── org │ │ └── hyperledger │ │ └── fabric │ │ └── samples │ │ └── events │ │ ├── Asset.java │ │ └── AssetTransfer.java └── chaincode-javascript │ ├── .eslintignore │ ├── .eslintrc.js │ ├── .gitignore │ ├── index.js │ ├── lib │ └── assetTransferEvents.js │ ├── npm-shrinkwrap.json │ ├── package.json │ └── test │ └── assetTransferEvents.test.js ├── asset-transfer-ledger-queries ├── application-java │ ├── .gitattributes │ ├── build.gradle │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── settings.gradle │ └── src │ │ └── main │ │ ├── java │ │ └── application │ │ │ └── java │ │ │ ├── App.java │ │ │ ├── EnrollAdmin.java │ │ │ └── RegisterUser.java │ │ └── resources │ │ └── log4j.properties ├── application-javascript │ ├── .eslintignore │ ├── .eslintrc.js │ ├── .gitignore │ ├── app.js │ └── package.json ├── chaincode-go │ ├── META-INF │ │ └── statedb │ │ │ └── couchdb │ │ │ └── indexes │ │ │ └── indexOwner.json │ ├── asset_transfer_ledger_chaincode.go │ ├── go.mod │ └── go.sum ├── chaincode-javascript │ ├── .eslintignore │ ├── .eslintrc.js │ ├── META-INF │ │ └── statedb │ │ │ └── couchdb │ │ │ └── indexes │ │ │ └── indexOwner.json │ ├── index.js │ ├── lib │ │ └── asset_transfer_ledger_chaincode.js │ ├── npm-shrinkwrap.json │ └── package.json └── chaincode-typescript │ ├── .gitignore │ ├── META-INF │ └── statedb │ │ └── couchdb │ │ └── indexes │ │ └── indexOwner.json │ ├── eslint.config.mjs │ ├── npm-shrinkwrap.json │ ├── package.json │ ├── src │ ├── asset.ts │ ├── assetTransferLedger.ts │ └── index.ts │ └── tsconfig.json ├── asset-transfer-private-data ├── README.md ├── application-gateway-go │ ├── app.go │ ├── connect.go │ ├── go.mod │ └── go.sum ├── application-gateway-typescript │ ├── .gitignore │ ├── .npmrc │ ├── README.md │ ├── eslint.config.mjs │ ├── package.json │ ├── src │ │ ├── app.ts │ │ └── connect.ts │ └── tsconfig.json ├── chaincode-go │ ├── META-INF │ │ └── statedb │ │ │ └── couchdb │ │ │ └── collections │ │ │ └── assetCollection │ │ │ └── indexes │ │ │ └── indexOwner.json │ ├── README.md │ ├── chaincode │ │ ├── asset_queries.go │ │ ├── asset_queries_test.go │ │ ├── asset_transfer.go │ │ ├── asset_transfer_test.go │ │ └── mocks │ │ │ ├── chaincodestub.go │ │ │ ├── clientIdentity.go │ │ │ ├── statequeryiterator.go │ │ │ └── transaction.go │ ├── collections_config.json │ ├── go.mod │ ├── go.sum │ └── main.go ├── chaincode-java │ ├── .gitattributes │ ├── META-INF │ │ └── statedb │ │ │ └── couchdb │ │ │ └── collections │ │ │ └── assetCollection │ │ │ └── indexes │ │ │ └── indexOwner.json │ ├── build.gradle │ ├── collections_config.json │ ├── config │ │ └── checkstyle │ │ │ ├── checkstyle.xml │ │ │ └── suppressions.xml │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── settings.gradle │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── hyperledger │ │ │ └── fabric │ │ │ └── samples │ │ │ └── privatedata │ │ │ ├── Asset.java │ │ │ ├── AssetPrivateDetails.java │ │ │ ├── AssetTransfer.java │ │ │ └── TransferAgreement.java │ │ └── test │ │ ├── java │ │ └── org │ │ │ └── hyperledger │ │ │ └── fabric │ │ │ └── samples │ │ │ └── privatedata │ │ │ └── AssetTransferTest.java │ │ └── resources │ │ └── mockito-extensions │ │ └── org.mockito.plugins.MockMaker └── chaincode-typescript │ ├── .dockerignore │ ├── .gitignore │ ├── Dockerfile │ ├── Readme.md │ ├── collections_config.json │ ├── docker │ └── docker-entrypoint.sh │ ├── eslint.config.mjs │ ├── npm-shrinkwrap.json │ ├── package.json │ ├── src │ ├── asset.ts │ ├── assetTransfer.ts │ ├── assetTransferDetails.ts │ ├── assetTransferTransientInput.ts │ ├── index.ts │ ├── transferAgreement.ts │ └── utils.ts │ └── tsconfig.json ├── asset-transfer-sbe ├── README.md ├── application-javascript │ ├── .eslintignore │ ├── .eslintrc.js │ ├── .gitignore │ ├── app.js │ └── package.json ├── chaincode-java │ ├── .gitattributes │ ├── .gitignore │ ├── build.gradle │ ├── config │ │ └── checkstyle │ │ │ ├── checkstyle.xml │ │ │ └── suppressions.xml │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── settings.gradle │ └── src │ │ └── main │ │ └── java │ │ └── org │ │ └── hyperledger │ │ └── fabric │ │ └── samples │ │ └── sbe │ │ ├── Asset.java │ │ └── AssetContract.java └── chaincode-typescript │ ├── .gitignore │ ├── eslint.config.mjs │ ├── npm-shrinkwrap.json │ ├── package.json │ ├── src │ ├── asset.ts │ ├── assetContract.ts │ └── index.ts │ └── tsconfig.json ├── asset-transfer-secured-agreement ├── README.md ├── application-gateway-typescript │ ├── .gitignore │ ├── eslint.config.mjs │ ├── package.json │ ├── src │ │ ├── app.ts │ │ ├── connect.ts │ │ ├── contractWrapper.ts │ │ └── utils.ts │ └── tsconfig.json └── chaincode-go │ ├── README.md │ ├── asset_transfer.go │ ├── asset_transfer_queries.go │ ├── go.mod │ └── go.sum ├── auction-dutch ├── README.md ├── application-javascript │ ├── .eslintignore │ ├── .eslintrc.js │ ├── bid.js │ ├── closeAuction.js │ ├── createAuction.js │ ├── endAuction.js │ ├── endAuctionwithAuditor.js │ ├── enrollAdmin.js │ ├── package.json │ ├── queryAuction.js │ ├── queryBid.js │ ├── registerEnrollUser.js │ ├── revealBid.js │ └── submitBid.js ├── chaincode-go-auditor │ ├── go.mod │ ├── go.sum │ ├── smart-contract │ │ ├── auction.go │ │ ├── auctionQueries.go │ │ └── utils.go │ └── smartContract.go └── chaincode-go │ ├── go.mod │ ├── go.sum │ ├── smart-contract │ ├── auction.go │ ├── auctionQueries.go │ └── utils.go │ └── smartContract.go ├── auction-simple ├── README.md ├── application-javascript │ ├── .eslintignore │ ├── .eslintrc.js │ ├── bid.js │ ├── closeAuction.js │ ├── createAuction.js │ ├── endAuction.js │ ├── enrollAdmin.js │ ├── package.json │ ├── queryAuction.js │ ├── queryBid.js │ ├── registerEnrollUser.js │ ├── revealBid.js │ └── submitBid.js └── chaincode-go │ ├── go.mod │ ├── go.sum │ ├── smart-contract │ ├── auction.go │ ├── auctionQueries.go │ └── utils.go │ └── smartContract.go ├── ci └── scripts │ ├── lint-go.sh │ ├── lint-java.sh │ ├── lint-javascript.sh │ ├── lint-shell.sh │ ├── lint-typescript.sh │ ├── lint.sh │ ├── run-k8s-test-network-basic.sh │ ├── run-test-network-basic.sh │ ├── run-test-network-events.sh │ ├── run-test-network-hsm.sh │ ├── run-test-network-ledger.sh │ ├── run-test-network-off-chain.sh │ ├── run-test-network-private.sh │ ├── run-test-network-sbe.sh │ └── run-test-network-secured.sh ├── full-stack-asset-transfer-guide ├── .gitignore ├── LICENSE ├── README.md ├── SETUP.md ├── applications │ ├── conga-cards │ │ ├── .eslintrc.js │ │ ├── .gitignore │ │ ├── .npmrc │ │ ├── README.md │ │ ├── assets │ │ │ ├── appleplectic.png │ │ │ ├── bananomatopoeia.png │ │ │ ├── block-norris.png │ │ │ ├── blockbert.png │ │ │ ├── count-blockula.png │ │ │ ├── darth-conga.png │ │ │ ├── no-pun-intended.png │ │ │ └── template.png │ │ ├── hooks │ │ │ └── captain-hook.json │ │ ├── images │ │ │ └── interaction.png │ │ ├── package.json │ │ ├── src │ │ │ ├── app.ts │ │ │ ├── commands │ │ │ │ ├── create.ts │ │ │ │ ├── delete.ts │ │ │ │ ├── discord.ts │ │ │ │ ├── getAllAssets.ts │ │ │ │ ├── index.ts │ │ │ │ ├── read.ts │ │ │ │ └── transfer.ts │ │ │ ├── config.ts │ │ │ ├── connect.ts │ │ │ ├── contract.ts │ │ │ ├── expectedError.ts │ │ │ └── utils.ts │ │ └── tsconfig.json │ ├── frontend │ │ ├── .browserslistrc │ │ ├── .editorconfig │ │ ├── .gitignore │ │ ├── Dockerfile │ │ ├── README.md │ │ ├── angular.json │ │ ├── karma.conf.js │ │ ├── package.json │ │ ├── screenshots │ │ │ ├── Create.png │ │ │ └── list.png │ │ ├── src │ │ │ ├── app │ │ │ │ ├── app-routing.module.ts │ │ │ │ ├── app.component.html │ │ │ │ ├── app.component.scss │ │ │ │ ├── app.component.spec.ts │ │ │ │ ├── app.component.ts │ │ │ │ ├── app.module.ts │ │ │ │ ├── asset-dialog │ │ │ │ │ ├── asset-dialog.component.html │ │ │ │ │ ├── asset-dialog.component.scss │ │ │ │ │ ├── asset-dialog.component.spec.ts │ │ │ │ │ └── asset-dialog.component.ts │ │ │ │ └── urls.ts │ │ │ ├── assets │ │ │ │ └── .gitkeep │ │ │ ├── environments │ │ │ │ ├── environment.prod.ts │ │ │ │ └── environment.ts │ │ │ ├── favicon.ico │ │ │ ├── index.html │ │ │ ├── main.ts │ │ │ ├── polyfills.ts │ │ │ ├── styles.scss │ │ │ └── test.ts │ │ ├── tsconfig.app.json │ │ ├── tsconfig.json │ │ └── tsconfig.spec.json │ ├── ping-chaincode │ │ ├── .gitignore │ │ ├── app.env │ │ ├── package.json │ │ ├── src │ │ │ ├── app.ts │ │ │ ├── fabric-connection-profile.ts │ │ │ └── jsonid-adapter.ts │ │ └── tsconfig.json │ ├── rest-api │ │ ├── .gitignore │ │ ├── Dockerfile │ │ ├── LICENSE │ │ ├── README.md │ │ ├── asset-transfer.postman_collection.json │ │ ├── deployment.yaml │ │ ├── package.json │ │ ├── renovate.json │ │ ├── src │ │ │ ├── app.ts │ │ │ ├── assets.router.ts │ │ │ ├── connection.ts │ │ │ └── server.ts │ │ └── tsconfig.json │ └── trader-typescript │ │ ├── .gitignore │ │ ├── .npmrc │ │ ├── README.md │ │ ├── eslint.config.mjs │ │ ├── package.json │ │ ├── src │ │ ├── app.ts │ │ ├── commands │ │ │ ├── create.ts │ │ │ ├── delete.ts │ │ │ ├── getAllAssets.ts │ │ │ ├── index.ts │ │ │ ├── listen.ts │ │ │ ├── read.ts │ │ │ ├── transact.ts │ │ │ └── transfer.ts │ │ ├── config.ts │ │ ├── connect.ts │ │ ├── contract.ts │ │ ├── expectedError.ts │ │ └── utils.ts │ │ └── tsconfig.json ├── check.sh ├── checks │ ├── check-chaincode.sh │ ├── check-kube.sh │ ├── check-network.sh │ └── utils.sh ├── contracts │ └── asset-transfer-typescript │ │ ├── .gitignore │ │ ├── .npmrc │ │ ├── Dockerfile │ │ ├── asset-transfer-chaincode-vars.yml │ │ ├── docker │ │ └── docker-entrypoint.sh │ │ ├── eslint.config.mjs │ │ ├── npm-shrinkwrap.json │ │ ├── package.json │ │ ├── src │ │ ├── asset.ts │ │ ├── assetTransfer.ts │ │ ├── index.ts │ │ └── untyped.d.ts │ │ └── tsconfig.json ├── docs │ ├── ApplicationDev │ │ ├── 01-FabricGateway-ES.md │ │ ├── 01-FabricGateway.md │ │ ├── 02-Exercise-RunApplication-ES.md │ │ ├── 02-Exercise-RunApplication.md │ │ ├── 03-ApplicationOverview-ES.md │ │ ├── 03-ApplicationOverview.md │ │ ├── 04-Exercise-AssetTransfer-ES.md │ │ ├── 04-Exercise-AssetTransfer.md │ │ ├── 05-ChaincodeEvents-ES.md │ │ ├── 05-ChaincodeEvents.md │ │ ├── 06-Exercise-ChaincodeEvents-ES.md │ │ ├── 06-Exercise-ChaincodeEvents.md │ │ └── README.md │ ├── CloudReady │ │ ├── 00-setup-zh.md │ │ ├── 00-setup.md │ │ ├── 10-kube-zh.md │ │ ├── 10-kube.md │ │ ├── 11-kube-multipass.md │ │ ├── 12-kube-ec2-vm.md │ │ ├── 13-kube-public-cloud.md │ │ ├── 20-fabric-zh.md │ │ ├── 20-fabric.md │ │ ├── 21-fabric-operations-console.md │ │ ├── 22-fabric-ansible-collection.md │ │ ├── 30-chaincode-zh.md │ │ ├── 30-chaincode.md │ │ ├── 31-fabric-ansible-chaincode.md │ │ ├── 40-bananas-zh.md │ │ ├── 40-bananas.md │ │ ├── 50-OpenShift-Deployment.md │ │ ├── 90-teardown.md │ │ └── README.md │ ├── SmartContractDev │ │ ├── 00-Introduction-ES.md │ │ ├── 00-Introduction.md │ │ ├── 01-Exercise-Getting-Started-ES.md │ │ ├── 01-Exercise-Getting-Started.md │ │ ├── 02-Exercise-Adding-tx-function-ES.md │ │ ├── 02-Exercise-Adding-tx-function.md │ │ ├── 03-Test-And-Debug-Reference-ES.md │ │ └── 03-Test-And-Debug-Reference.md │ ├── images │ │ ├── ApplicationDev.pptx │ │ ├── ApplicationDev │ │ │ ├── fabric-gateway-deployment.png │ │ │ ├── fabric-gateway-model.png │ │ │ ├── legacy-sdk-model.png │ │ │ └── transaction-submit-flow.png │ │ ├── CloudReady.pptx │ │ ├── CloudReady │ │ │ ├── 00-cloud-ready-2.png │ │ │ ├── 10-kube.png │ │ │ ├── 12-kube-ec2-vm.png │ │ │ ├── 20-fabric.png │ │ │ ├── 30-chaincode.png │ │ │ ├── 40-gateway-client-app.png │ │ │ └── kube-ec2-vm.png │ │ ├── cloud-vm-with-operator-network.png │ │ ├── multipass-operator-network.png │ │ ├── multipass-test-network.png │ │ └── readme_diagram.png │ └── tips-for-windows-dev.md ├── infrastructure │ ├── configuration │ │ ├── fabric-common-vars.yml │ │ ├── fabric-ordering-org-vars.yml │ │ ├── fabric-org1-vars.yml │ │ ├── fabric-org2-vars.yml │ │ ├── fabric-sail.yaml │ │ └── operator-console-vars.yml │ ├── ec2-cloud-config.yaml │ ├── fabric_network_playbooks │ │ ├── 00-complete.yml │ │ ├── 01-create-ordering-organization-components.yml │ │ ├── 02-create-endorsing-organization-components.yml │ │ ├── 05-enable-capabilities.yml │ │ ├── 06-add-organization-to-consortium.yml │ │ ├── 09-admins-policy.json.j2 │ │ ├── 09-create-channel.yml │ │ ├── 09-endorsement-policy.json.j2 │ │ ├── 09-lifecycle-endorsement-policy.json.j2 │ │ ├── 09-readers-policy.json.j2 │ │ ├── 09-writers-policy.json.j2 │ │ ├── 10-join-peer-to-channel.yml │ │ ├── 11-add-anchor-peer-to-channel.yml │ │ ├── 12-create-endorsing-organization-components.yml │ │ ├── 15-add-organization-to-channel.yml │ │ ├── 15-admins-policy.json.j2 │ │ ├── 15-endorsement-policy.json.j2 │ │ ├── 15-lifecycle-endorsement-policy.json.j2 │ │ ├── 15-readers-policy.json.j2 │ │ ├── 15-writers-policy.json.j2 │ │ ├── 16-import-ordering-service.yml │ │ ├── 17-join-peer-to-channel.yml │ │ └── 18-add-anchor-peer-to-channel.yml │ ├── kind_console_ingress │ │ ├── 90-KIND-ingress.yml │ │ └── templates │ │ │ ├── coredns │ │ │ └── coredns.yaml.j2 │ │ │ └── ingress │ │ │ ├── ingress-nginx-controller.yaml │ │ │ └── kustomization.yaml │ ├── kind_with_nginx.sh │ ├── multipass-cloud-config.yaml │ ├── operator_console_playbooks │ │ ├── 01-operator-install.yml │ │ └── 02-console-install.yml │ ├── pkgcc.sh │ ├── production_chaincode_playbooks │ │ ├── 19-install-and-approve-chaincode.yml │ │ ├── 20-install-and-approve-chaincode.yml │ │ ├── 21-commit-chaincode.yml │ │ ├── 22-register-application.yml │ │ └── asset-transfer_appid.json │ ├── sample-network │ │ ├── .gitignore │ │ ├── config │ │ │ ├── cas │ │ │ │ ├── kustomization.yaml │ │ │ │ ├── org0-ca.yaml │ │ │ │ ├── org1-ca.yaml │ │ │ │ └── org2-ca.yaml │ │ │ ├── configtx-template.yaml │ │ │ ├── console │ │ │ │ ├── hlf-operations-console.yaml │ │ │ │ └── kustomization.yaml │ │ │ ├── core.yaml │ │ │ ├── gateway │ │ │ │ ├── kustomization.yaml │ │ │ │ ├── org1-peer-gateway.yaml │ │ │ │ └── org2-peer-gateway.yaml │ │ │ ├── manager │ │ │ │ ├── fabric-operator-manager.yaml │ │ │ │ └── kustomization.yaml │ │ │ ├── orderers │ │ │ │ ├── kustomization.yaml │ │ │ │ └── org0-orderers.yaml │ │ │ ├── peers │ │ │ │ ├── kustomization.yaml │ │ │ │ ├── org1-peer1.yaml │ │ │ │ ├── org1-peer2.yaml │ │ │ │ ├── org2-peer1.yaml │ │ │ │ └── org2-peer2.yaml │ │ │ └── rbac │ │ │ │ ├── fabric-operator-clusterrole.yaml │ │ │ │ ├── fabric-operator-clusterrolebinding.yaml │ │ │ │ ├── fabric-operator-serviceaccount.yaml │ │ │ │ └── kustomization.yaml │ │ ├── network │ │ └── scripts │ │ │ ├── channel.sh │ │ │ ├── console.sh │ │ │ ├── frontend_build.sh │ │ │ ├── frontend_deployment.yaml │ │ │ ├── prereqs.sh │ │ │ ├── rest_deployment.yaml │ │ │ ├── rest_sample.sh │ │ │ ├── sample_network.sh │ │ │ └── utils.sh │ └── setup_storage_classes.sh ├── justfile └── tests │ ├── 00-chaincode-e2e.sh │ ├── 10-appdev-e2e.sh │ ├── 20-cloud-e2e.sh │ ├── 30-ansible-e2e.sh │ └── 40-console.sh ├── hardware-security-module ├── .gitignore ├── README.md ├── application-go │ ├── go.mod │ ├── go.sum │ └── hsm-sample.go ├── application-typescript │ ├── .gitignore │ ├── eslint.config.mjs │ ├── package.json │ ├── src │ │ └── hsm-sample.ts │ └── tsconfig.json ├── ca-client-config │ ├── .gitignore │ └── fabric-ca-client-config-template.yaml └── scripts │ └── generate-hsm-user.sh ├── high-throughput ├── README.md ├── application-go │ ├── .gitignore │ ├── app.go │ ├── functions │ │ ├── deletePrune.go │ │ ├── manyUpdates.go │ │ ├── query.go │ │ ├── update.go │ │ └── util.go │ ├── go.mod │ └── go.sum ├── chaincode-go │ ├── go.mod │ ├── go.sum │ └── high-throughput.go ├── networkDown.sh └── startFabric.sh ├── off_chain_data ├── README.md ├── application-go │ ├── app.go │ ├── connect.go │ ├── contract │ │ ├── contract.go │ │ └── model.go │ ├── getAllAssets.go │ ├── go.mod │ ├── go.sum │ ├── listen.go │ ├── parser │ │ ├── block.go │ │ ├── block_test.go │ │ ├── endorserTransaction.go │ │ ├── namespaceReadWriteSet.go │ │ ├── payload.go │ │ ├── readWriteSet.go │ │ └── transaction.go │ ├── store.go │ ├── transact.go │ └── utils.go ├── application-java │ ├── .gitignore │ ├── app │ │ ├── build.gradle │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ ├── App.java │ │ │ ├── Asset.java │ │ │ ├── AssetTransferBasic.java │ │ │ ├── BlockProcessor.java │ │ │ ├── Command.java │ │ │ ├── Connections.java │ │ │ ├── ExpectedException.java │ │ │ ├── GetAllAssets.java │ │ │ ├── Listen.java │ │ │ ├── Store.java │ │ │ ├── Transact.java │ │ │ ├── TransactApp.java │ │ │ ├── TransactionProcessor.java │ │ │ ├── Utils.java │ │ │ ├── Write.java │ │ │ └── parser │ │ │ ├── Block.java │ │ │ ├── BlockParser.java │ │ │ ├── NamespaceReadWriteSet.java │ │ │ ├── ParsedBlock.java │ │ │ ├── ParsedPayload.java │ │ │ ├── ParsedReadWriteSet.java │ │ │ ├── ParsedTransaction.java │ │ │ ├── ParsedTransactionAction.java │ │ │ ├── Transaction.java │ │ │ └── Utils.java │ ├── config │ │ └── checkstyle │ │ │ ├── checkstyle.xml │ │ │ └── java-copyright-header.txt │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ └── settings.gradle └── application-typescript │ ├── .gitignore │ ├── .npmrc │ ├── eslint.config.mjs │ ├── package.json │ ├── src │ ├── app.ts │ ├── blockParser.ts │ ├── connect.ts │ ├── contract.ts │ ├── expectedError.ts │ ├── getAllAssets.ts │ ├── listen.ts │ ├── transact.ts │ └── utils.ts │ └── tsconfig.json ├── test-application └── javascript │ ├── AppUtil.js │ └── CAUtil.js ├── test-network-k8s ├── .gitignore ├── README.md ├── config │ ├── org0 │ │ ├── bft │ │ │ └── configtx-template.yaml │ │ ├── configtx-template.yaml │ │ └── fabric-ca-server-config.yaml │ ├── org1 │ │ ├── core.yaml │ │ └── fabric-ca-server-config.yaml │ └── org2 │ │ ├── core.yaml │ │ └── fabric-ca-server-config.yaml ├── docs │ ├── APPLICATIONS.md │ ├── BFT_ORDERERS.md │ ├── CA.md │ ├── CALIPER.md │ ├── CHAINCODE.md │ ├── CHAINCODE_AS_A_SERVICE.md │ ├── CHANNELS.md │ ├── HIGH_AVAILABILITY.md │ ├── KUBERNETES.md │ ├── README.md │ ├── TEST_NETWORK.md │ └── images │ │ └── test-network.png ├── kube │ ├── application-deployment.yaml │ ├── fabric-builder-role.yaml │ ├── fabric-builder-rolebinding.yaml │ ├── fabric-rest-sample.yaml │ ├── ingress-nginx-k3s.yaml │ ├── ingress-nginx-kind.yaml │ ├── ns-test-network.yaml │ ├── org0 │ │ ├── org0-ca.yaml │ │ ├── org0-job-scrub-fabric-volumes.yaml │ │ ├── org0-orderer1.yaml │ │ ├── org0-orderer2.yaml │ │ ├── org0-orderer3.yaml │ │ ├── org0-orderer4.yaml │ │ └── org0-tls-cert-issuer.yaml │ ├── org1 │ │ ├── org1-ca.yaml │ │ ├── org1-cc-template.yaml │ │ ├── org1-install-k8s-builder.yaml │ │ ├── org1-job-scrub-fabric-volumes.yaml │ │ ├── org1-peer1.yaml │ │ ├── org1-peer2.yaml │ │ └── org1-tls-cert-issuer.yaml │ ├── org2 │ │ ├── org2-ca.yaml │ │ ├── org2-cc-template.yaml │ │ ├── org2-install-k8s-builder.yaml │ │ ├── org2-job-scrub-fabric-volumes.yaml │ │ ├── org2-peer1.yaml │ │ ├── org2-peer2.yaml │ │ └── org2-tls-cert-issuer.yaml │ ├── pvc-fabric-org0.yaml │ ├── pvc-fabric-org1.yaml │ ├── pvc-fabric-org2.yaml │ └── root-tls-cert-issuer.yaml ├── network └── scripts │ ├── application_connection.sh │ ├── appuser.id.template │ ├── ccp-template.json │ ├── chaincode.sh │ ├── channel.sh │ ├── cluster.sh │ ├── fabric_CAs.sh │ ├── fabric_config.sh │ ├── kind.sh │ ├── prereqs.sh │ ├── rest_sample.sh │ ├── set_anchor_peer.sh │ ├── test_network.sh │ └── utils.sh ├── test-network-nano-bash ├── .gitignore ├── README.md ├── bft-config │ └── configtx.yaml ├── ca │ ├── ca_config │ │ ├── ca │ │ │ └── fabric-ca-server-config.yaml │ │ └── tlsca │ │ │ └── fabric-ca-server-config.yaml │ ├── ca_utils.sh │ ├── ccp-generate.sh │ ├── ccp-template.json │ ├── ccp-template.yaml │ ├── config.yaml │ └── createEnrollments.sh ├── ca_terminal_setup.png ├── chaincode-external │ ├── connection.json │ └── metadata.json ├── chaincode_interaction.sh ├── configtx.yaml ├── configureExternalBuilders.sh ├── crypto-config.yaml ├── external_builders │ ├── core_yaml_change.yaml │ ├── golang │ │ └── bin │ │ │ ├── build │ │ │ ├── detect │ │ │ ├── release │ │ │ └── run │ └── node │ │ └── bin │ │ ├── build │ │ ├── detect │ │ ├── release │ │ └── run ├── generate_artifacts.sh ├── install&approve&commit_chaincode_peer1.sh ├── join_channel.sh ├── join_orderers.sh ├── network.sh ├── orderer1.sh ├── orderer2.sh ├── orderer3.sh ├── orderer4.sh ├── ordererca.sh ├── org1ca.sh ├── org2ca.sh ├── peer1.sh ├── peer1admin.sh ├── peer2.sh ├── peer2admin.sh ├── peer3.sh ├── peer3admin.sh ├── peer4.sh ├── peer4admin.sh └── terminal_setup.png ├── test-network ├── .gitignore ├── CHAINCODE_AS_A_SERVICE_TUTORIAL.md ├── README.md ├── addOrg3 │ ├── README.md │ ├── addOrg3.sh │ ├── ccp-generate.sh │ ├── ccp-template.json │ ├── ccp-template.yaml │ ├── compose │ │ ├── compose-ca-org3.yaml │ │ ├── compose-couch-org3.yaml │ │ ├── compose-org3.yaml │ │ ├── docker │ │ │ ├── docker-compose-ca-org3.yaml │ │ │ ├── docker-compose-couch-org3.yaml │ │ │ ├── docker-compose-org3.yaml │ │ │ └── peercfg │ │ │ │ └── core.yaml │ │ └── podman │ │ │ ├── peercfg │ │ │ └── core.yaml │ │ │ ├── podman-compose-ca-org3.yaml │ │ │ ├── podman-compose-couch-org3.yaml │ │ │ └── podman-compose-org3.yaml │ ├── configtx.yaml │ ├── fabric-ca │ │ ├── org3 │ │ │ └── fabric-ca-server-config.yaml │ │ └── registerEnroll.sh │ └── org3-crypto.yaml ├── bft-config │ └── configtx.yaml ├── compose │ ├── compose-bft-test-net.yaml │ ├── compose-ca.yaml │ ├── compose-couch.yaml │ ├── compose-test-net.yaml │ ├── docker │ │ ├── docker-compose-bft-test-net.yaml │ │ ├── docker-compose-ca.yaml │ │ ├── docker-compose-couch.yaml │ │ ├── docker-compose-test-net.yaml │ │ └── peercfg │ │ │ └── core.yaml │ └── podman │ │ ├── peercfg │ │ └── core.yaml │ │ ├── podman-compose-ca.yaml │ │ ├── podman-compose-couch.yaml │ │ └── podman-compose-test-net.yaml ├── configtx │ └── configtx.yaml ├── monitordocker.sh ├── network.config ├── network.sh ├── organizations │ ├── ccp-generate.sh │ ├── ccp-template.json │ ├── ccp-template.yaml │ ├── cfssl │ │ ├── admin-csr-template.json │ │ ├── ca-orderer.json │ │ ├── ca-peer.json │ │ ├── cert-signing-config.json │ │ ├── client-csr-template.json │ │ ├── orderer-csr-template.json │ │ ├── peer-csr-template.json │ │ └── registerEnroll.sh │ ├── cryptogen │ │ ├── crypto-config-orderer.yaml │ │ ├── crypto-config-org1.yaml │ │ └── crypto-config-org2.yaml │ └── fabric-ca │ │ ├── ordererOrg │ │ └── fabric-ca-server-config.yaml │ │ ├── org1 │ │ └── fabric-ca-server-config.yaml │ │ ├── org2 │ │ └── fabric-ca-server-config.yaml │ │ └── registerEnroll.sh ├── prometheus-grafana │ ├── README.md │ ├── docker-compose.yaml │ ├── grafana │ │ ├── config.monitoring │ │ └── provisioning │ │ │ ├── dashboards │ │ │ ├── dashboard.yml │ │ │ └── hlf-performances.json │ │ │ └── datasources │ │ │ └── datasource.yml │ ├── grafana_db │ │ └── grafana.db │ └── prometheus │ │ └── prometheus.yml ├── scripts │ ├── add_new_orderer_to_config.py │ ├── ccutils.sh │ ├── configUpdate.sh │ ├── createChannel.sh │ ├── deployCC.sh │ ├── deployCCAAS.sh │ ├── envVar.sh │ ├── orderer.sh │ ├── orderer2.sh │ ├── orderer3.sh │ ├── orderer4.sh │ ├── org3-scripts │ │ ├── joinChannel.sh │ │ └── updateChannelConfig.sh │ ├── packageCC.sh │ ├── pkgcc.sh │ ├── setAnchorPeer.sh │ └── utils.sh ├── setOrgEnv.sh └── system-genesis-block │ └── .gitkeep ├── token-erc-1155 ├── README.md └── chaincode-go │ ├── chaincode │ └── contract.go │ ├── erc1155.go │ ├── go.mod │ └── go.sum ├── token-erc-20 ├── README.md ├── chaincode-go │ ├── chaincode │ │ └── token_contract.go │ ├── go.mod │ ├── go.sum │ └── token_erc_20.go ├── chaincode-java │ ├── Dockerfile │ ├── build.gradle │ ├── config │ │ └── checkstyle │ │ │ ├── checkstyle.xml │ │ │ └── suppressions.xml │ ├── docker │ │ └── docker-entrypoint.sh │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── settings.gradle │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── hyperledger │ │ │ └── fabric │ │ │ └── samples │ │ │ └── erc20 │ │ │ ├── ContractConstants.java │ │ │ ├── ContractErrors.java │ │ │ ├── ERC20TokenContract.java │ │ │ ├── model │ │ │ ├── Approval.java │ │ │ └── Transfer.java │ │ │ └── utils │ │ │ └── ContractUtility.java │ │ └── test │ │ ├── java │ │ └── org │ │ │ └── hyperledger │ │ │ └── fabric │ │ │ └── samples │ │ │ └── erc20 │ │ │ └── TokenERC20ContractTest.java │ │ └── resources │ │ └── mockito-extensions │ │ └── org.mockito.plugins.MockMaker └── chaincode-javascript │ ├── .editorconfig │ ├── .eslintignore │ ├── .eslintrc.js │ ├── .gitignore │ ├── index.js │ ├── lib │ └── tokenERC20.js │ ├── npm-shrinkwrap.json │ ├── package.json │ └── test │ └── tokenERC20.test.js ├── token-erc-721 ├── README.md ├── chaincode-go │ ├── chaincode │ │ ├── erc721-contract.go │ │ ├── erc721-contract_test.go │ │ └── erc721.go │ ├── go.mod │ ├── go.sum │ └── main.go ├── chaincode-java │ ├── Dockerfile │ ├── build.gradle │ ├── config │ │ └── checkstyle │ │ │ ├── checkstyle.xml │ │ │ └── suppressions.xml │ ├── docker │ │ └── docker-entrypoint.sh │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── settings.gradle │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── hyperledger │ │ │ └── fabric │ │ │ └── samples │ │ │ └── erc721 │ │ │ ├── ContractConstants.java │ │ │ ├── ContractErrors.java │ │ │ ├── ERC721TokenContract.java │ │ │ ├── models │ │ │ ├── Approval.java │ │ │ ├── NFT.java │ │ │ └── Transfer.java │ │ │ └── utils │ │ │ └── ContractUtility.java │ │ └── test │ │ ├── java │ │ └── org │ │ │ └── hyperledger │ │ │ └── fabric │ │ │ └── samples │ │ │ └── erc721 │ │ │ └── ERC721TokenContractTest.java │ │ └── resources │ │ └── mockito-extensions │ │ └── org.mockito.plugins.MockMaker └── chaincode-javascript │ ├── .editorconfig │ ├── .eslintignore │ ├── .eslintrc.js │ ├── .gitignore │ ├── index.js │ ├── lib │ └── tokenERC721.js │ ├── npm-shrinkwrap.json │ ├── package.json │ └── test │ └── tokenERC721.test.js ├── token-sdk ├── .dockerignore ├── .gitignore ├── Dockerfile ├── README.md ├── auditor │ ├── conf │ │ └── core.yaml │ ├── go.mod │ ├── go.sum │ ├── main.go │ ├── oapi-server.yaml │ ├── routes │ │ ├── operations.go │ │ ├── routes.gen.go │ │ ├── routes.go │ │ └── server.go │ └── service │ │ ├── audit.go │ │ ├── balance.go │ │ └── history.go ├── components.png ├── compose-ca.yaml ├── dependencies.png ├── docker-compose.yaml ├── e2e │ ├── client.gen.go │ ├── e2e_test.go │ ├── go.mod │ ├── go.sum │ └── oapi-client.yaml ├── explorer │ ├── .env │ ├── config.json │ ├── connection-profile │ │ └── test-network.json │ └── docker-compose.yaml ├── go.work ├── go.work.sum ├── issuer │ ├── conf │ │ └── core.yaml │ ├── go.mod │ ├── go.sum │ ├── main.go │ ├── oapi-server.yaml │ ├── routes │ │ ├── operations.go │ │ ├── routes.gen.go │ │ ├── routes.go │ │ └── server.go │ └── service │ │ └── issue.go ├── owner │ ├── conf │ │ ├── owner1 │ │ │ └── core.yaml │ │ └── owner2 │ │ │ └── core.yaml │ ├── go.mod │ ├── go.sum │ ├── main.go │ ├── oapi-server.yaml │ ├── routes │ │ ├── operations.go │ │ ├── routes.gen.go │ │ ├── routes.go │ │ └── server.go │ └── service │ │ ├── accept.go │ │ ├── balance.go │ │ ├── history.go │ │ ├── redeem.go │ │ └── transfer.go ├── scripts │ ├── down.sh │ ├── enroll-users.sh │ └── up.sh ├── swagger.yaml ├── tokenchaincode │ └── Dockerfile └── transfer.png └── token-utxo ├── README.md └── chaincode-go ├── chaincode └── token_contract.go ├── go.mod ├── go.sum └── token_utxo.go /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | insert_final_newline = true 7 | trim_trailing_whitespace = true 8 | 9 | [*.{mj,cj,j,t}s] 10 | indent_size = 4 11 | quote_type = single 12 | 13 | [*.json] 14 | indent_size = 4 15 | 16 | [*.md] 17 | max_line_length = off 18 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "github-actions" 4 | directory: "/" 5 | schedule: 6 | interval: weekly 7 | -------------------------------------------------------------------------------- /.github/settings.yml: -------------------------------------------------------------------------------- 1 | repository: 2 | name: fabric-samples 3 | description: Samples for Hyperledger Fabric 4 | homepage: https://lf-hyperledger.atlassian.net/wiki/spaces/fabric 5 | default_branch: main 6 | has_downloads: true 7 | has_issues: true 8 | has_projects: false 9 | has_wiki: false 10 | archived: false 11 | private: false 12 | allow_squash_merge: true 13 | allow_merge_commit: false 14 | allow_rebase_merge: true 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Emacs backup files 2 | *~ 3 | *# 4 | .#* 5 | # Vim file artifacts 6 | .*.sw* 7 | .DS_Store 8 | .project 9 | # omit Go vendor directories 10 | vendor/ 11 | .vscode 12 | .gradle 13 | .idea 14 | # Dependency directories 15 | node_modules/ 16 | package-lock.json 17 | # Ignore Gradle build output directory 18 | build 19 | # Ignore Maven build output directory 20 | target 21 | 22 | # Eclipse 23 | .classpath 24 | .settings 25 | 26 | # installed Fabric binaries etc. 27 | /bin/ 28 | builders/ 29 | config/ 30 | external-chaincode/ 31 | install-fabric.sh 32 | 33 | # override the ignore of all config/ folders 34 | !full-stack-asset-transfer-guide/infrastructure/sample-network/config 35 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: Apache-2.0 2 | 3 | # Fabric Samples Maintainers 4 | * @hyperledger/fabric-samples-maintainers 5 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | Code of Conduct Guidelines 2 | ========================== 3 | 4 | Please review the Hyperledger [Code of 5 | Conduct](https://lf-hyperledger.atlassian.net/wiki/spaces/HYP/pages/19595281/Hyperledger+Code+of+Conduct) 6 | before participating. It is important that we keep things civil. 7 | 8 | Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License. 9 | -------------------------------------------------------------------------------- /asset-transfer-abac/chaincode-go/smartContract.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | */ 4 | 5 | package main 6 | 7 | import ( 8 | "log" 9 | 10 | "github.com/hyperledger/fabric-contract-api-go/v2/contractapi" 11 | abac "github.com/hyperledger/fabric-samples/asset-transfer-abac/chaincode-go/smart-contract" 12 | ) 13 | 14 | func main() { 15 | abacSmartContract, err := contractapi.NewChaincode(&abac.SmartContract{}) 16 | if err != nil { 17 | log.Panicf("Error creating abac chaincode: %v", err) 18 | } 19 | 20 | if err := abacSmartContract.Start(); err != nil { 21 | log.Panicf("Error starting abac chaincode: %v", err) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /asset-transfer-basic/.gitignore: -------------------------------------------------------------------------------- 1 | wallet 2 | !wallet/.gitkeep 3 | -------------------------------------------------------------------------------- /asset-transfer-basic/application-gateway-go/go.mod: -------------------------------------------------------------------------------- 1 | module assetTransfer 2 | 3 | go 1.23.0 4 | 5 | require ( 6 | github.com/hyperledger/fabric-gateway v1.7.0 7 | github.com/hyperledger/fabric-protos-go-apiv2 v0.3.4 8 | google.golang.org/grpc v1.71.0 9 | ) 10 | 11 | require ( 12 | github.com/miekg/pkcs11 v1.1.1 // indirect 13 | golang.org/x/crypto v0.32.0 // indirect 14 | golang.org/x/net v0.34.0 // indirect 15 | golang.org/x/sys v0.29.0 // indirect 16 | golang.org/x/text v0.21.0 // indirect 17 | google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f // indirect 18 | google.golang.org/protobuf v1.36.4 // indirect 19 | ) 20 | -------------------------------------------------------------------------------- /asset-transfer-basic/application-gateway-java/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/asset-transfer-basic/application-gateway-java/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /asset-transfer-basic/application-gateway-java/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /asset-transfer-basic/application-gateway-java/settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | * 4 | * The settings file is used to specify which projects to include in your build. 5 | * 6 | * Detailed information about configuring a multi-project build in Gradle can be found 7 | * in the user manual at https://docs.gradle.org/6.5/userguide/multi_project_builds.html 8 | */ 9 | 10 | rootProject.name = 'asset-transfer-basic' 11 | -------------------------------------------------------------------------------- /asset-transfer-basic/application-gateway-javascript/.gitignore: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | 5 | 6 | # Coverage directory used by tools like istanbul 7 | coverage 8 | 9 | # Dependency directories 10 | node_modules/ 11 | jspm_packages/ 12 | -------------------------------------------------------------------------------- /asset-transfer-basic/application-gateway-javascript/.npmrc: -------------------------------------------------------------------------------- 1 | engine-strict=true 2 | -------------------------------------------------------------------------------- /asset-transfer-basic/application-gateway-javascript/eslint.config.mjs: -------------------------------------------------------------------------------- 1 | import js from '@eslint/js'; 2 | import globals from 'globals'; 3 | 4 | export default [ 5 | js.configs.recommended, 6 | { 7 | languageOptions: { 8 | ecmaVersion: 2023, 9 | sourceType: 'commonjs', 10 | globals: { 11 | ...globals.node, 12 | }, 13 | }, 14 | }, 15 | ]; 16 | -------------------------------------------------------------------------------- /asset-transfer-basic/application-gateway-javascript/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "asset-transfer-basic", 3 | "version": "1.0.0", 4 | "description": "Asset Transfer Basic Application implemented in JavaScript using fabric-gateway", 5 | "engines": { 6 | "node": ">=18" 7 | }, 8 | "scripts": { 9 | "lint": "eslint src", 10 | "pretest": "npm run lint", 11 | "start": "node src/app.js" 12 | }, 13 | "engineStrict": true, 14 | "author": "Hyperledger", 15 | "license": "Apache-2.0", 16 | "dependencies": { 17 | "@grpc/grpc-js": "^1.12.2", 18 | "@hyperledger/fabric-gateway": "^1.7.0" 19 | }, 20 | "devDependencies": { 21 | "@eslint/js": "^9.5.0", 22 | "eslint": "^9.5.0", 23 | "globals": "^15.6.0" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /asset-transfer-basic/application-gateway-typescript/.gitignore: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | 5 | 6 | # Coverage directory used by tools like istanbul 7 | coverage 8 | 9 | # Dependency directories 10 | node_modules/ 11 | jspm_packages/ 12 | 13 | # Compiled TypeScript files 14 | dist 15 | -------------------------------------------------------------------------------- /asset-transfer-basic/application-gateway-typescript/.npmrc: -------------------------------------------------------------------------------- 1 | engine-strict=true 2 | -------------------------------------------------------------------------------- /asset-transfer-basic/application-gateway-typescript/eslint.config.mjs: -------------------------------------------------------------------------------- 1 | import js from '@eslint/js'; 2 | import tseslint from 'typescript-eslint'; 3 | 4 | export default tseslint.config(js.configs.recommended, ...tseslint.configs.strictTypeChecked, { 5 | languageOptions: { 6 | ecmaVersion: 2023, 7 | sourceType: 'module', 8 | parserOptions: { 9 | project: 'tsconfig.json', 10 | tsconfigRootDir: import.meta.dirname, 11 | }, 12 | }, 13 | }); 14 | -------------------------------------------------------------------------------- /asset-transfer-basic/application-gateway-typescript/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@tsconfig/node18/tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "declaration": true, 6 | "declarationMap": true, 7 | "sourceMap": true, 8 | "noUnusedLocals": true, 9 | "noImplicitReturns": true, 10 | "noUncheckedIndexedAccess": true, 11 | "forceConsistentCasingInFileNames": true 12 | }, 13 | "include": ["./src/**/*"], 14 | "exclude": ["./src/**/*.spec.ts"] 15 | } 16 | -------------------------------------------------------------------------------- /asset-transfer-basic/chaincode-external/.dockerignore: -------------------------------------------------------------------------------- 1 | chaincode.env* 2 | *.json 3 | *.md 4 | *.tar.gz 5 | *.tgz 6 | -------------------------------------------------------------------------------- /asset-transfer-basic/chaincode-external/.gitignore: -------------------------------------------------------------------------------- 1 | *.tar.gz 2 | *.tgz 3 | crypto/*.pem 4 | -------------------------------------------------------------------------------- /asset-transfer-basic/chaincode-external/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright IBM Corp. All Rights Reserved. 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | ARG GO_VER=1.23 6 | ARG ALPINE_VER=3.21 7 | 8 | FROM golang:${GO_VER}-alpine${ALPINE_VER} 9 | 10 | WORKDIR /go/src/github.com/hyperledger/fabric-samples/asset-transfer-basic/chaincode-external 11 | COPY . . 12 | 13 | RUN go get -d -v ./... 14 | RUN go install -v ./... 15 | 16 | EXPOSE 9999 17 | CMD ["chaincode-external"] 18 | -------------------------------------------------------------------------------- /asset-transfer-basic/chaincode-external/connection.json: -------------------------------------------------------------------------------- 1 | { 2 | "address": "asset-transfer-basic.org1.example.com:9999", 3 | "dial_timeout": "10s", 4 | "tls_required": false 5 | } 6 | -------------------------------------------------------------------------------- /asset-transfer-basic/chaincode-external/crypto/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/asset-transfer-basic/chaincode-external/crypto/.gitkeep -------------------------------------------------------------------------------- /asset-transfer-basic/chaincode-external/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "external", 3 | "label": "basic_1.0" 4 | } 5 | -------------------------------------------------------------------------------- /asset-transfer-basic/chaincode-external/sampleBuilder/bin/build: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | 5 | SOURCE=$1 6 | OUTPUT=$3 7 | 8 | #external chaincodes expect connection.json file in the chaincode package 9 | if [ ! -f "$SOURCE/connection.json" ]; then 10 | >&2 echo "$SOURCE/connection.json not found" 11 | exit 1 12 | fi 13 | 14 | #simply copy the endpoint information to specified output location 15 | cp $SOURCE/connection.json $OUTPUT/connection.json 16 | 17 | if [ -d "$SOURCE/metadata" ]; then 18 | cp -a $SOURCE/metadata $OUTPUT/metadata 19 | fi 20 | 21 | exit 0 22 | -------------------------------------------------------------------------------- /asset-transfer-basic/chaincode-external/sampleBuilder/bin/detect: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -euo pipefail 4 | 5 | METADIR=$2 6 | # check if the "type" field is set to "external" 7 | # crude way without jq which is not in the default fabric peer image 8 | TYPE=$(tr -d '\n' < "$METADIR/metadata.json" | awk -F':' '{ for (i = 1; i < NF; i++){ if ($i~/type/) { print $(i+1); break }}}'| cut -d\" -f2) 9 | 10 | if [ "$TYPE" = "external" ]; then 11 | exit 0 12 | fi 13 | 14 | exit 1 15 | -------------------------------------------------------------------------------- /asset-transfer-basic/chaincode-external/sampleBuilder/bin/release: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -euo pipefail 4 | 5 | BLD="$1" 6 | RELEASE="$2" 7 | 8 | if [ -d "$BLD/metadata" ]; then 9 | cp -a "$BLD/metadata/"* "$RELEASE/" 10 | fi 11 | 12 | #external chaincodes expect artifacts to be placed under "$RELEASE"/chaincode/server 13 | if [ -f $BLD/connection.json ]; then 14 | mkdir -p "$RELEASE"/chaincode/server 15 | cp $BLD/connection.json "$RELEASE"/chaincode/server 16 | 17 | #if tls_required is true, copy TLS files (using above example, the fully qualified path for these fils would be "$RELEASE"/chaincode/server/tls) 18 | 19 | exit 0 20 | fi 21 | 22 | exit 1 23 | -------------------------------------------------------------------------------- /asset-transfer-basic/chaincode-go/assetTransfer.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | */ 4 | 5 | package main 6 | 7 | import ( 8 | "log" 9 | 10 | "github.com/hyperledger/fabric-contract-api-go/v2/contractapi" 11 | "github.com/hyperledger/fabric-samples/asset-transfer-basic/chaincode-go/chaincode" 12 | ) 13 | 14 | func main() { 15 | assetChaincode, err := contractapi.NewChaincode(&chaincode.SmartContract{}) 16 | if err != nil { 17 | log.Panicf("Error creating asset-transfer-basic chaincode: %v", err) 18 | } 19 | 20 | if err := assetChaincode.Start(); err != nil { 21 | log.Panicf("Error starting asset-transfer-basic chaincode: %v", err) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /asset-transfer-basic/chaincode-java/.gitattributes: -------------------------------------------------------------------------------- 1 | # 2 | # https://help.github.com/articles/dealing-with-line-endings/ 3 | # 4 | # These are explicitly windows files and should use crlf 5 | *.bat text eol=crlf 6 | 7 | -------------------------------------------------------------------------------- /asset-transfer-basic/chaincode-java/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .gradle/ 3 | -------------------------------------------------------------------------------- /asset-transfer-basic/chaincode-java/README.md: -------------------------------------------------------------------------------- 1 | 2 | ## Basic Asset Transfer 3 | 4 | This sample implements the basic asset transfer scenario, illustrating the use of the Java Contract SDKs to provide a 5 | smart contract as a service. 6 | 7 | To run this chaincode contract locally on a development network, see: 8 | 9 | - [Debugging chaincode as a service](../../test-network-k8s/docs/CHAINCODE_AS_A_SERVICE.md) (Kube test network) 10 | - [End-to-end with the test-network](../../test-network/CHAINCODE_AS_A_SERVICE_TUTORIAL.md#end-to-end-with-the-the-test-network) (Docker compose) 11 | -------------------------------------------------------------------------------- /asset-transfer-basic/chaincode-java/config/checkstyle/suppressions.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /asset-transfer-basic/chaincode-java/docker/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | # 5 | set -euo pipefail 6 | : ${CORE_PEER_TLS_ENABLED:="false"} 7 | : ${DEBUG:="false"} 8 | 9 | if [ "${DEBUG,,}" = "true" ]; then 10 | exec java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:8000 -jar /chaincode.jar 11 | elif [ "${CORE_PEER_TLS_ENABLED,,}" = "true" ]; then 12 | exec java -jar /chaincode.jar # todo 13 | else 14 | exec java -jar /chaincode.jar 15 | fi 16 | 17 | -------------------------------------------------------------------------------- /asset-transfer-basic/chaincode-java/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/asset-transfer-basic/chaincode-java/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /asset-transfer-basic/chaincode-java/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /asset-transfer-basic/chaincode-java/settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | */ 4 | rootProject.name = System.getenv('CHAINCODE_NAME') ?: 'basic' -------------------------------------------------------------------------------- /asset-transfer-basic/chaincode-javascript/.eslintignore: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | 5 | coverage 6 | -------------------------------------------------------------------------------- /asset-transfer-basic/chaincode-javascript/.gitignore: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | 5 | # Coverage directory used by tools like istanbul 6 | coverage 7 | 8 | # Report cache used by istanbul 9 | .nyc_output 10 | 11 | # Dependency directories 12 | node_modules/ 13 | jspm_packages/ 14 | 15 | package-lock.json 16 | -------------------------------------------------------------------------------- /asset-transfer-basic/chaincode-javascript/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright IBM Corp. All Rights Reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | 'use strict'; 8 | 9 | const assetTransfer = require('./lib/assetTransfer'); 10 | 11 | module.exports.AssetTransfer = assetTransfer; 12 | module.exports.contracts = [assetTransfer]; 13 | -------------------------------------------------------------------------------- /asset-transfer-basic/chaincode-typescript/.dockerignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /asset-transfer-basic/chaincode-typescript/.gitignore: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | 5 | 6 | # Coverage directory used by tools like istanbul 7 | coverage 8 | 9 | # Dependency directories 10 | node_modules/ 11 | jspm_packages/ 12 | package-lock.json 13 | 14 | # Compiled TypeScript files 15 | dist 16 | 17 | -------------------------------------------------------------------------------- /asset-transfer-basic/chaincode-typescript/docker/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | # 5 | set -euo pipefail 6 | : ${CORE_PEER_TLS_ENABLED:="false"} 7 | : ${DEBUG:="false"} 8 | 9 | if [ "${DEBUG,,}" = "true" ]; then 10 | npm run start:server-debug 11 | elif [ "${CORE_PEER_TLS_ENABLED,,}" = "true" ]; then 12 | npm run start:server 13 | else 14 | npm run start:server-nontls 15 | fi 16 | 17 | -------------------------------------------------------------------------------- /asset-transfer-basic/chaincode-typescript/eslint.config.mjs: -------------------------------------------------------------------------------- 1 | import js from '@eslint/js'; 2 | import tseslint from 'typescript-eslint'; 3 | 4 | export default tseslint.config(js.configs.recommended, ...tseslint.configs.strictTypeChecked, { 5 | languageOptions: { 6 | ecmaVersion: 2023, 7 | sourceType: 'module', 8 | parserOptions: { 9 | project: 'tsconfig.json', 10 | tsconfigRootDir: import.meta.dirname, 11 | }, 12 | }, 13 | }); 14 | -------------------------------------------------------------------------------- /asset-transfer-basic/chaincode-typescript/src/asset.ts: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | */ 4 | 5 | import {Object, Property} from 'fabric-contract-api'; 6 | 7 | @Object() 8 | export class Asset { 9 | @Property() 10 | public docType?: string; 11 | 12 | @Property() 13 | public ID: string = ''; 14 | 15 | @Property() 16 | public Color: string = ''; 17 | 18 | @Property() 19 | public Size: number = 0; 20 | 21 | @Property() 22 | public Owner: string = ''; 23 | 24 | @Property() 25 | public AppraisedValue: number = 0; 26 | } 27 | -------------------------------------------------------------------------------- /asset-transfer-basic/chaincode-typescript/src/index.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | */ 4 | 5 | import {type Contract} from 'fabric-contract-api'; 6 | import {AssetTransferContract} from './assetTransfer'; 7 | 8 | export const contracts: typeof Contract[] = [AssetTransferContract]; 9 | -------------------------------------------------------------------------------- /asset-transfer-basic/chaincode-typescript/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "extends": "@tsconfig/node18/tsconfig.json", 4 | "compilerOptions": { 5 | "experimentalDecorators": true, 6 | "emitDecoratorMetadata": true, 7 | "declaration": true, 8 | "declarationMap": true, 9 | "sourceMap": true, 10 | "outDir": "dist", 11 | "strict": true, 12 | "noUnusedLocals": true, 13 | "noImplicitReturns": true, 14 | "forceConsistentCasingInFileNames": true 15 | }, 16 | "include": ["src/"] 17 | } 18 | -------------------------------------------------------------------------------- /asset-transfer-basic/rest-api-go/.gitignore: -------------------------------------------------------------------------------- 1 | Requests.http 2 | rest-api-go -------------------------------------------------------------------------------- /asset-transfer-basic/rest-api-go/go.mod: -------------------------------------------------------------------------------- 1 | module rest-api-go 2 | 3 | go 1.23.0 4 | 5 | require ( 6 | github.com/hyperledger/fabric-gateway v1.7.0 7 | google.golang.org/grpc v1.71.0 8 | ) 9 | 10 | require ( 11 | github.com/hyperledger/fabric-protos-go-apiv2 v0.3.4 // indirect 12 | github.com/miekg/pkcs11 v1.1.1 // indirect 13 | golang.org/x/crypto v0.32.0 // indirect 14 | golang.org/x/net v0.34.0 // indirect 15 | golang.org/x/sys v0.29.0 // indirect 16 | golang.org/x/text v0.21.0 // indirect 17 | google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f // indirect 18 | google.golang.org/protobuf v1.36.4 // indirect 19 | ) 20 | -------------------------------------------------------------------------------- /asset-transfer-basic/rest-api-go/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "rest-api-go/web" 6 | ) 7 | 8 | func main() { 9 | //Initialize setup for Org1 10 | cryptoPath := "../../test-network/organizations/peerOrganizations/org1.example.com" 11 | orgConfig := web.OrgSetup{ 12 | OrgName: "Org1", 13 | MSPID: "Org1MSP", 14 | CertPath: cryptoPath + "/users/User1@org1.example.com/msp/signcerts/cert.pem", 15 | KeyPath: cryptoPath + "/users/User1@org1.example.com/msp/keystore/", 16 | TLSCertPath: cryptoPath + "/peers/peer0.org1.example.com/tls/ca.crt", 17 | PeerEndpoint: "dns:///localhost:7051", 18 | GatewayPeer: "peer0.org1.example.com", 19 | } 20 | 21 | orgSetup, err := web.Initialize(orgConfig) 22 | if err != nil { 23 | fmt.Println("Error initializing setup for Org1: ", err) 24 | } 25 | web.Serve(web.OrgSetup(*orgSetup)) 26 | } 27 | -------------------------------------------------------------------------------- /asset-transfer-basic/rest-api-go/web/app.go: -------------------------------------------------------------------------------- 1 | package web 2 | 3 | import ( 4 | "fmt" 5 | "net/http" 6 | 7 | "github.com/hyperledger/fabric-gateway/pkg/client" 8 | ) 9 | 10 | // OrgSetup contains organization's config to interact with the network. 11 | type OrgSetup struct { 12 | OrgName string 13 | MSPID string 14 | CryptoPath string 15 | CertPath string 16 | KeyPath string 17 | TLSCertPath string 18 | PeerEndpoint string 19 | GatewayPeer string 20 | Gateway client.Gateway 21 | } 22 | 23 | // Serve starts http web server. 24 | func Serve(setups OrgSetup) { 25 | http.HandleFunc("/query", setups.Query) 26 | http.HandleFunc("/invoke", setups.Invoke) 27 | fmt.Println("Listening (http://localhost:3000/)...") 28 | if err := http.ListenAndServe(":3000", nil); err != nil { 29 | fmt.Println(err) 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /asset-transfer-basic/rest-api-go/web/query.go: -------------------------------------------------------------------------------- 1 | package web 2 | 3 | import ( 4 | "fmt" 5 | "net/http" 6 | ) 7 | 8 | // Query handles chaincode query requests. 9 | func (setup OrgSetup) Query(w http.ResponseWriter, r *http.Request) { 10 | fmt.Println("Received Query request") 11 | queryParams := r.URL.Query() 12 | chainCodeName := queryParams.Get("chaincodeid") 13 | channelID := queryParams.Get("channelid") 14 | function := queryParams.Get("function") 15 | args := r.URL.Query()["args"] 16 | fmt.Printf("channel: %s, chaincode: %s, function: %s, args: %s\n", channelID, chainCodeName, function, args) 17 | network := setup.Gateway.GetNetwork(channelID) 18 | contract := network.GetContract(chainCodeName) 19 | evaluateResponse, err := contract.EvaluateTransaction(function, args...) 20 | if err != nil { 21 | fmt.Fprintf(w, "Error: %s", err) 22 | return 23 | } 24 | fmt.Fprintf(w, "Response: %s", evaluateResponse) 25 | } 26 | -------------------------------------------------------------------------------- /asset-transfer-basic/rest-api-typescript/.dockerignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | npm-debug.log 3 | Dockerfile 4 | .gitignore 5 | -------------------------------------------------------------------------------- /asset-transfer-basic/rest-api-typescript/.editorconfig: -------------------------------------------------------------------------------- 1 | [*.ts] 2 | indent_size = 4 3 | quote_type = single 4 | -------------------------------------------------------------------------------- /asset-transfer-basic/rest-api-typescript/.env.sample: -------------------------------------------------------------------------------- 1 | # Sample .env file 2 | # 3 | # These are the minimum configuration variables required to start the sample 4 | # 5 | # See src/config.ts for details and for all the available configuration 6 | # variables 7 | # 8 | 9 | HLF_CONNECTION_PROFILE_ORG1= 10 | 11 | HLF_CERTIFICATE_ORG1= 12 | 13 | HLF_PRIVATE_KEY_ORG1= 14 | 15 | HLF_CONNECTION_PROFILE_ORG2= 16 | 17 | HLF_CERTIFICATE_ORG2= 18 | 19 | HLF_PRIVATE_KEY_ORG2= 20 | 21 | ORG1_APIKEY= 22 | 23 | ORG2_APIKEY= 24 | -------------------------------------------------------------------------------- /asset-transfer-basic/rest-api-typescript/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "node": true, 4 | "es2021": true 5 | }, 6 | "extends": [ 7 | "plugin:@typescript-eslint/recommended", 8 | "plugin:prettier/recommended" 9 | ], 10 | "parser": "@typescript-eslint/parser", 11 | "parserOptions": { 12 | "ecmaVersion": 12, 13 | "sourceType": "module" 14 | }, 15 | "plugins": [ 16 | "@typescript-eslint" 17 | ], 18 | "rules": { 19 | "@typescript-eslint/no-unused-vars": [ 20 | "error", 21 | { 22 | "argsIgnorePattern": "^_" 23 | } 24 | ] 25 | }, 26 | "overrides": [ 27 | { 28 | "files": ["src/**/*.ts"], 29 | "parserOptions": { 30 | "project": ["./tsconfig.json"] 31 | } 32 | } 33 | ] 34 | } 35 | -------------------------------------------------------------------------------- /asset-transfer-basic/rest-api-typescript/.gitignore: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | 5 | .env 6 | 7 | # Coverage directory used by tools like istanbul 8 | coverage 9 | 10 | # Dependency directories 11 | node_modules/ 12 | jspm_packages/ 13 | 14 | # Compiled TypeScript files 15 | dist 16 | -------------------------------------------------------------------------------- /asset-transfer-basic/rest-api-typescript/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:18-alpine3.14 AS build 2 | 3 | RUN apk add --no-cache g++ make python3 dumb-init 4 | 5 | WORKDIR /app 6 | 7 | COPY --chown=node:node . /app 8 | 9 | RUN npm ci 10 | RUN npm run build 11 | RUN npm prune --production 12 | 13 | FROM node:18-alpine3.14 14 | ENV NODE_ENV production 15 | WORKDIR /app 16 | 17 | COPY --from=build /usr/bin/dumb-init /usr/bin/dumb-init 18 | COPY --chown=node:node --from=build /app . 19 | 20 | EXPOSE 3000 21 | 22 | USER node 23 | 24 | ENTRYPOINT [ "dumb-init", "--", "npm", "run"] 25 | CMD ["start"] 26 | -------------------------------------------------------------------------------- /asset-transfer-basic/rest-api-typescript/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | # Replace network name with the fabric test-network name 3 | services: 4 | redis: 5 | image: 'redis' 6 | command: ['--maxmemory-policy','noeviction','--requirepass','${REDIS_PASSWORD}'] 7 | ports: 8 | - 6379:6379 9 | networks: 10 | - fabric_test 11 | 12 | nodeapp: 13 | image: 'ghcr.io/hyperledger/fabric-rest-sample:latest' 14 | command: ['start:dotenv'] 15 | ports: 16 | - 3000:3000 17 | env_file: 18 | - ./.env 19 | environment: 20 | - REDIS_PASSWORD 21 | networks: 22 | - fabric_test 23 | 24 | 25 | networks: 26 | fabric_test: 27 | external: true 28 | -------------------------------------------------------------------------------- /asset-transfer-basic/rest-api-typescript/src/logger.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | */ 4 | 5 | import pino from 'pino'; 6 | import * as config from './config'; 7 | 8 | export const logger = pino({ 9 | level: config.logLevel, 10 | }); 11 | -------------------------------------------------------------------------------- /asset-transfer-basic/rest-api-typescript/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "extends": "@tsconfig/node12/tsconfig.json", 4 | "compilerOptions": { 5 | "sourceMap": true, 6 | "outDir": "./dist" 7 | }, 8 | "include": [ 9 | "src/" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /asset-transfer-events/application-gateway-go/go.mod: -------------------------------------------------------------------------------- 1 | module assetTransfer 2 | 3 | go 1.23.0 4 | 5 | require ( 6 | github.com/hyperledger/fabric-gateway v1.7.0 7 | google.golang.org/grpc v1.71.0 8 | ) 9 | 10 | require ( 11 | github.com/hyperledger/fabric-protos-go-apiv2 v0.3.4 // indirect 12 | github.com/miekg/pkcs11 v1.1.1 // indirect 13 | golang.org/x/crypto v0.32.0 // indirect 14 | golang.org/x/net v0.34.0 // indirect 15 | golang.org/x/sys v0.29.0 // indirect 16 | golang.org/x/text v0.21.0 // indirect 17 | google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f // indirect 18 | google.golang.org/protobuf v1.36.4 // indirect 19 | ) 20 | -------------------------------------------------------------------------------- /asset-transfer-events/application-gateway-java/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | // Apply the application plugin to add support for building a CLI application. 3 | id 'application' 4 | } 5 | 6 | repositories { 7 | mavenCentral() 8 | } 9 | 10 | dependencies { 11 | implementation 'org.hyperledger.fabric:fabric-gateway:1.7.0' 12 | implementation platform('com.google.protobuf:protobuf-bom:4.28.2') 13 | implementation platform('io.grpc:grpc-bom:1.67.1') 14 | compileOnly 'io.grpc:grpc-api' 15 | runtimeOnly 'io.grpc:grpc-netty-shaded' 16 | implementation 'com.google.code.gson:gson:2.11.0' 17 | } 18 | 19 | java { 20 | toolchain { 21 | languageVersion = JavaLanguageVersion.of(11) 22 | } 23 | } 24 | 25 | application { 26 | // Define the main class for the application. 27 | mainClass = 'App' 28 | } 29 | -------------------------------------------------------------------------------- /asset-transfer-events/application-gateway-java/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/asset-transfer-events/application-gateway-java/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /asset-transfer-events/application-gateway-java/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /asset-transfer-events/application-gateway-java/settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | * 4 | * The settings file is used to specify which projects to include in your build. 5 | * 6 | * Detailed information about configuring a multi-project build in Gradle can be found 7 | * in the user manual at https://docs.gradle.org/6.5/userguide/multi_project_builds.html 8 | */ 9 | 10 | rootProject.name = 'asset-transfer-events' 11 | -------------------------------------------------------------------------------- /asset-transfer-events/application-gateway-typescript/.gitignore: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | 5 | 6 | # Coverage directory used by tools like istanbul 7 | coverage 8 | 9 | # Dependency directories 10 | node_modules/ 11 | jspm_packages/ 12 | 13 | # Compiled TypeScript files 14 | dist 15 | -------------------------------------------------------------------------------- /asset-transfer-events/application-gateway-typescript/.npmrc: -------------------------------------------------------------------------------- 1 | engine-strict=true 2 | -------------------------------------------------------------------------------- /asset-transfer-events/application-gateway-typescript/eslint.config.mjs: -------------------------------------------------------------------------------- 1 | import js from '@eslint/js'; 2 | import tseslint from 'typescript-eslint'; 3 | 4 | export default tseslint.config(js.configs.recommended, ...tseslint.configs.strictTypeChecked, { 5 | languageOptions: { 6 | ecmaVersion: 2023, 7 | sourceType: 'module', 8 | parserOptions: { 9 | project: 'tsconfig.json', 10 | tsconfigRootDir: import.meta.dirname, 11 | }, 12 | }, 13 | }); 14 | -------------------------------------------------------------------------------- /asset-transfer-events/application-gateway-typescript/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@tsconfig/node18/tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "declaration": true, 6 | "declarationMap": true, 7 | "sourceMap": true, 8 | "noUnusedLocals": true, 9 | "noImplicitReturns": true, 10 | "noUncheckedIndexedAccess": true, 11 | "forceConsistentCasingInFileNames": true 12 | }, 13 | "include": ["./src/**/*"], 14 | "exclude": ["./src/**/*.spec.ts"] 15 | } 16 | -------------------------------------------------------------------------------- /asset-transfer-events/chaincode-go/assetTransferEvents.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | */ 4 | 5 | package main 6 | 7 | import ( 8 | "log" 9 | 10 | "github.com/hyperledger/fabric-contract-api-go/v2/contractapi" 11 | "github.com/hyperledger/fabric-samples/asset-transfer-events/chaincode-go/chaincode" 12 | ) 13 | 14 | func main() { 15 | assetChaincode, err := contractapi.NewChaincode(&chaincode.SmartContract{}) 16 | if err != nil { 17 | log.Panicf("Error creating asset-transfer-events chaincode: %v", err) 18 | } 19 | 20 | if err := assetChaincode.Start(); err != nil { 21 | log.Panicf("Error starting asset-transfer-events chaincode: %v", err) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /asset-transfer-events/chaincode-java/config/checkstyle/suppressions.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /asset-transfer-events/chaincode-java/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/asset-transfer-events/chaincode-java/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /asset-transfer-events/chaincode-java/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /asset-transfer-events/chaincode-java/settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | */ 4 | 5 | rootProject.name = 'events' 6 | -------------------------------------------------------------------------------- /asset-transfer-events/chaincode-javascript/.eslintignore: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | 5 | coverage 6 | -------------------------------------------------------------------------------- /asset-transfer-events/chaincode-javascript/.gitignore: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | 5 | # Coverage directory used by tools like istanbul 6 | coverage 7 | 8 | # Report cache used by istanbul 9 | .nyc_output 10 | 11 | # Dependency directories 12 | node_modules/ 13 | jspm_packages/ 14 | 15 | package-lock.json 16 | -------------------------------------------------------------------------------- /asset-transfer-events/chaincode-javascript/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright IBM Corp. All Rights Reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | 'use strict'; 8 | 9 | const assetTransferEvents = require('./lib/assetTransferEvents'); 10 | 11 | module.exports.AssetTransferEvents = assetTransferEvents; 12 | module.exports.contracts = [assetTransferEvents]; 13 | -------------------------------------------------------------------------------- /asset-transfer-ledger-queries/application-java/.gitattributes: -------------------------------------------------------------------------------- 1 | # 2 | # https://help.github.com/articles/dealing-with-line-endings/ 3 | # 4 | # These are explicitly windows files and should use crlf 5 | *.bat text eol=crlf 6 | 7 | -------------------------------------------------------------------------------- /asset-transfer-ledger-queries/application-java/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/asset-transfer-ledger-queries/application-java/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /asset-transfer-ledger-queries/application-java/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /asset-transfer-ledger-queries/application-java/settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | * 4 | * The settings file is used to specify which projects to include in your build. 5 | * 6 | * Detailed information about configuring a multi-project build in Gradle can be found 7 | * in the user manual at https://docs.gradle.org/6.5/userguide/multi_project_builds.html 8 | */ 9 | 10 | rootProject.name = 'application-java' 11 | -------------------------------------------------------------------------------- /asset-transfer-ledger-queries/application-javascript/.eslintignore: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | 5 | coverage 6 | -------------------------------------------------------------------------------- /asset-transfer-ledger-queries/application-javascript/.gitignore: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | 5 | # Coverage directory used by tools like istanbul 6 | coverage 7 | 8 | # Dependency directories 9 | node_modules/ 10 | jspm_packages/ 11 | package-lock.json 12 | 13 | wallet 14 | !wallet/.gitkeep 15 | -------------------------------------------------------------------------------- /asset-transfer-ledger-queries/application-javascript/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "asset-transfer-ledger-queries", 3 | "version": "1.0.0", 4 | "description": "Asset transfer ledger queries application implemented in JavaScript", 5 | "engines": { 6 | "node": ">=12", 7 | "npm": ">=5" 8 | }, 9 | "engineStrict": true, 10 | "author": "Hyperledger", 11 | "license": "Apache-2.0", 12 | "scripts": { 13 | "run": "node app.js", 14 | "lint": "eslint *.js" 15 | }, 16 | "dependencies": { 17 | "fabric-ca-client": "^2.2.19", 18 | "fabric-network": "^2.2.19" 19 | }, 20 | "devDependencies": { 21 | "eslint": "^7.32.0" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /asset-transfer-ledger-queries/chaincode-go/META-INF/statedb/couchdb/indexes/indexOwner.json: -------------------------------------------------------------------------------- 1 | {"index":{"fields":["docType","owner"]},"ddoc":"indexOwnerDoc", "name":"indexOwner","type":"json"} 2 | -------------------------------------------------------------------------------- /asset-transfer-ledger-queries/chaincode-javascript/.eslintignore: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | 5 | coverage 6 | -------------------------------------------------------------------------------- /asset-transfer-ledger-queries/chaincode-javascript/META-INF/statedb/couchdb/indexes/indexOwner.json: -------------------------------------------------------------------------------- 1 | {"index":{"fields":["docType","owner"]},"ddoc":"indexOwnerDoc", "name":"indexOwner","type":"json"} 2 | -------------------------------------------------------------------------------- /asset-transfer-ledger-queries/chaincode-javascript/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright IBM Corp. All Rights Reserved. 3 | * 4 | * 5 | * SPDX-License-Identifier: Apache-2.0 6 | */ 7 | 8 | 'use strict'; 9 | 10 | const CC = require('./lib/asset_transfer_ledger_chaincode.js'); 11 | 12 | module.exports.CC = CC; 13 | module.exports.contracts = [ CC ]; 14 | -------------------------------------------------------------------------------- /asset-transfer-ledger-queries/chaincode-javascript/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "asset-transfer-ledger-queries", 3 | "version": "1.0.0", 4 | "description": "asset chaincode implemented in node.js", 5 | "main": "index.js", 6 | "engines": { 7 | "node": ">=18" 8 | }, 9 | "scripts": { 10 | "start": "fabric-chaincode-node start", 11 | "lint": "eslint *.js */**.js", 12 | "test": "" 13 | }, 14 | "engine-strict": true, 15 | "license": "Apache-2.0", 16 | "dependencies": { 17 | "fabric-contract-api": "~2.5", 18 | "fabric-shim": "~2.5" 19 | }, 20 | "devDependencies": { 21 | "eslint": "^8.57.0" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /asset-transfer-ledger-queries/chaincode-typescript/.gitignore: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | 5 | # Dependency directories 6 | node_modules/ 7 | package-lock.json 8 | 9 | # Compiled TypeScript files 10 | dist 11 | 12 | -------------------------------------------------------------------------------- /asset-transfer-ledger-queries/chaincode-typescript/META-INF/statedb/couchdb/indexes/indexOwner.json: -------------------------------------------------------------------------------- 1 | {"index":{"fields":["docType","owner"]},"ddoc":"indexOwnerDoc", "name":"indexOwner","type":"json"} 2 | -------------------------------------------------------------------------------- /asset-transfer-ledger-queries/chaincode-typescript/eslint.config.mjs: -------------------------------------------------------------------------------- 1 | import js from '@eslint/js'; 2 | import tseslint from 'typescript-eslint'; 3 | 4 | export default tseslint.config(js.configs.recommended, ...tseslint.configs.strictTypeChecked, { 5 | languageOptions: { 6 | ecmaVersion: 2023, 7 | sourceType: 'module', 8 | parserOptions: { 9 | project: 'tsconfig.json', 10 | tsconfigRootDir: import.meta.dirname, 11 | }, 12 | }, 13 | }); 14 | -------------------------------------------------------------------------------- /asset-transfer-ledger-queries/chaincode-typescript/src/index.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | */ 4 | 5 | import { type Contract } from 'fabric-contract-api'; 6 | import { AssetTransferContract } from './assetTransferLedger'; 7 | 8 | export const contracts: (typeof Contract)[] = [AssetTransferContract]; 9 | -------------------------------------------------------------------------------- /asset-transfer-ledger-queries/chaincode-typescript/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "extends": "@tsconfig/node18/tsconfig.json", 4 | "compilerOptions": { 5 | "experimentalDecorators": true, 6 | "emitDecoratorMetadata": true, 7 | "declaration": true, 8 | "declarationMap": true, 9 | "sourceMap": true, 10 | "outDir": "dist", 11 | "strict": true, 12 | "noUnusedLocals": true, 13 | "noImplicitReturns": true, 14 | "forceConsistentCasingInFileNames": true 15 | }, 16 | "include": ["src/"] 17 | } 18 | -------------------------------------------------------------------------------- /asset-transfer-private-data/application-gateway-go/go.mod: -------------------------------------------------------------------------------- 1 | module assetTransfer 2 | 3 | go 1.23.0 4 | 5 | require ( 6 | github.com/hyperledger/fabric-gateway v1.6.0 7 | github.com/hyperledger/fabric-protos-go-apiv2 v0.3.3 8 | google.golang.org/grpc v1.71.0 9 | ) 10 | 11 | require ( 12 | github.com/miekg/pkcs11 v1.1.1 // indirect 13 | golang.org/x/crypto v0.32.0 // indirect 14 | golang.org/x/net v0.34.0 // indirect 15 | golang.org/x/sys v0.29.0 // indirect 16 | golang.org/x/text v0.21.0 // indirect 17 | google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f // indirect 18 | google.golang.org/protobuf v1.36.4 // indirect 19 | ) 20 | -------------------------------------------------------------------------------- /asset-transfer-private-data/application-gateway-typescript/.gitignore: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | 5 | 6 | # Coverage directory used by tools like istanbul 7 | coverage 8 | 9 | # Dependency directories 10 | node_modules/ 11 | jspm_packages/ 12 | 13 | # Compiled TypeScript files 14 | dist 15 | -------------------------------------------------------------------------------- /asset-transfer-private-data/application-gateway-typescript/.npmrc: -------------------------------------------------------------------------------- 1 | engine-strict=true 2 | -------------------------------------------------------------------------------- /asset-transfer-private-data/application-gateway-typescript/README.md: -------------------------------------------------------------------------------- 1 | # Asset Transfer Private Data Sample 2 | 3 | This app uses fabric-samples/test-network based setup and the companion chaincode asset-transfer-private-data/chaincode-go/ with chaincode endorsement policy as "OR('Org1MSP.peer','Org2MSP.peer')" 4 | 5 | For this usecase illustration, we will use both Org1 & Org2 client identity from this same app 6 | In real world the Org1 & Org2 identity will be used in different apps to achieve asset transfer. 7 | 8 | For more details refer: 9 | https://hyperledger-fabric.readthedocs.io/en/release-2.4/private_data_tutorial.html#pd-use-case 10 | 11 | -------------------------------------------------------------------------------- /asset-transfer-private-data/application-gateway-typescript/eslint.config.mjs: -------------------------------------------------------------------------------- 1 | import js from '@eslint/js'; 2 | import tseslint from 'typescript-eslint'; 3 | 4 | export default tseslint.config(js.configs.recommended, ...tseslint.configs.strictTypeChecked, { 5 | languageOptions: { 6 | ecmaVersion: 2023, 7 | sourceType: 'module', 8 | parserOptions: { 9 | project: 'tsconfig.json', 10 | tsconfigRootDir: import.meta.dirname, 11 | }, 12 | }, 13 | }); 14 | -------------------------------------------------------------------------------- /asset-transfer-private-data/application-gateway-typescript/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@tsconfig/node18/tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "declaration": true, 6 | "declarationMap": true, 7 | "sourceMap": true, 8 | "noUnusedLocals": true, 9 | "noImplicitReturns": true, 10 | "noUncheckedIndexedAccess": true, 11 | "forceConsistentCasingInFileNames": true 12 | }, 13 | "include": ["./src/**/*"], 14 | "exclude": ["./src/**/*.spec.ts"] 15 | } 16 | -------------------------------------------------------------------------------- /asset-transfer-private-data/chaincode-go/META-INF/statedb/couchdb/collections/assetCollection/indexes/indexOwner.json: -------------------------------------------------------------------------------- 1 | { 2 | "index": { 3 | "fields": [ 4 | "objectType", 5 | "owner" 6 | ] 7 | }, 8 | "ddoc": "indexOwnerDoc", 9 | "name": "indexOwner", 10 | "type": "json" 11 | } 12 | 13 | -------------------------------------------------------------------------------- /asset-transfer-private-data/chaincode-go/README.md: -------------------------------------------------------------------------------- 1 | [Using Private Data tutorial](https://hyperledger-fabric.readthedocs.io/en/latest/private_data_tutorial.html) 2 | -------------------------------------------------------------------------------- /asset-transfer-private-data/chaincode-go/main.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | */ 4 | 5 | package main 6 | 7 | import ( 8 | "log" 9 | 10 | "github.com/hyperledger/fabric-contract-api-go/v2/contractapi" 11 | "github.com/hyperledger/fabric-samples/asset-transfer-private-data/chaincode-go/chaincode" 12 | ) 13 | 14 | func main() { 15 | assetChaincode, err := contractapi.NewChaincode(&chaincode.SmartContract{}) 16 | if err != nil { 17 | log.Panicf("Error creating asset-transfer-private-data chaincode: %v", err) 18 | } 19 | 20 | if err := assetChaincode.Start(); err != nil { 21 | log.Panicf("Error starting asset-transfer-private-data chaincode: %v", err) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /asset-transfer-private-data/chaincode-java/.gitattributes: -------------------------------------------------------------------------------- 1 | # 2 | # https://help.github.com/articles/dealing-with-line-endings/ 3 | # 4 | # These are explicitly windows files and should use crlf 5 | *.bat text eol=crlf 6 | 7 | -------------------------------------------------------------------------------- /asset-transfer-private-data/chaincode-java/META-INF/statedb/couchdb/collections/assetCollection/indexes/indexOwner.json: -------------------------------------------------------------------------------- 1 | { 2 | "index": { 3 | "fields": [ 4 | "objectType", 5 | "owner" 6 | ] 7 | }, 8 | "ddoc": "indexOwnerDoc", 9 | "name": "indexOwner", 10 | "type": "json" 11 | } 12 | -------------------------------------------------------------------------------- /asset-transfer-private-data/chaincode-java/config/checkstyle/suppressions.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /asset-transfer-private-data/chaincode-java/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/asset-transfer-private-data/chaincode-java/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /asset-transfer-private-data/chaincode-java/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /asset-transfer-private-data/chaincode-java/settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | */ 4 | 5 | rootProject.name = 'private' 6 | -------------------------------------------------------------------------------- /asset-transfer-private-data/chaincode-java/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker: -------------------------------------------------------------------------------- 1 | mock-maker-inline 2 | -------------------------------------------------------------------------------- /asset-transfer-private-data/chaincode-typescript/.dockerignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /asset-transfer-private-data/chaincode-typescript/.gitignore: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | 5 | 6 | # Coverage directory used by tools like istanbul 7 | coverage 8 | 9 | # Dependency directories 10 | node_modules/ 11 | jspm_packages/ 12 | package-lock.json 13 | 14 | # Compiled TypeScript files 15 | dist 16 | 17 | -------------------------------------------------------------------------------- /asset-transfer-private-data/chaincode-typescript/Readme.md: -------------------------------------------------------------------------------- 1 | ## Usage 2 | This chaincode written for Hyperledger Fabric private data tutorial(https://hyperledger-fabric.readthedocs.io/en/latest/private_data_tutorial.html). 3 | 4 | ### Deploy chaincode with: 5 | 1. ``` cd fabric-samples/asset-transfer-private-data/chaincode-typescript/ ``` 6 | 2. ``` npm install ``` 7 | 3. ``` npm run build ``` 8 | 4. ``` cd fabric-samples/test-network/ ``` 9 | 5. ``` ./network.sh deployCC -ccn private -ccp ../asset-transfer-private-data/chaincode-typescript/ -ccl typescript -ccep "OR('Org1MSP.peer','Org2MSP.peer')" -cccg ../asset-transfer-private-data/chaincode-typescript/collections_config.json ``` -------------------------------------------------------------------------------- /asset-transfer-private-data/chaincode-typescript/docker/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | # 5 | set -euo pipefail 6 | : ${CORE_PEER_TLS_ENABLED:="false"} 7 | : ${DEBUG:="false"} 8 | 9 | if [ "${DEBUG,,}" = "true" ]; then 10 | npm run start:server-debug 11 | elif [ "${CORE_PEER_TLS_ENABLED,,}" = "true" ]; then 12 | npm run start:server 13 | else 14 | npm run start:server-nontls 15 | fi 16 | 17 | -------------------------------------------------------------------------------- /asset-transfer-private-data/chaincode-typescript/eslint.config.mjs: -------------------------------------------------------------------------------- 1 | import js from '@eslint/js'; 2 | import tseslint from 'typescript-eslint'; 3 | 4 | export default tseslint.config(js.configs.recommended, ...tseslint.configs.strictTypeChecked, { 5 | languageOptions: { 6 | ecmaVersion: 2023, 7 | sourceType: 'module', 8 | parserOptions: { 9 | project: 'tsconfig.json', 10 | tsconfigRootDir: import.meta.dirname, 11 | }, 12 | }, 13 | }); 14 | -------------------------------------------------------------------------------- /asset-transfer-private-data/chaincode-typescript/src/index.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | */ 4 | 5 | import { type Contract } from 'fabric-contract-api'; 6 | import {AssetTransfer} from './assetTransfer'; 7 | 8 | export {AssetTransfer} from './assetTransfer'; 9 | 10 | export const contracts: typeof Contract[] = [AssetTransfer]; 11 | -------------------------------------------------------------------------------- /asset-transfer-private-data/chaincode-typescript/src/transferAgreement.ts: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | */ 4 | 5 | import { Object, Property } from "fabric-contract-api"; 6 | 7 | @Object() 8 | // TransferAgreement describes the buyer agreement returned by ReadTransferAgreement 9 | export class TransferAgreement { 10 | @Property() 11 | ID: string = ""; 12 | @Property() 13 | BuyerID: string = ""; 14 | } 15 | -------------------------------------------------------------------------------- /asset-transfer-private-data/chaincode-typescript/src/utils.ts: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | */ 4 | 5 | export function nonEmptyString(arg: unknown, errorMessage: string): string { 6 | if (typeof arg !== "string" || arg.length === 0) { 7 | throw new Error(errorMessage); 8 | } 9 | 10 | return arg; 11 | } 12 | 13 | export function positiveNumber(arg: unknown, errorMessage: string): number { 14 | if (typeof arg !== "number" || arg < 1) { 15 | throw new Error(errorMessage); 16 | } 17 | 18 | return arg; 19 | } 20 | -------------------------------------------------------------------------------- /asset-transfer-private-data/chaincode-typescript/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "extends": "@tsconfig/node18/tsconfig.json", 4 | "compilerOptions": { 5 | "experimentalDecorators": true, 6 | "emitDecoratorMetadata": true, 7 | "declaration": true, 8 | "declarationMap": true, 9 | "sourceMap": true, 10 | "outDir": "dist", 11 | "strict": true, 12 | "noUnusedLocals": true, 13 | "noImplicitReturns": true, 14 | "forceConsistentCasingInFileNames": true 15 | }, 16 | "include": ["src/"] 17 | } 18 | -------------------------------------------------------------------------------- /asset-transfer-sbe/application-javascript/.eslintignore: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | 5 | coverage 6 | -------------------------------------------------------------------------------- /asset-transfer-sbe/application-javascript/.gitignore: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | 5 | # Coverage directory used by tools like istanbul 6 | coverage 7 | 8 | # Dependency directories 9 | node_modules/ 10 | jspm_packages/ 11 | package-lock.json 12 | 13 | wallet 14 | !wallet/.gitkeep 15 | -------------------------------------------------------------------------------- /asset-transfer-sbe/application-javascript/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "asset-transfer-sbe", 3 | "version": "1.0.0", 4 | "description": "Asset transfer state based endorsement application implemented in JavaScript", 5 | "engines": { 6 | "node": ">=12", 7 | "npm": ">=5" 8 | }, 9 | "engineStrict": true, 10 | "author": "Hyperledger", 11 | "license": "Apache-2.0", 12 | "scripts": { 13 | "lint": "eslint *.js" 14 | }, 15 | "dependencies": { 16 | "fabric-ca-client": "^2.2.19", 17 | "fabric-network": "^2.2.19" 18 | }, 19 | "devDependencies": { 20 | "eslint": "^7.32.0" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /asset-transfer-sbe/chaincode-java/.gitattributes: -------------------------------------------------------------------------------- 1 | # 2 | # https://help.github.com/articles/dealing-with-line-endings/ 3 | # 4 | # These are explicitly windows files and should use crlf 5 | *.bat text eol=crlf 6 | 7 | -------------------------------------------------------------------------------- /asset-transfer-sbe/chaincode-java/.gitignore: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | 5 | /.classpath 6 | /.gradle/ 7 | /.project 8 | /.settings/ 9 | /bin/ 10 | /build/ 11 | -------------------------------------------------------------------------------- /asset-transfer-sbe/chaincode-java/config/checkstyle/suppressions.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /asset-transfer-sbe/chaincode-java/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/asset-transfer-sbe/chaincode-java/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /asset-transfer-sbe/chaincode-java/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /asset-transfer-sbe/chaincode-java/settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | */ 4 | 5 | rootProject.name = 'sbe' 6 | -------------------------------------------------------------------------------- /asset-transfer-sbe/chaincode-typescript/.gitignore: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | 5 | # Coverage directory used by tools like istanbul 6 | coverage 7 | 8 | # Dependency directories 9 | node_modules/ 10 | jspm_packages/ 11 | package-lock.json 12 | 13 | # Compiled TypeScript files 14 | dist 15 | 16 | # Editor Config 17 | .editorconfig 18 | 19 | # npm ignore 20 | .npmignore 21 | -------------------------------------------------------------------------------- /asset-transfer-sbe/chaincode-typescript/eslint.config.mjs: -------------------------------------------------------------------------------- 1 | import js from '@eslint/js'; 2 | import tseslint from 'typescript-eslint'; 3 | 4 | export default tseslint.config(js.configs.recommended, ...tseslint.configs.strictTypeChecked, { 5 | languageOptions: { 6 | ecmaVersion: 2023, 7 | sourceType: 'module', 8 | parserOptions: { 9 | project: 'tsconfig.json', 10 | tsconfigRootDir: import.meta.dirname, 11 | }, 12 | }, 13 | }); 14 | -------------------------------------------------------------------------------- /asset-transfer-sbe/chaincode-typescript/src/asset.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | */ 4 | 5 | import { Object, Property } from 'fabric-contract-api'; 6 | 7 | @Object() 8 | export class Asset { 9 | @Property() 10 | public ID: string = ''; 11 | 12 | @Property() 13 | public Value: number = 0; 14 | 15 | @Property() 16 | public Owner: string = ''; 17 | 18 | @Property() 19 | public OwnerOrg: string = ''; 20 | } 21 | -------------------------------------------------------------------------------- /asset-transfer-sbe/chaincode-typescript/src/index.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | */ 4 | 5 | import { AssetContract } from './assetContract'; 6 | export { AssetContract } from './assetContract'; 7 | 8 | export const contracts: unknown[] = [ AssetContract ]; 9 | -------------------------------------------------------------------------------- /asset-transfer-sbe/chaincode-typescript/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "extends": "@tsconfig/node18/tsconfig.json", 4 | "compilerOptions": { 5 | "experimentalDecorators": true, 6 | "emitDecoratorMetadata": true, 7 | "declaration": true, 8 | "declarationMap": true, 9 | "sourceMap": true, 10 | "outDir": "dist", 11 | "strict": true, 12 | "noUnusedLocals": true, 13 | "noImplicitReturns": true, 14 | "forceConsistentCasingInFileNames": true 15 | }, 16 | "include": ["src/"] 17 | } 18 | -------------------------------------------------------------------------------- /asset-transfer-secured-agreement/application-gateway-typescript/.gitignore: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | 5 | 6 | # Coverage directory used by tools like istanbul 7 | coverage 8 | 9 | # Dependency directories 10 | node_modules/ 11 | jspm_packages/ 12 | 13 | # Compiled TypeScript files 14 | dist 15 | -------------------------------------------------------------------------------- /asset-transfer-secured-agreement/application-gateway-typescript/eslint.config.mjs: -------------------------------------------------------------------------------- 1 | import js from '@eslint/js'; 2 | import tseslint from 'typescript-eslint'; 3 | 4 | export default tseslint.config(js.configs.recommended, ...tseslint.configs.strictTypeChecked, { 5 | languageOptions: { 6 | ecmaVersion: 2023, 7 | sourceType: 'module', 8 | parserOptions: { 9 | project: 'tsconfig.json', 10 | tsconfigRootDir: import.meta.dirname, 11 | }, 12 | }, 13 | }); 14 | -------------------------------------------------------------------------------- /asset-transfer-secured-agreement/application-gateway-typescript/src/utils.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright IBM Corp. All Rights Reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | export const RED = '\x1b[31m\n'; 8 | export const GREEN = '\x1b[32m\n'; 9 | export const RESET = '\x1b[0m'; 10 | 11 | export function parse(data: string): T { 12 | return JSON.parse(data) as T; 13 | } 14 | -------------------------------------------------------------------------------- /asset-transfer-secured-agreement/application-gateway-typescript/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@tsconfig/node18/tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "declaration": true, 6 | "declarationMap": true, 7 | "sourceMap": true, 8 | "noUnusedLocals": true, 9 | "noImplicitReturns": true, 10 | "noUncheckedIndexedAccess": true, 11 | "forceConsistentCasingInFileNames": true 12 | }, 13 | "include": ["./src/**/*"], 14 | "exclude": ["./src/**/*.spec.ts"] 15 | } 16 | -------------------------------------------------------------------------------- /asset-transfer-secured-agreement/chaincode-go/README.md: -------------------------------------------------------------------------------- 1 | [Secured asset transfer in Fabric Tutorial](https://hyperledger-fabric.readthedocs.io/en/latest/secured_asset_transfer/secured_private_asset_transfer_tutorial.html) 2 | -------------------------------------------------------------------------------- /auction-dutch/application-javascript/.eslintignore: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | 5 | coverage 6 | -------------------------------------------------------------------------------- /auction-dutch/application-javascript/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "auction", 3 | "version": "1.0.0", 4 | "description": "auction application implemented in JavaScript", 5 | "engines": { 6 | "node": ">=12", 7 | "npm": ">=5" 8 | }, 9 | "engineStrict": true, 10 | "author": "Hyperledger", 11 | "license": "Apache-2.0", 12 | "scripts": { 13 | "lint": "eslint *.js" 14 | }, 15 | "dependencies": { 16 | "fabric-ca-client": "^2.2.19", 17 | "fabric-network": "^2.2.19" 18 | }, 19 | "devDependencies": { 20 | "eslint": "^7.20.0", 21 | "eslint-config-standard": "^16.0.2", 22 | "eslint-plugin-import": "^2.22.1", 23 | "eslint-plugin-node": "^11.1.0", 24 | "eslint-plugin-promise": "^4.3.1" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /auction-dutch/chaincode-go-auditor/smartContract.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | */ 4 | 5 | package main 6 | 7 | import ( 8 | "log" 9 | 10 | "github.com/hyperledger/fabric-contract-api-go/v2/contractapi" 11 | auction "github.com/hyperledger/fabric-samples/auction/dutch-auction/chaincode-go-auditor/smart-contract" 12 | ) 13 | 14 | func main() { 15 | auctionSmartContract, err := contractapi.NewChaincode(&auction.SmartContract{}) 16 | if err != nil { 17 | log.Panicf("Error creating auction chaincode: %v", err) 18 | } 19 | 20 | if err := auctionSmartContract.Start(); err != nil { 21 | log.Panicf("Error starting auction chaincode: %v", err) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /auction-dutch/chaincode-go/smartContract.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | */ 4 | 5 | package main 6 | 7 | import ( 8 | "log" 9 | 10 | "github.com/hyperledger/fabric-contract-api-go/v2/contractapi" 11 | auction "github.com/hyperledger/fabric-samples/auction/dutch-auction/chaincode-go/smart-contract" 12 | ) 13 | 14 | func main() { 15 | auctionSmartContract, err := contractapi.NewChaincode(&auction.SmartContract{}) 16 | if err != nil { 17 | log.Panicf("Error creating auction chaincode: %v", err) 18 | } 19 | 20 | if err := auctionSmartContract.Start(); err != nil { 21 | log.Panicf("Error starting auction chaincode: %v", err) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /auction-simple/application-javascript/.eslintignore: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | 5 | coverage 6 | -------------------------------------------------------------------------------- /auction-simple/application-javascript/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "auction", 3 | "version": "1.0.0", 4 | "description": "auction application implemented in JavaScript", 5 | "engines": { 6 | "node": ">=12", 7 | "npm": ">=5" 8 | }, 9 | "engineStrict": true, 10 | "author": "Hyperledger", 11 | "license": "Apache-2.0", 12 | "scripts": { 13 | "lint": "eslint *.js" 14 | }, 15 | "dependencies": { 16 | "fabric-ca-client": "^2.2.19", 17 | "fabric-network": "^2.2.19" 18 | }, 19 | "devDependencies": { 20 | "eslint": "^7.32.0" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /auction-simple/chaincode-go/smartContract.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | */ 4 | 5 | package main 6 | 7 | import ( 8 | "log" 9 | 10 | "github.com/hyperledger/fabric-contract-api-go/v2/contractapi" 11 | "github.com/hyperledger/fabric-samples/auction/chaincode-go/smart-contract" 12 | ) 13 | 14 | func main() { 15 | auctionSmartContract, err := contractapi.NewChaincode(&auction.SmartContract{}) 16 | if err != nil { 17 | log.Panicf("Error creating auction chaincode: %v", err) 18 | } 19 | 20 | if err := auctionSmartContract.Start(); err != nil { 21 | log.Panicf("Error starting auction chaincode: %v", err) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ci/scripts/lint-java.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | 4 | function print() { 5 | GREEN='\033[0;32m' 6 | NC='\033[0m' 7 | echo 8 | echo -e "${GREEN}${1}${NC}" 9 | } 10 | 11 | # remove the java asset-private-data until the publishing issues have been resolved 12 | dirs=("$(find . -name "*-java" -type d -not -path '*/.*')") 13 | for dir in $dirs; do 14 | print "Linting $dir" 15 | pushd $dir 16 | 17 | if [[ -f "pom.xml" ]]; then 18 | print "Running Maven Build" 19 | mvn clean package 20 | else 21 | print "Running Gradle Build" 22 | ./gradlew build 23 | fi 24 | popd 25 | done -------------------------------------------------------------------------------- /ci/scripts/lint-javascript.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | 4 | function print() { 5 | GREEN='\033[0;32m' 6 | NC='\033[0m' 7 | echo 8 | echo -e "${GREEN}${1}${NC}" 9 | } 10 | 11 | dirs=("$(find . -name "*-javascript" -type d -not -path '*/.*')") 12 | for dir in $dirs; do 13 | print "Linting $dir" 14 | pushd $dir 15 | 16 | print "Installing node modules" 17 | npm install 18 | print "Running Lint" 19 | npm run lint 20 | 21 | popd 22 | done -------------------------------------------------------------------------------- /ci/scripts/lint-shell.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | 4 | shellcheck --version 5 | 6 | cd ./test-network-nano-bash && shellcheck *.sh 7 | -------------------------------------------------------------------------------- /ci/scripts/lint-typescript.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | 4 | function print() { 5 | GREEN='\033[0;32m' 6 | NC='\033[0m' 7 | echo 8 | echo -e "${GREEN}${1}${NC}" 9 | } 10 | 11 | dirs=("$(find . -name "*-typescript" -type d -not -path '*/.*')") 12 | for dir in $dirs; do 13 | print "Linting $dir" 14 | pushd $dir 15 | 16 | print "Installing node modules" 17 | npm install 18 | print "Running Lint" 19 | npm run lint 20 | 21 | popd 22 | done -------------------------------------------------------------------------------- /ci/scripts/lint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | 4 | cd "$(dirname "$0")/../.." 5 | 6 | ci/scripts/lint-go.sh 7 | ci/scripts/lint-javascript.sh 8 | ci/scripts/lint-typescript.sh 9 | ci/scripts/lint-java.sh 10 | ci/scripts/lint-shell.sh -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/.gitignore: -------------------------------------------------------------------------------- 1 | fabric 2 | _cfg 3 | node_modules 4 | *.bin 5 | .idea/ 6 | _* 7 | *tgz 8 | *.tar.gz 9 | ~*.pptx 10 | 11 | bin 12 | config/ 13 | 14 | .DS_Store 15 | .idea/ 16 | 17 | rook -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/conga-cards/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | parser: '@typescript-eslint/parser', 4 | plugins: [ 5 | '@typescript-eslint', 6 | ], 7 | extends: [ 8 | 'eslint:recommended', 9 | 'plugin:@typescript-eslint/recommended', 10 | 'prettier', 11 | ], 12 | }; -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/conga-cards/.gitignore: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | 5 | # Coverage directory used by tools like istanbul 6 | coverage 7 | 8 | # Dependencies 9 | node_modules/ 10 | jspm_packages/ 11 | package-lock.json 12 | 13 | # Compiled TypeScript files 14 | dist 15 | 16 | # Files generated by the application at runtime 17 | checkpoint.json 18 | store.log 19 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/conga-cards/.npmrc: -------------------------------------------------------------------------------- 1 | engine-strict=true 2 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/conga-cards/assets/appleplectic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/full-stack-asset-transfer-guide/applications/conga-cards/assets/appleplectic.png -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/conga-cards/assets/bananomatopoeia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/full-stack-asset-transfer-guide/applications/conga-cards/assets/bananomatopoeia.png -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/conga-cards/assets/block-norris.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/full-stack-asset-transfer-guide/applications/conga-cards/assets/block-norris.png -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/conga-cards/assets/blockbert.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/full-stack-asset-transfer-guide/applications/conga-cards/assets/blockbert.png -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/conga-cards/assets/count-blockula.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/full-stack-asset-transfer-guide/applications/conga-cards/assets/count-blockula.png -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/conga-cards/assets/darth-conga.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/full-stack-asset-transfer-guide/applications/conga-cards/assets/darth-conga.png -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/conga-cards/assets/no-pun-intended.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/full-stack-asset-transfer-guide/applications/conga-cards/assets/no-pun-intended.png -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/conga-cards/assets/template.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/full-stack-asset-transfer-guide/applications/conga-cards/assets/template.png -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/conga-cards/hooks/captain-hook.json: -------------------------------------------------------------------------------- 1 | { 2 | "content": "Tail recursion is its own reward.", 3 | "avatar_url": "https://avatars.githubusercontent.com/u/49026922?s=200&v=4", 4 | "username": "Conga-Bot" 5 | } -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/conga-cards/images/interaction.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/full-stack-asset-transfer-guide/applications/conga-cards/images/interaction.png -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/conga-cards/src/commands/delete.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright contributors to the Hyperledgendary Full Stack Asset Transfer Guide project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | import { Gateway } from '@hyperledger/fabric-gateway'; 8 | import { CHAINCODE_NAME, CHANNEL_NAME } from '../config'; 9 | import { AssetTransfer } from '../contract'; 10 | import { assertDefined } from '../utils'; 11 | 12 | export default async function main(gateway: Gateway, args: string[]): Promise { 13 | const assetId = assertDefined(args[0], 'Arguments: '); 14 | 15 | const network = gateway.getNetwork(CHANNEL_NAME); 16 | const contract = network.getContract(CHAINCODE_NAME); 17 | 18 | const smartContract = new AssetTransfer(contract); 19 | await smartContract.deleteAsset(assetId); 20 | } 21 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/conga-cards/src/commands/getAllAssets.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright contributors to the Hyperledgendary Full Stack Asset Transfer Guide project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | import { Gateway } from '@hyperledger/fabric-gateway'; 8 | import { CHAINCODE_NAME, CHANNEL_NAME } from '../config'; 9 | import { AssetTransfer } from '../contract'; 10 | 11 | export default async function main(gateway: Gateway): Promise { 12 | const network = gateway.getNetwork(CHANNEL_NAME); 13 | const contract = network.getContract(CHAINCODE_NAME); 14 | 15 | const smartContract = new AssetTransfer(contract); 16 | const assets = await smartContract.getAllAssets(); 17 | 18 | const assetsJson = JSON.stringify(assets, undefined, 2); 19 | assetsJson.split('\n').forEach(line => console.log(line)); // Write line-by-line to avoid truncation 20 | } 21 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/conga-cards/src/commands/index.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright contributors to the Hyperledgendary Full Stack Asset Transfer Guide project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | import { Gateway } from '@hyperledger/fabric-gateway'; 8 | import create from './create'; 9 | import deleteCommand from './delete'; 10 | import discord from './discord'; 11 | import getAllAssets from './getAllAssets'; 12 | import read from './read'; 13 | import transfer from './transfer'; 14 | 15 | export type Command = (gateway: Gateway, args: string[]) => Promise; 16 | 17 | export const commands: Record = { 18 | create, 19 | delete: deleteCommand, 20 | discord, 21 | getAllAssets, 22 | read, 23 | transfer, 24 | }; 25 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/conga-cards/src/expectedError.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright contributors to the Hyperledgendary Full Stack Asset Transfer Guide project 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | export class ExpectedError extends Error { 8 | constructor(message?: string) { 9 | super(message); 10 | this.name = ExpectedError.name; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/conga-cards/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "extends": "@tsconfig/node18/tsconfig.json", 4 | "compilerOptions": { 5 | "declaration": true, 6 | "declarationMap": true, 7 | "sourceMap": true, 8 | "outDir": "dist", 9 | "rootDir": "src", 10 | "noUnusedLocals": false, 11 | "noImplicitReturns": true 12 | }, 13 | "include": [ 14 | "src/" 15 | ], 16 | "exclude": [ 17 | "src/**/*.spec.ts" 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/frontend/.browserslistrc: -------------------------------------------------------------------------------- 1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below. 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | 5 | # For the full list of supported browsers by the Angular framework, please see: 6 | # https://angular.io/guide/browser-support 7 | 8 | # You can see what browsers were selected by your queries by running: 9 | # npx browserslist 10 | 11 | last 1 Chrome version 12 | last 1 Firefox version 13 | last 2 Edge major versions 14 | last 2 Safari major versions 15 | last 2 iOS major versions 16 | Firefox ESR 17 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/frontend/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/frontend/.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # Compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | /bazel-out 8 | 9 | # Node 10 | /node_modules 11 | npm-debug.log 12 | yarn-error.log 13 | 14 | # IDEs and editors 15 | .idea/ 16 | .project 17 | .classpath 18 | .c9/ 19 | *.launch 20 | .settings/ 21 | *.sublime-workspace 22 | 23 | # Visual Studio Code 24 | .vscode/* 25 | !.vscode/settings.json 26 | !.vscode/tasks.json 27 | !.vscode/launch.json 28 | !.vscode/extensions.json 29 | .history/* 30 | 31 | # Miscellaneous 32 | /.angular/cache 33 | .sass-cache/ 34 | /connect.lock 35 | /coverage 36 | /libpeerconnection.log 37 | testem.log 38 | /typings 39 | 40 | # System files 41 | .DS_Store 42 | Thumbs.db 43 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/frontend/Dockerfile: -------------------------------------------------------------------------------- 1 | # FROM node:14-alpine3.14 AS build 2 | # WORKDIR /app 3 | # COPY package.json /app 4 | # RUN npm install 5 | # CMD npm run build 6 | 7 | # COPY . /app 8 | # CMD [ "npm","run","prod" ] 9 | 10 | FROM nginx:alpine 11 | COPY /dist/frontend /usr/share/nginx/html -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/frontend/README.md: -------------------------------------------------------------------------------- 1 | local build 2 | 3 | npm install 4 | npm start 5 | 6 | 7 | k8s deployment 8 | Step-1 Prodction build 9 | ng build 10 | Step-2 Build docker image & tag 11 | docker build -t localhost:5000/frontend . 12 | Step-3 Push image to local registary 13 | docker push localhost:5000/frontend 14 | Step-4 deploy to k8s 15 | kubectl apply -f deployment.yaml -n test-network 16 | 17 | Step-5 Navigate to frontend using below url 18 | https://frontend.localho.st/ -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/frontend/screenshots/Create.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/full-stack-asset-transfer-guide/applications/frontend/screenshots/Create.png -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/frontend/screenshots/list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/full-stack-asset-transfer-guide/applications/frontend/screenshots/list.png -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/frontend/src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule, Routes } from '@angular/router'; 3 | 4 | const routes: Routes = []; 5 | 6 | @NgModule({ 7 | imports: [RouterModule.forRoot(routes)], 8 | exports: [RouterModule] 9 | }) 10 | export class AppRoutingModule { } 11 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/frontend/src/app/app.component.scss: -------------------------------------------------------------------------------- 1 | .layout{ 2 | margin: 40px 10%; 3 | } 4 | .search{ 5 | float: right; 6 | } -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/frontend/src/app/asset-dialog/asset-dialog.component.scss: -------------------------------------------------------------------------------- 1 | .mat-form-field{ 2 | width: 100% !important; 3 | } -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/frontend/src/app/asset-dialog/asset-dialog.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { AssetDialogComponent } from './asset-dialog.component'; 4 | 5 | describe('AssetDialogComponent', () => { 6 | let component: AssetDialogComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ AssetDialogComponent ] 12 | }) 13 | .compileComponents(); 14 | 15 | fixture = TestBed.createComponent(AssetDialogComponent); 16 | component = fixture.componentInstance; 17 | fixture.detectChanges(); 18 | }); 19 | 20 | it('should create', () => { 21 | expect(component).toBeTruthy(); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/frontend/src/app/urls.ts: -------------------------------------------------------------------------------- 1 | export class URLS { 2 | // private static IP = "http://localhost:8080/"; 3 | private static IP = "https://restapi.localho.st/"; 4 | public static LIST = URLS.IP + "list"; 5 | public static CREATE = URLS.IP + "create"; 6 | public static UPDATE = URLS.IP + "update"; 7 | public static DELETE = URLS.IP + "delete"; 8 | } -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/frontend/src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/full-stack-asset-transfer-guide/applications/frontend/src/assets/.gitkeep -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/frontend/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/frontend/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // This file can be replaced during build by using the `fileReplacements` array. 2 | // `ng build` replaces `environment.ts` with `environment.prod.ts`. 3 | // The list of file replacements can be found in `angular.json`. 4 | 5 | export const environment = { 6 | production: false 7 | }; 8 | 9 | /* 10 | * For easier debugging in development mode, you can import the following file 11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. 12 | * 13 | * This import should be commented out in production mode because it will have a negative impact 14 | * on performance if an error is thrown. 15 | */ 16 | // import 'zone.js/plugins/zone-error'; // Included with Angular CLI. 17 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/frontend/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/full-stack-asset-transfer-guide/applications/frontend/src/favicon.ico -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/frontend/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Frontend 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/frontend/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.error(err)); 13 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/frontend/src/styles.scss: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | 3 | html, body { height: 100%; } 4 | body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; } 5 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/frontend/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | declare const require: { 11 | context(path: string, deep?: boolean, filter?: RegExp): { 12 | (id: string): T; 13 | keys(): string[]; 14 | }; 15 | }; 16 | 17 | // First, initialize the Angular testing environment. 18 | getTestBed().initTestEnvironment( 19 | BrowserDynamicTestingModule, 20 | platformBrowserDynamicTesting(), 21 | ); 22 | 23 | // Then we find all the tests. 24 | const context = require.context('./', true, /\.spec\.ts$/); 25 | // And load the modules. 26 | context.keys().forEach(context); 27 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/frontend/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/app", 6 | "types": [] 7 | }, 8 | "files": [ 9 | "src/main.ts", 10 | "src/polyfills.ts" 11 | ], 12 | "include": [ 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/frontend/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/spec", 6 | "types": [ 7 | "jasmine" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts", 12 | "src/polyfills.ts" 13 | ], 14 | "include": [ 15 | "src/**/*.spec.ts", 16 | "src/**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/ping-chaincode/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/ping-chaincode/app.env: -------------------------------------------------------------------------------- 1 | CHANNEL_NAME=mychannel 2 | CHAINCODE_NAME=asset-transfer 3 | CONN_PROFILE_FILE=/home/matthew/github.com/hyperledgendary/full-stack-asset-transfer-guide/_cfg/Org1_gateway.json 4 | ID_FILE=asset-transfer_appid.json 5 | ID_DIR=/home/matthew/github.com/hyperledgendary/full-stack-asset-transfer-guide/_cfg/ 6 | TLS_ENABLED=true 7 | MSPID=Org1MSP 8 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/ping-chaincode/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends":"@tsconfig/node18/tsconfig.json", 3 | "compilerOptions": { 4 | "experimentalDecorators": true, 5 | "emitDecoratorMetadata": true, 6 | "outDir": "dist", 7 | "declaration": true, 8 | "sourceMap": true, 9 | "noImplicitAny": true 10 | }, 11 | "include": [ 12 | "./src/**/*" 13 | ], 14 | "exclude": [ 15 | "./src/**/*.spec.ts" 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/rest-api/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | dist/ -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/rest-api/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:14-alpine3.14 AS build 2 | WORKDIR /app 3 | COPY package.json /app 4 | RUN npm install 5 | COPY . /app 6 | CMD [ "npm","run","prod" ] -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/rest-api/LICENSE: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright contributors to the Hyperledger Full Stack Asset Transfer project 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at: 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/rest-api/renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "config:base" 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/rest-api/src/server.ts: -------------------------------------------------------------------------------- 1 | import app from "./app"; 2 | const PORT = process.env.PORT || 8080; 3 | 4 | app.listen(PORT, () => { 5 | console.log('listening on port ' + PORT); 6 | }) 7 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/rest-api/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@tsconfig/node18/tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", //change the output directory 5 | "resolveJsonModule": true //to import out json database 6 | }, 7 | "include": [ 8 | "src/**/*.ts" //which kind of files to compile 9 | ], 10 | "exclude": [ 11 | "node_modules" //which files or directories to ignore 12 | ] 13 | } -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/trader-typescript/.gitignore: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | 5 | # Coverage directory used by tools like istanbul 6 | coverage 7 | 8 | # Dependencies 9 | node_modules/ 10 | jspm_packages/ 11 | package-lock.json 12 | 13 | # Compiled TypeScript files 14 | dist 15 | 16 | # Files generated by the application at runtime 17 | checkpoint.json 18 | store.log 19 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/trader-typescript/.npmrc: -------------------------------------------------------------------------------- 1 | engine-strict=true 2 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/trader-typescript/eslint.config.mjs: -------------------------------------------------------------------------------- 1 | import js from '@eslint/js'; 2 | import tseslint from 'typescript-eslint'; 3 | 4 | export default tseslint.config(js.configs.recommended, ...tseslint.configs.strictTypeChecked, { 5 | languageOptions: { 6 | ecmaVersion: 2023, 7 | sourceType: 'module', 8 | parserOptions: { 9 | project: 'tsconfig.json', 10 | tsconfigRootDir: import.meta.dirname, 11 | }, 12 | }, 13 | }); 14 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/trader-typescript/src/commands/delete.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright IBM Corp. All Rights Reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | import { Gateway } from '@hyperledger/fabric-gateway'; 8 | import { CHAINCODE_NAME, CHANNEL_NAME } from '../config'; 9 | import { AssetTransfer } from '../contract'; 10 | import { assertDefined } from '../utils'; 11 | 12 | export default async function main(gateway: Gateway, args: string[]): Promise { 13 | const assetId = assertDefined(args[0], 'Arguments: '); 14 | 15 | const network = gateway.getNetwork(CHANNEL_NAME); 16 | const contract = network.getContract(CHAINCODE_NAME); 17 | 18 | const smartContract = new AssetTransfer(contract); 19 | await smartContract.deleteAsset(assetId); 20 | } 21 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/trader-typescript/src/commands/getAllAssets.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright IBM Corp. All Rights Reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | import { Gateway } from '@hyperledger/fabric-gateway'; 8 | import { CHAINCODE_NAME, CHANNEL_NAME } from '../config'; 9 | import { AssetTransfer } from '../contract'; 10 | 11 | export default async function main(gateway: Gateway): Promise { 12 | const network = gateway.getNetwork(CHANNEL_NAME); 13 | const contract = network.getContract(CHAINCODE_NAME); 14 | 15 | const smartContract = new AssetTransfer(contract); 16 | const assets = await smartContract.getAllAssets(); 17 | 18 | const assetsJson = JSON.stringify(assets, undefined, 2); 19 | // Write line-by-line to avoid truncation 20 | assetsJson.split('\n').forEach((line) => { 21 | console.log(line); 22 | }); 23 | } 24 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/trader-typescript/src/commands/index.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright IBM Corp. All Rights Reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | import { Gateway } from '@hyperledger/fabric-gateway'; 8 | import create from './create'; 9 | import deleteCommand from './delete'; 10 | import getAllAssets from './getAllAssets'; 11 | import listen from './listen'; 12 | import read from './read'; 13 | import transact from './transact'; 14 | import transfer from './transfer'; 15 | 16 | export type Command = (gateway: Gateway, args: string[]) => Promise; 17 | 18 | export const commands: Record = { 19 | create, 20 | delete: deleteCommand, 21 | getAllAssets, 22 | listen, 23 | read, 24 | transact, 25 | transfer, 26 | }; 27 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/trader-typescript/src/commands/read.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright IBM Corp. All Rights Reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | import { Gateway } from '@hyperledger/fabric-gateway'; 8 | import { CHAINCODE_NAME, CHANNEL_NAME } from '../config'; 9 | import { AssetTransfer } from '../contract'; 10 | import { assertDefined } from '../utils'; 11 | 12 | export default async function main(gateway: Gateway, args: string[]): Promise { 13 | const assetId = assertDefined(args[0], 'Arguments: '); 14 | 15 | const network = gateway.getNetwork(CHANNEL_NAME); 16 | const contract = network.getContract(CHAINCODE_NAME); 17 | 18 | const smartContract = new AssetTransfer(contract); 19 | const asset = await smartContract.readAsset(assetId); 20 | 21 | const assetsJson = JSON.stringify(asset, undefined, 2); 22 | console.log(assetsJson); 23 | } 24 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/trader-typescript/src/expectedError.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright IBM Corp. All Rights Reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | export class ExpectedError extends Error { 8 | constructor(message?: string) { 9 | super(message); 10 | this.name = ExpectedError.name; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/applications/trader-typescript/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@tsconfig/node18/tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "declaration": true, 6 | "declarationMap": true, 7 | "sourceMap": true, 8 | "noUnusedLocals": true, 9 | "noImplicitReturns": true, 10 | "noUncheckedIndexedAccess": true, 11 | "forceConsistentCasingInFileNames": true 12 | }, 13 | "include": ["./src/**/*"], 14 | "exclude": ["./src/**/*.spec.ts"] 15 | } 16 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/checks/check-chaincode.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eou pipefail 4 | 5 | # All checks run in the workshop root folder 6 | cd "$(dirname "$0")"/.. 7 | 8 | . checks/utils.sh 9 | 10 | EXIT=0 11 | 12 | function chaincode_ready() { 13 | peer chaincode query -n asset-transfer -C mychannel -c '{"Args":["org.hyperledger.fabric:GetMetadata"]}' 14 | } 15 | 16 | must_declare WORKSHOP_CRYPTO 17 | 18 | must_declare CORE_PEER_LOCALMSPID 19 | must_declare CORE_PEER_ADDRESS 20 | must_declare CORE_PEER_TLS_ENABLED 21 | must_declare CORE_PEER_MSPCONFIGPATH 22 | must_declare CORE_PEER_TLS_ROOTCERT_FILE 23 | must_declare CORE_PEER_CLIENT_CONNTIMEOUT 24 | must_declare CORE_PEER_DELIVERYCLIENT_CONNTIMEOUT 25 | must_declare ORDERER_ENDPOINT 26 | must_declare ORDERER_TLS_CERT 27 | 28 | check chaincode_ready "asset-transfer chaincode is running" 29 | 30 | exit $EXIT 31 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/checks/utils.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Copyright IBM Corp All Rights Reserved 4 | # 5 | # SPDX-License-Identifier: Apache-2.0 6 | # 7 | 8 | SUCCESS="✅" 9 | WARN="⚠️ " 10 | 11 | # tests if varname is defined in the env AND it's an existing directory 12 | function must_declare() { 13 | local varname=$1 14 | 15 | if [[ ${!varname+x} ]] 16 | then 17 | printf "%s %-40s%s\n" $SUCCESS $varname ${!varname} 18 | else 19 | printf "%s %-40s\n" ${WARN} $varname 20 | EXIT=1 21 | fi 22 | } 23 | 24 | 25 | function check() { 26 | local name=$1 27 | local message=$2 28 | 29 | printf "🤔 %s" $name 30 | 31 | if $name &>/dev/null ; then 32 | printf "\r%s %-40s" $SUCCESS $name 33 | else 34 | printf "\r%s %-40s" $WARN $name 35 | EXIT=1 36 | fi 37 | 38 | echo $message 39 | } -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/contracts/asset-transfer-typescript/.gitignore: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | 5 | 6 | # Coverage directory used by tools like istanbul 7 | coverage 8 | 9 | # Dependency directories 10 | node_modules/ 11 | jspm_packages/ 12 | package-lock.json 13 | 14 | # Compiled TypeScript files 15 | dist 16 | 17 | # Files created during workshop run 18 | metadata.json 19 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/contracts/asset-transfer-typescript/.npmrc: -------------------------------------------------------------------------------- 1 | engine-strict=true 2 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/contracts/asset-transfer-typescript/asset-transfer-chaincode-vars.yml: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | --- 5 | smart_contract_name: "asset-transfer" 6 | smart_contract_version: "1.0.0" 7 | smart_contract_sequence: 1 8 | smart_contract_package: "asset-transfer.tgz" 9 | # smart_contract_constructor: "initLedger" 10 | smart_contract_endorsement_policy: "" 11 | smart_contract_collections_file: "" 12 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/contracts/asset-transfer-typescript/docker/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | # 5 | set -euo pipefail 6 | : ${CORE_PEER_TLS_ENABLED:="false"} 7 | : ${DEBUG:="false"} 8 | 9 | if [ "${DEBUG,,}" = "true" ]; then 10 | npm run start:server-debug 11 | 12 | elif [[ ! -v CHAINCODE_SERVER_ADDRESS ]]; then 13 | npm start -- --peer.address $CORE_PEER_ADDRESS 14 | 15 | elif [ "${CORE_PEER_TLS_ENABLED,,}" = "true" ]; then 16 | npm run start:server 17 | 18 | else 19 | npm run start:server-nontls 20 | fi 21 | 22 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/contracts/asset-transfer-typescript/eslint.config.mjs: -------------------------------------------------------------------------------- 1 | import js from '@eslint/js'; 2 | import tseslint from 'typescript-eslint'; 3 | 4 | export default tseslint.config(js.configs.recommended, ...tseslint.configs.strictTypeChecked, { 5 | languageOptions: { 6 | ecmaVersion: 2023, 7 | sourceType: 'module', 8 | parserOptions: { 9 | project: 'tsconfig.json', 10 | tsconfigRootDir: import.meta.dirname, 11 | }, 12 | }, 13 | }); 14 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/contracts/asset-transfer-typescript/src/index.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | */ 4 | 5 | import { AssetTransferContract } from './assetTransfer'; 6 | 7 | export { AssetTransferContract } from './assetTransfer'; 8 | 9 | export const contracts: any[] = [AssetTransferContract]; // eslint-disable-line @typescript-eslint/no-explicit-any 10 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/contracts/asset-transfer-typescript/src/untyped.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'json-stringify-deterministic' { 2 | interface Options { 3 | space?: string; 4 | cycles?: boolean; 5 | replacer?: (k, v) => v; 6 | stringify?: typeof JSON.stringify; 7 | } 8 | 9 | export default function stringify(o: unknown, options?: Options): string; 10 | } 11 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/contracts/asset-transfer-typescript/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "extends": "@tsconfig/node18/tsconfig.json", 4 | "compilerOptions": { 5 | "experimentalDecorators": true, 6 | "emitDecoratorMetadata": true, 7 | "declaration": true, 8 | "declarationMap": true, 9 | "sourceMap": true, 10 | "outDir": "dist", 11 | "strict": true, 12 | "noUnusedLocals": true, 13 | "noImplicitReturns": true, 14 | "forceConsistentCasingInFileNames": true 15 | }, 16 | "include": ["src/"] 17 | } 18 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/docs/ApplicationDev/README.md: -------------------------------------------------------------------------------- 1 | # Client Application Development 2 | 3 | This session consists of the following topics to be covered in order: 4 | 5 | 1. [Fabric Gateway](01-FabricGateway.md) - overview of the Fabric Gateway service used by client applications to interact with the Fabric network. 6 | 1. **Exercise:** [Run the client application](02-Exercise-RunApplication.md) - run the Trader sample application. 7 | 1. [Application overview](03-ApplicationOverview.md) - description of key parts of the application. 8 | 1. **Exercise:** [Implement asset transfer](04-Exercise-AssetTransfer.md) - enhance the client application to allow the transfer of assets. 9 | 1. [Chaincode events](05-ChaincodeEvents.md) - overview of chaincode events and their use. 10 | 1. **Exercise:** [Use chaincode events](06-Exercise-ChaincodeEvents.md) - listen for chaincode events and use them to implement notifications. 11 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/docs/CloudReady/README.md: -------------------------------------------------------------------------------- 1 | # Cloud Native Fabric 2 | 3 | - [Cloud Ready!](00-setup.md) 4 | - **Exercise:** [Deploy a Kubernetes Cluster](10-kube.md) 5 | - (optional) With a [Multipass VM](11-kube-multipass.md) 6 | - (optional) With an [EC2 VM](12-kube-ec2-vm.md) 7 | - (optional) With a [public cloud](13-kube-public-cloud.md) 8 | - **Exercise:** [Deploy a Fabric Network](20-fabric.md) 9 | - (optional) With the [Fabric Operations Console](21-fabric-operations-console.md) 10 | - (optional) With the [Ansible Blockchain Collection](22-fabric-ansible-collection.md) 11 | - **Exercise:** [Deploy a Smart Contract](30-chaincode.md) 12 | - (optional) With the [Ansible Blockchain Collection](31-fabric-ansible-chaincode.md) 13 | - **Exercise:** [Deploy a Client Application](40-bananas.md) 14 | 15 | 16 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/docs/images/ApplicationDev.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/full-stack-asset-transfer-guide/docs/images/ApplicationDev.pptx -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/docs/images/ApplicationDev/fabric-gateway-deployment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/full-stack-asset-transfer-guide/docs/images/ApplicationDev/fabric-gateway-deployment.png -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/docs/images/ApplicationDev/fabric-gateway-model.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/full-stack-asset-transfer-guide/docs/images/ApplicationDev/fabric-gateway-model.png -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/docs/images/ApplicationDev/legacy-sdk-model.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/full-stack-asset-transfer-guide/docs/images/ApplicationDev/legacy-sdk-model.png -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/docs/images/ApplicationDev/transaction-submit-flow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/full-stack-asset-transfer-guide/docs/images/ApplicationDev/transaction-submit-flow.png -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/docs/images/CloudReady.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/full-stack-asset-transfer-guide/docs/images/CloudReady.pptx -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/docs/images/CloudReady/00-cloud-ready-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/full-stack-asset-transfer-guide/docs/images/CloudReady/00-cloud-ready-2.png -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/docs/images/CloudReady/10-kube.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/full-stack-asset-transfer-guide/docs/images/CloudReady/10-kube.png -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/docs/images/CloudReady/12-kube-ec2-vm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/full-stack-asset-transfer-guide/docs/images/CloudReady/12-kube-ec2-vm.png -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/docs/images/CloudReady/20-fabric.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/full-stack-asset-transfer-guide/docs/images/CloudReady/20-fabric.png -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/docs/images/CloudReady/30-chaincode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/full-stack-asset-transfer-guide/docs/images/CloudReady/30-chaincode.png -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/docs/images/CloudReady/40-gateway-client-app.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/full-stack-asset-transfer-guide/docs/images/CloudReady/40-gateway-client-app.png -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/docs/images/CloudReady/kube-ec2-vm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/full-stack-asset-transfer-guide/docs/images/CloudReady/kube-ec2-vm.png -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/docs/images/cloud-vm-with-operator-network.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/full-stack-asset-transfer-guide/docs/images/cloud-vm-with-operator-network.png -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/docs/images/multipass-operator-network.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/full-stack-asset-transfer-guide/docs/images/multipass-operator-network.png -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/docs/images/multipass-test-network.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/full-stack-asset-transfer-guide/docs/images/multipass-test-network.png -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/docs/images/readme_diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/full-stack-asset-transfer-guide/docs/images/readme_diagram.png -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/infrastructure/configuration/fabric-common-vars.yml: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | --- 5 | # These vars are used in more than one file, 6 | # i.e. needed by multiple orgs so can't just live in a per org file 7 | ordering_org_name: "Ordering Org" 8 | ordering_service_name: "Ordering Service" 9 | org1_name: "Org1" 10 | org1_msp_id: Org1MSP 11 | org2_name: "Org2" 12 | org2_msp_id: Org2MSP 13 | channel_name: "mychannel" 14 | # smart_contract_name: "fabcar" 15 | # smart_contract_version: "1.0.0" 16 | # smart_contract_sequence: 1 17 | # smart_contract_package: "fabcar@1.0.0.tgz" 18 | # smart_contract_constructor: "initLedger" 19 | # smart_contract_endorsement_policy: "" 20 | # smart_contract_collections_file: "" 21 | ca_version: ">=1.4,<2.0" 22 | peer_version: ">=2.2,<3.0" 23 | ordering_service_version: ">=2.2,<3.0" 24 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/infrastructure/configuration/fabric-ordering-org-vars.yml: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | --- 5 | ca_admin_enrollment_id: admin 6 | ca_admin_enrollment_secret: adminpw 7 | organization_admin_enrollment_id: orderingorgadmin 8 | organization_admin_enrollment_secret: orderingorgadminpw 9 | ordering_service_enrollment_id: orderingorgorderer 10 | ordering_service_enrollment_secret: orderingorgordererpw 11 | ordering_service_msp: OrdererMSP 12 | ordering_service_nodes: 1 13 | wait_timeout: 600 14 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/infrastructure/configuration/fabric-org1-vars.yml: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | --- 5 | ca_admin_enrollment_id: admin 6 | ca_admin_enrollment_secret: adminpw 7 | organization_admin_enrollment_id: org1admin 8 | organization_admin_enrollment_secret: org1adminpw 9 | peer_enrollment_id: org1peer 10 | peer_enrollment_secret: org1peerpw 11 | application_enrollment_id: org1app 12 | application_enrollment_secret: org1apppw 13 | application_enrollment_type: client 14 | application_max_enrollments: 10 15 | org1_ca_name: "Org1 CA" 16 | org1_peer_name: "Org1 Peer" 17 | wait_timeout: 600 18 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/infrastructure/configuration/fabric-org2-vars.yml: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | --- 5 | ca_admin_enrollment_id: admin 6 | ca_admin_enrollment_secret: adminpw 7 | organization_admin_enrollment_id: org2admin 8 | organization_admin_enrollment_secret: org2adminpw 9 | peer_enrollment_id: org2peer 10 | peer_enrollment_secret: org2peerpw 11 | application_enrollment_id: org2app 12 | application_enrollment_secret: org2apppw 13 | application_enrollment_type: client 14 | application_max_enrollments: 10 15 | org2_ca_name: "Org2 CA" 16 | org2_peer_name: "Org2 Peer" 17 | wait_timeout: 600 18 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/infrastructure/fabric_network_playbooks/01-create-ordering-organization-components.yml: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | --- 5 | - name: Create components for an ordering organization 6 | hosts: localhost 7 | vars: 8 | state: present 9 | organization_name: "{{ ordering_org_name }}" 10 | organization_msp_id: "{{ ordering_service_msp }}" 11 | wallet: "/_cfg" 12 | vars_files: 13 | - /_cfg/fabric-common-vars.yml 14 | - /_cfg/fabric-ordering-org-vars.yml 15 | roles: 16 | - ibm.blockchain_platform.ordering_organization 17 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/infrastructure/fabric_network_playbooks/02-create-endorsing-organization-components.yml: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | --- 5 | - name: Create components for an endorsing organization 6 | hosts: localhost 7 | vars: 8 | state: present 9 | organization_name: "{{ org1_name }}" 10 | organization_msp_id: "{{ org1_msp_id }}" 11 | ca_name: "{{ org1_ca_name }}" 12 | peer_name: "{{ org1_peer_name }}" 13 | wallet: "/_cfg" 14 | vars_files: 15 | - /_cfg/fabric-common-vars.yml 16 | - /_cfg/fabric-org1-vars.yml 17 | roles: 18 | - ibm.blockchain_platform.endorsing_organization 19 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/infrastructure/fabric_network_playbooks/09-admins-policy.json.j2: -------------------------------------------------------------------------------- 1 | { 2 | "type": 1, 3 | "value": { 4 | "rule": { 5 | "n_out_of": { 6 | "n": 1, 7 | "rules": [ 8 | { 9 | "signed_by": 0 10 | } 11 | ] 12 | } 13 | }, 14 | "identities": [ 15 | { 16 | "principal_classification": "ROLE", 17 | "principal": { 18 | "msp_identifier": "{{ org1_msp_id }}", 19 | "role": "ADMIN" 20 | } 21 | } 22 | ] 23 | } 24 | } -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/infrastructure/fabric_network_playbooks/09-endorsement-policy.json.j2: -------------------------------------------------------------------------------- 1 | { 2 | "type": 1, 3 | "value": { 4 | "rule": { 5 | "n_out_of": { 6 | "n": 1, 7 | "rules": [ 8 | { 9 | "signed_by": 0 10 | } 11 | ] 12 | } 13 | }, 14 | "identities": [ 15 | { 16 | "principal_classification": "ROLE", 17 | "principal": { 18 | "msp_identifier": "{{ org1_msp_id }}", 19 | "role": "MEMBER" 20 | } 21 | } 22 | ] 23 | } 24 | } -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/infrastructure/fabric_network_playbooks/09-lifecycle-endorsement-policy.json.j2: -------------------------------------------------------------------------------- 1 | { 2 | "type": 1, 3 | "value": { 4 | "rule": { 5 | "n_out_of": { 6 | "n": 1, 7 | "rules": [ 8 | { 9 | "signed_by": 0 10 | } 11 | ] 12 | } 13 | }, 14 | "identities": [ 15 | { 16 | "principal_classification": "ROLE", 17 | "principal": { 18 | "msp_identifier": "{{ org1_msp_id }}", 19 | "role": "MEMBER" 20 | } 21 | } 22 | ] 23 | } 24 | } -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/infrastructure/fabric_network_playbooks/09-readers-policy.json.j2: -------------------------------------------------------------------------------- 1 | { 2 | "type": 1, 3 | "value": { 4 | "rule": { 5 | "n_out_of": { 6 | "n": 1, 7 | "rules": [ 8 | { 9 | "signed_by": 0 10 | } 11 | ] 12 | } 13 | }, 14 | "identities": [ 15 | { 16 | "principal_classification": "ROLE", 17 | "principal": { 18 | "msp_identifier": "{{ org1_msp_id }}", 19 | "role": "MEMBER" 20 | } 21 | } 22 | ] 23 | } 24 | } -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/infrastructure/fabric_network_playbooks/09-writers-policy.json.j2: -------------------------------------------------------------------------------- 1 | { 2 | "type": 1, 3 | "value": { 4 | "rule": { 5 | "n_out_of": { 6 | "n": 1, 7 | "rules": [ 8 | { 9 | "signed_by": 0 10 | } 11 | ] 12 | } 13 | }, 14 | "identities": [ 15 | { 16 | "principal_classification": "ROLE", 17 | "principal": { 18 | "msp_identifier": "{{ org1_msp_id }}", 19 | "role": "MEMBER" 20 | } 21 | } 22 | ] 23 | } 24 | } -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/infrastructure/fabric_network_playbooks/12-create-endorsing-organization-components.yml: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | --- 5 | - name: Create components for an endorsing organization 6 | hosts: localhost 7 | vars: 8 | state: present 9 | organization_name: "{{ org2_name }}" 10 | organization_msp_id: "{{ org2_msp_id }}" 11 | ca_name: "{{ org2_ca_name }}" 12 | peer_name: "{{ org2_peer_name }}" 13 | wallet: "/_cfg" 14 | vars_files: 15 | - /_cfg/fabric-common-vars.yml 16 | - /_cfg/fabric-org2-vars.yml 17 | roles: 18 | - ibm.blockchain_platform.endorsing_organization 19 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/infrastructure/fabric_network_playbooks/16-import-ordering-service.yml: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | --- 5 | - name: Import the ordering service 6 | hosts: localhost 7 | vars_files: 8 | - /_cfg/fabric-common-vars.yml 9 | - /_cfg/fabric-org2-vars.yml 10 | tasks: 11 | - name: Import the ordering service 12 | ibm.blockchain_platform.external_ordering_service: 13 | api_endpoint: "{{ api_endpoint }}" 14 | api_authtype: "{{ api_authtype }}" 15 | api_key: "{{ api_key }}" 16 | api_secret: "{{ api_secret | default(omit) }}" 17 | api_token_endpoint: "{{ api_token_endpoint | default(omit) }}" 18 | ordering_service: "{{ lookup('file', ordering_service_name+'.json') }}" 19 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/infrastructure/kind_console_ingress/templates/coredns/coredns.yaml.j2: -------------------------------------------------------------------------------- 1 | --- 2 | kind: ConfigMap 3 | apiVersion: v1 4 | metadata: 5 | name: coredns 6 | namespace: kube-system 7 | data: 8 | Corefile: | 9 | .:53 { 10 | errors 11 | health { 12 | lameduck 5s 13 | } 14 | rewrite name regex (.*)\.localho\.st host.ingress.internal 15 | hosts { 16 | {{ clusterip }} host.ingress.internal 17 | fallthrough 18 | } 19 | ready 20 | kubernetes cluster.local in-addr.arpa ip6.arpa { 21 | pods insecure 22 | fallthrough in-addr.arpa ip6.arpa 23 | ttl 30 24 | } 25 | prometheus :9153 26 | forward . /etc/resolv.conf { 27 | max_concurrent 1000 28 | } 29 | cache 30 30 | loop 31 | reload 32 | loadbalance 33 | } -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/infrastructure/operator_console_playbooks/01-operator-install.yml: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | --- 5 | - name: Deploy Opensource custom resource definitions and operator 6 | hosts: localhost 7 | vars_files: 8 | - /_cfg/operator-console-vars.yml 9 | vars: 10 | state: present 11 | wait_timeout: 3600 12 | roles: 13 | - hyperledger.fabric_ansible_collection.fabric_operator_crds 14 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/infrastructure/operator_console_playbooks/02-console-install.yml: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | --- 5 | - name: Deploy Opensource Console 6 | hosts: localhost 7 | vars_files: 8 | - /_cfg/operator-console-vars.yml 9 | vars: 10 | state: present 11 | wait_timeout: 3600 12 | roles: 13 | - hyperledger.fabric_ansible_collection.fabric_console 14 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/infrastructure/sample-network/.gitignore: -------------------------------------------------------------------------------- 1 | network-debug.log 2 | network.log 3 | temp/ 4 | config/configtx.yaml -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/infrastructure/sample-network/config/console/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | 4 | resources: 5 | - hlf-operations-console.yaml 6 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/infrastructure/sample-network/config/manager/kustomization.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright contributors to the Hyperledger Fabric Operator project 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at: 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | apiVersion: kustomize.config.k8s.io/v1beta1 19 | kind: Kustomization 20 | 21 | resources: 22 | - fabric-operator-manager.yaml 23 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/infrastructure/sample-network/config/rbac/fabric-operator-serviceaccount.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright contributors to the Hyperledger Fabric Operator project 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at: 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | --- 19 | apiVersion: v1 20 | kind: ServiceAccount 21 | metadata: 22 | name: fabric-operator 23 | -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/infrastructure/sample-network/scripts/frontend_build.sh: -------------------------------------------------------------------------------- 1 | function launch_frontend() { 2 | pushd $WORKSHOP_PATH/applications/frontend 3 | log "Install dependencies" 4 | npm install 5 | log "Generate dist" 6 | ng build 7 | log "Build docker" 8 | docker build -t localhost:5000/frontend . 9 | #build docker image and push to local registary 10 | log "Push docker image to registry" 11 | docker push localhost:5000/frontend 12 | popd 13 | # docker push localhost:5000/rest-api 14 | # #deploy rest api image to k8s 15 | kubectl -n $WORKSHOP_NAMESPACE apply -f scripts/frontend_deployment.yaml 16 | } -------------------------------------------------------------------------------- /full-stack-asset-transfer-guide/tests/00-chaincode-e2e.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -v -eou pipefail 4 | 5 | # All tests run in the workshop root folder 6 | cd "$(dirname "$0")"/.. 7 | 8 | export WORKSHOP_PATH="${PWD}" 9 | export PATH="${WORKSHOP_PATH}/bin:${PATH}" 10 | export FABRIC_CFG_PATH="${WORKSHOP_PATH}/config" 11 | 12 | "${WORKSHOP_PATH}/check.sh" 13 | -------------------------------------------------------------------------------- /hardware-security-module/.gitignore: -------------------------------------------------------------------------------- 1 | crypto-material -------------------------------------------------------------------------------- /hardware-security-module/application-go/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/hyperledger/fabric-samples/hardware-security-module/application-go 2 | 3 | go 1.23.0 4 | 5 | require ( 6 | github.com/hyperledger/fabric-gateway v1.7.0 7 | google.golang.org/grpc v1.71.0 8 | ) 9 | 10 | require ( 11 | github.com/hyperledger/fabric-protos-go-apiv2 v0.3.4 // indirect 12 | github.com/miekg/pkcs11 v1.1.1 // indirect 13 | golang.org/x/crypto v0.32.0 // indirect 14 | golang.org/x/net v0.34.0 // indirect 15 | golang.org/x/sys v0.29.0 // indirect 16 | golang.org/x/text v0.21.0 // indirect 17 | google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f // indirect 18 | google.golang.org/protobuf v1.36.4 // indirect 19 | ) 20 | -------------------------------------------------------------------------------- /hardware-security-module/application-typescript/.gitignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | node_modules/ 3 | package-lock.json 4 | -------------------------------------------------------------------------------- /hardware-security-module/application-typescript/eslint.config.mjs: -------------------------------------------------------------------------------- 1 | import js from '@eslint/js'; 2 | import tseslint from 'typescript-eslint'; 3 | 4 | export default tseslint.config(js.configs.recommended, ...tseslint.configs.strictTypeChecked, { 5 | languageOptions: { 6 | ecmaVersion: 2023, 7 | sourceType: 'module', 8 | parserOptions: { 9 | project: 'tsconfig.json', 10 | tsconfigRootDir: import.meta.dirname, 11 | }, 12 | }, 13 | }); 14 | -------------------------------------------------------------------------------- /hardware-security-module/application-typescript/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@tsconfig/node18/tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "declaration": true, 6 | "declarationMap": true, 7 | "sourceMap": true, 8 | "noUnusedLocals": true, 9 | "noImplicitReturns": true, 10 | "noUncheckedIndexedAccess": true, 11 | "forceConsistentCasingInFileNames": true 12 | }, 13 | "include": ["./src/**/*"], 14 | "exclude": ["./src/**/*.spec.ts"] 15 | } 16 | -------------------------------------------------------------------------------- /hardware-security-module/ca-client-config/.gitignore: -------------------------------------------------------------------------------- 1 | fabric-ca-client-config.yaml -------------------------------------------------------------------------------- /high-throughput/application-go/.gitignore: -------------------------------------------------------------------------------- 1 | wallet 2 | !wallet/.gitkeep 3 | 4 | keystore 5 | -------------------------------------------------------------------------------- /high-throughput/chaincode-go/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/hyperledger/fabric-samples/high-throughput/chaincode 2 | 3 | go 1.23.0 4 | 5 | require ( 6 | github.com/hyperledger/fabric-chaincode-go v0.0.0-20230228194215-b84622ba6a7a 7 | github.com/hyperledger/fabric-protos-go v0.3.0 8 | ) 9 | 10 | require ( 11 | github.com/golang/protobuf v1.5.3 // indirect 12 | golang.org/x/net v0.9.0 // indirect 13 | golang.org/x/sys v0.7.0 // indirect 14 | golang.org/x/text v0.9.0 // indirect 15 | google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect 16 | google.golang.org/grpc v1.56.3 // indirect 17 | google.golang.org/protobuf v1.30.0 // indirect 18 | ) 19 | -------------------------------------------------------------------------------- /high-throughput/networkDown.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Copyright IBM Corp All Rights Reserved 4 | # 5 | # SPDX-License-Identifier: Apache-2.0 6 | # 7 | # Exit on first error 8 | set -ex 9 | 10 | # Bring the test network down 11 | pushd ../test-network 12 | ./network.sh down 13 | popd 14 | 15 | 16 | rm -rf application-go/wallet/ 17 | rm -rf application-go/keystore/ -------------------------------------------------------------------------------- /high-throughput/startFabric.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Copyright IBM Corp All Rights Reserved 4 | # 5 | # SPDX-License-Identifier: Apache-2.0 6 | # 7 | # Exit on first error 8 | set -e 9 | 10 | # don't rewrite paths for Windows Git Bash users 11 | export MSYS_NO_PATHCONV=1 12 | starttime=$(date +%s) 13 | export TIMEOUT=10 14 | export DELAY=3 15 | 16 | # launch network; create channel and join peer to channel 17 | pushd ../test-network 18 | ./network.sh down 19 | 20 | echo "Bring up test network" 21 | ./network.sh up createChannel -ca 22 | ./network.sh deployCC -ccn bigdatacc -ccp ../high-throughput/chaincode-go/ -ccl go -ccep "OR('Org1MSP.peer','Org2MSP.peer')" -cci Init 23 | popd 24 | cat < writes) throws IOException; 13 | } 14 | -------------------------------------------------------------------------------- /off_chain_data/application-java/app/src/main/java/parser/Block.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright IBM Corp. All Rights Reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package parser; 8 | 9 | import com.google.protobuf.InvalidProtocolBufferException; 10 | 11 | import java.util.List; 12 | 13 | public interface Block { 14 | long getNumber(); 15 | List getTransactions() throws InvalidProtocolBufferException; 16 | org.hyperledger.fabric.protos.common.Block toProto(); 17 | } 18 | -------------------------------------------------------------------------------- /off_chain_data/application-java/app/src/main/java/parser/BlockParser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright IBM Corp. All Rights Reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package parser; 8 | 9 | public final class BlockParser { 10 | public static Block parseBlock(final org.hyperledger.fabric.protos.common.Block block) { 11 | return new ParsedBlock(block); 12 | } 13 | 14 | private BlockParser() { } 15 | } 16 | -------------------------------------------------------------------------------- /off_chain_data/application-java/app/src/main/java/parser/NamespaceReadWriteSet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright IBM Corp. All Rights Reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package parser; 8 | 9 | import com.google.protobuf.InvalidProtocolBufferException; 10 | import org.hyperledger.fabric.protos.ledger.rwset.NsReadWriteSet; 11 | import org.hyperledger.fabric.protos.ledger.rwset.kvrwset.KVRWSet; 12 | 13 | public interface NamespaceReadWriteSet { 14 | String getNamespace(); 15 | KVRWSet getReadWriteSet() throws InvalidProtocolBufferException; 16 | NsReadWriteSet toProto(); 17 | } 18 | -------------------------------------------------------------------------------- /off_chain_data/application-java/app/src/main/java/parser/Transaction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright IBM Corp. All Rights Reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package parser; 8 | 9 | import com.google.protobuf.InvalidProtocolBufferException; 10 | import org.hyperledger.fabric.client.identity.Identity; 11 | import org.hyperledger.fabric.protos.common.ChannelHeader; 12 | import org.hyperledger.fabric.protos.common.Payload; 13 | import org.hyperledger.fabric.protos.peer.TxValidationCode; 14 | 15 | import java.util.List; 16 | 17 | public interface Transaction { 18 | ChannelHeader getChannelHeader() throws InvalidProtocolBufferException; 19 | Identity getCreator() throws InvalidProtocolBufferException; 20 | TxValidationCode getValidationCode(); 21 | boolean isValid(); 22 | List getNamespaceReadWriteSets() throws InvalidProtocolBufferException; 23 | Payload toProto(); 24 | } 25 | -------------------------------------------------------------------------------- /off_chain_data/application-java/config/checkstyle/java-copyright-header.txt: -------------------------------------------------------------------------------- 1 | ^/\*$ 2 | ^ \* Copyright IBM Corp\. All Rights Reserved\.$ 3 | ^ \*$ 4 | ^ \* SPDX-License-Identifier: Apache-2\.0$ 5 | ^ \*/$ 6 | -------------------------------------------------------------------------------- /off_chain_data/application-java/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/off_chain_data/application-java/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /off_chain_data/application-java/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /off_chain_data/application-java/settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright IBM Corp. All Rights Reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | rootProject.name = 'off-chain-data' 8 | include('app') 9 | -------------------------------------------------------------------------------- /off_chain_data/application-typescript/.gitignore: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | 5 | # Coverage directory used by tools like istanbul 6 | coverage 7 | 8 | # Dependency directories 9 | node_modules/ 10 | jspm_packages/ 11 | 12 | # Compiled TypeScript files 13 | dist 14 | 15 | # Files generated by the application at runtime 16 | checkpoint.json 17 | store.log 18 | -------------------------------------------------------------------------------- /off_chain_data/application-typescript/.npmrc: -------------------------------------------------------------------------------- 1 | engine-strict=true 2 | -------------------------------------------------------------------------------- /off_chain_data/application-typescript/eslint.config.mjs: -------------------------------------------------------------------------------- 1 | import js from '@eslint/js'; 2 | import tseslint from 'typescript-eslint'; 3 | 4 | export default tseslint.config(js.configs.recommended, ...tseslint.configs.strictTypeChecked, { 5 | languageOptions: { 6 | ecmaVersion: 2023, 7 | sourceType: 'module', 8 | parserOptions: { 9 | project: 'tsconfig.json', 10 | tsconfigRootDir: import.meta.dirname, 11 | }, 12 | }, 13 | }); 14 | -------------------------------------------------------------------------------- /off_chain_data/application-typescript/src/expectedError.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright IBM Corp. All Rights Reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | export class ExpectedError extends Error { 8 | constructor(message?: string) { 9 | super(message); 10 | this.name = ExpectedError.name; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /off_chain_data/application-typescript/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@tsconfig/node18/tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "declaration": true, 6 | "declarationMap": true, 7 | "sourceMap": true, 8 | "noUnusedLocals": true, 9 | "noImplicitReturns": true, 10 | "noUncheckedIndexedAccess": true, 11 | "forceConsistentCasingInFileNames": true 12 | }, 13 | "include": ["./src/**/*"], 14 | "exclude": ["./src/**/*.spec.ts"] 15 | } 16 | -------------------------------------------------------------------------------- /test-network-k8s/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | network.log 3 | network-debug.log 4 | build/ 5 | .env 6 | bin/ 7 | *.tgz 8 | -------------------------------------------------------------------------------- /test-network-k8s/docs/images/test-network.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/test-network-k8s/docs/images/test-network.png -------------------------------------------------------------------------------- /test-network-k8s/kube/fabric-builder-role.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright IBM Corp. All Rights Reserved. 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | --- 7 | apiVersion: rbac.authorization.k8s.io/v1 8 | kind: Role 9 | metadata: 10 | name: fabric-builder-role 11 | rules: 12 | - apiGroups: 13 | - "" 14 | - apps 15 | - batch 16 | resources: 17 | - pods 18 | - jobs 19 | - configmaps 20 | - secrets 21 | verbs: 22 | - get 23 | - list 24 | - watch 25 | - create 26 | - delete 27 | - patch -------------------------------------------------------------------------------- /test-network-k8s/kube/fabric-builder-rolebinding.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright IBM Corp. All Rights Reserved. 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | --- 7 | apiVersion: rbac.authorization.k8s.io/v1 8 | kind: RoleBinding 9 | metadata: 10 | name: fabric-builder-rolebinding 11 | roleRef: 12 | apiGroup: rbac.authorization.k8s.io 13 | kind: Role 14 | name: fabric-builder-role 15 | subjects: 16 | - namespace: ${ORG1_NS} 17 | kind: ServiceAccount 18 | name: default -------------------------------------------------------------------------------- /test-network-k8s/kube/ns-test-network.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright IBM Corp. All Rights Reserved. 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | --- 7 | apiVersion: v1 8 | kind: Namespace 9 | metadata: 10 | name: test-network 11 | -------------------------------------------------------------------------------- /test-network-k8s/kube/org0/org0-job-scrub-fabric-volumes.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright IBM Corp. All Rights Reserved. 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | --- 7 | apiVersion: batch/v1 8 | kind: Job 9 | metadata: 10 | name: job-scrub-fabric-volumes 11 | spec: 12 | backoffLimit: 0 13 | completions: 1 14 | template: 15 | metadata: 16 | name: job-scrub-fabric-volumes 17 | spec: 18 | restartPolicy: "Never" 19 | containers: 20 | - name: main 21 | image: busybox:latest 22 | command: 23 | - sh 24 | - -c 25 | - "rm -rvf /mnt/fabric-*/*" 26 | volumeMounts: 27 | - name: fabric-org0-volume 28 | mountPath: /mnt/fabric-org0 29 | volumes: 30 | - name: fabric-org0-volume 31 | persistentVolumeClaim: 32 | claimName: fabric-org0 33 | -------------------------------------------------------------------------------- /test-network-k8s/kube/org0/org0-tls-cert-issuer.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright IBM Corp. All Rights Reserved. 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | --- 7 | apiVersion: cert-manager.io/v1 8 | kind: Certificate 9 | metadata: 10 | name: org0-tls-cert-issuer 11 | spec: 12 | isCA: true 13 | privateKey: 14 | algorithm: ECDSA 15 | size: 256 16 | commonName: org0.example.com 17 | secretName: org0-tls-cert-issuer-secret 18 | issuerRef: 19 | name: root-tls-cert-issuer 20 | kind: Issuer 21 | group: cert-manager.io 22 | 23 | --- 24 | apiVersion: cert-manager.io/v1 25 | kind: Issuer 26 | metadata: 27 | name: org0-tls-cert-issuer 28 | spec: 29 | ca: 30 | secretName: org0-tls-cert-issuer-secret 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /test-network-k8s/kube/org1/org1-job-scrub-fabric-volumes.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright IBM Corp. All Rights Reserved. 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | --- 7 | apiVersion: batch/v1 8 | kind: Job 9 | metadata: 10 | name: job-scrub-fabric-volumes 11 | spec: 12 | backoffLimit: 0 13 | completions: 1 14 | template: 15 | metadata: 16 | name: job-scrub-fabric-volumes 17 | spec: 18 | restartPolicy: "Never" 19 | containers: 20 | - name: main 21 | image: busybox:latest 22 | command: 23 | - sh 24 | - -c 25 | - "rm -rvf /mnt/fabric-*/*" 26 | volumeMounts: 27 | - name: fabric-org1-volume 28 | mountPath: /mnt/fabric-org1 29 | volumes: 30 | - name: fabric-org1-volume 31 | persistentVolumeClaim: 32 | claimName: fabric-org1 33 | -------------------------------------------------------------------------------- /test-network-k8s/kube/org1/org1-tls-cert-issuer.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright IBM Corp. All Rights Reserved. 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | --- 7 | apiVersion: cert-manager.io/v1 8 | kind: Certificate 9 | metadata: 10 | name: org1-tls-cert-issuer 11 | spec: 12 | isCA: true 13 | privateKey: 14 | algorithm: ECDSA 15 | size: 256 16 | commonName: org1.example.com 17 | secretName: org1-tls-cert-issuer-secret 18 | issuerRef: 19 | name: root-tls-cert-issuer 20 | kind: Issuer 21 | group: cert-manager.io 22 | 23 | --- 24 | apiVersion: cert-manager.io/v1 25 | kind: Issuer 26 | metadata: 27 | name: org1-tls-cert-issuer 28 | spec: 29 | ca: 30 | secretName: org1-tls-cert-issuer-secret 31 | 32 | 33 | -------------------------------------------------------------------------------- /test-network-k8s/kube/org2/org2-job-scrub-fabric-volumes.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright IBM Corp. All Rights Reserved. 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | --- 7 | apiVersion: batch/v1 8 | kind: Job 9 | metadata: 10 | name: job-scrub-fabric-volumes 11 | spec: 12 | backoffLimit: 0 13 | completions: 1 14 | template: 15 | metadata: 16 | name: job-scrub-fabric-volumes 17 | spec: 18 | restartPolicy: "Never" 19 | containers: 20 | - name: main 21 | image: busybox:latest 22 | command: 23 | - sh 24 | - -c 25 | - "rm -rvf /mnt/fabric-*/*" 26 | volumeMounts: 27 | - name: fabric-org2-volume 28 | mountPath: /mnt/fabric-org2 29 | volumes: 30 | - name: fabric-org2-volume 31 | persistentVolumeClaim: 32 | claimName: fabric-org2 33 | 34 | -------------------------------------------------------------------------------- /test-network-k8s/kube/org2/org2-tls-cert-issuer.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright IBM Corp. All Rights Reserved. 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | --- 7 | apiVersion: cert-manager.io/v1 8 | kind: Certificate 9 | metadata: 10 | name: org2-tls-cert-issuer 11 | spec: 12 | isCA: true 13 | privateKey: 14 | algorithm: ECDSA 15 | size: 256 16 | commonName: org2.example.com 17 | secretName: org2-tls-cert-issuer-secret 18 | issuerRef: 19 | name: root-tls-cert-issuer 20 | kind: Issuer 21 | group: cert-manager.io 22 | 23 | --- 24 | apiVersion: cert-manager.io/v1 25 | kind: Issuer 26 | metadata: 27 | name: org2-tls-cert-issuer 28 | spec: 29 | ca: 30 | secretName: org2-tls-cert-issuer-secret 31 | 32 | 33 | -------------------------------------------------------------------------------- /test-network-k8s/kube/pvc-fabric-org0.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright IBM Corp. All Rights Reserved. 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | --- 7 | apiVersion: v1 8 | kind: PersistentVolumeClaim 9 | metadata: 10 | name: fabric-org0 11 | spec: 12 | accessModes: 13 | - ReadWriteOnce 14 | storageClassName: ${STORAGE_CLASS} 15 | resources: 16 | requests: 17 | storage: 1Gi 18 | -------------------------------------------------------------------------------- /test-network-k8s/kube/pvc-fabric-org1.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright IBM Corp. All Rights Reserved. 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | --- 7 | apiVersion: v1 8 | kind: PersistentVolumeClaim 9 | metadata: 10 | name: fabric-org1 11 | spec: 12 | accessModes: 13 | - ReadWriteOnce 14 | storageClassName: ${STORAGE_CLASS} 15 | resources: 16 | requests: 17 | storage: 1Gi 18 | -------------------------------------------------------------------------------- /test-network-k8s/kube/pvc-fabric-org2.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright IBM Corp. All Rights Reserved. 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | --- 7 | apiVersion: v1 8 | kind: PersistentVolumeClaim 9 | metadata: 10 | name: fabric-org2 11 | spec: 12 | accessModes: 13 | - ReadWriteOnce 14 | storageClassName: ${STORAGE_CLASS} 15 | resources: 16 | requests: 17 | storage: 1Gi 18 | -------------------------------------------------------------------------------- /test-network-k8s/kube/root-tls-cert-issuer.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright IBM Corp. All Rights Reserved. 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | # 6 | --- 7 | apiVersion: cert-manager.io/v1 8 | kind: Issuer 9 | metadata: 10 | name: root-tls-cert-issuer 11 | spec: 12 | selfSigned: {} 13 | -------------------------------------------------------------------------------- /test-network-k8s/scripts/appuser.id.template: -------------------------------------------------------------------------------- 1 | { 2 | "credentials": { 3 | "certificate": "${CERTIFICATE}", 4 | "privateKey": "${PRIVATE_KEY}" 5 | }, 6 | "mspId": "${MSPID}", 7 | "type": "X.509", 8 | "version": 1 9 | } -------------------------------------------------------------------------------- /test-network-nano-bash/.gitignore: -------------------------------------------------------------------------------- 1 | channel-artifacts/ 2 | crypto-config/ 3 | data/ 4 | data_ca/ 5 | logs/ 6 | *.gz 7 | chaincode-external/ 8 | -------------------------------------------------------------------------------- /test-network-nano-bash/ca/ccp-template.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: test-network-org${ORG} 3 | version: 1.0.0 4 | client: 5 | organization: Org${ORG} 6 | connection: 7 | timeout: 8 | peer: 9 | endorser: '300' 10 | organizations: 11 | Org${ORG}: 12 | mspid: Org${ORG}MSP 13 | peers: 14 | - peer0.org${ORG}.example.com 15 | certificateAuthorities: 16 | - ca.org${ORG}.example.com 17 | peers: 18 | peer0.org${ORG}.example.com: 19 | url: grpcs://127.0.0.1:${P0PORT} 20 | tlsCACerts: 21 | pem: | 22 | ${PEERPEM} 23 | grpcOptions: 24 | ssl-target-name-override: localhost 25 | certificateAuthorities: 26 | ca.org${ORG}.example.com: 27 | url: https://127.0.0.1:${CAPORT} 28 | caName: ca 29 | tlsCACerts: 30 | pem: 31 | - | 32 | ${CAPEM} 33 | httpOptions: 34 | verify: false 35 | -------------------------------------------------------------------------------- /test-network-nano-bash/ca/config.yaml: -------------------------------------------------------------------------------- 1 | NodeOUs: 2 | Enable: true 3 | ClientOUIdentifier: 4 | Certificate: cacerts/ca.example.com-cert.pem 5 | OrganizationalUnitIdentifier: client 6 | PeerOUIdentifier: 7 | Certificate: cacerts/ca.example.com-cert.pem 8 | OrganizationalUnitIdentifier: peer 9 | AdminOUIdentifier: 10 | Certificate: cacerts/ca.example.com-cert.pem 11 | OrganizationalUnitIdentifier: admin 12 | OrdererOUIdentifier: 13 | Certificate: cacerts/ca.example.com-cert.pem 14 | OrganizationalUnitIdentifier: orderer 15 | -------------------------------------------------------------------------------- /test-network-nano-bash/ca_terminal_setup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/test-network-nano-bash/ca_terminal_setup.png -------------------------------------------------------------------------------- /test-network-nano-bash/chaincode-external/connection.json: -------------------------------------------------------------------------------- 1 | { 2 | "address": "127.0.0.1:9999", 3 | "dial_timeout": "10s", 4 | "tls_required": false 5 | } 6 | -------------------------------------------------------------------------------- /test-network-nano-bash/chaincode-external/metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "ccaas", 3 | "label": "basic_1.0" 4 | } 5 | -------------------------------------------------------------------------------- /test-network-nano-bash/chaincode_interaction.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | # 5 | 6 | . peer1admin.sh 7 | 8 | { 9 | peer chaincode invoke -o 127.0.0.1:6050 -C mychannel -n basic -c '{"Args":["CreateAsset","1","blue","35","tom","1000"]}' --waitForEvent --tls --cafile "${PWD}"/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/ca.crt 10 | peer chaincode query -C mychannel -n basic -c '{"Args":["ReadAsset","1"]}' 11 | peer chaincode invoke -o 127.0.0.1:6050 -C mychannel -n basic -c '{"Args":["UpdateAsset","1","blue","35","jerry","1000"]}' --waitForEvent --tls --cafile "${PWD}"/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/ca.crt 12 | peer chaincode query -C mychannel -n basic -c '{"Args":["ReadAsset","1"]}' 13 | } >> ./logs/chaincode_interaction.log 2>&1 14 | -------------------------------------------------------------------------------- /test-network-nano-bash/configureExternalBuilders.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | mkdir -p config 4 | 5 | sed -e '/externalBuilders:/r ./external_builders/core_yaml_change.yaml' ../config/core.yaml | sed -e "s|_working_dir_|$PWD|g" > ./config/core.yaml 6 | 7 | -------------------------------------------------------------------------------- /test-network-nano-bash/external_builders/core_yaml_change.yaml: -------------------------------------------------------------------------------- 1 | - name: golang 2 | path: _working_dir_/external_builders/golang 3 | propagateEnvironment: 4 | - GOCACHE 5 | - GOENV 6 | - HOME 7 | - GOPROXY 8 | - name: node 9 | path: _working_dir_/external_builders/node 10 | propagateEnvironment: 11 | - HOME 12 | - npm_config_cache 13 | -------------------------------------------------------------------------------- /test-network-nano-bash/external_builders/golang/bin/build: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | # 5 | set -euo pipefail 6 | exec 1>&2 7 | CHAINCODE_SOURCE_DIR="$1" 8 | CHAINCODE_METADATA_DIR="$2" 9 | BUILD_OUTPUT_DIR="$3" 10 | GO_PACKAGE_PATH="$(jq -r .path "${CHAINCODE_METADATA_DIR}/metadata.json")" 11 | if [ -f "${CHAINCODE_SOURCE_DIR}/src/go.mod" ]; then 12 | cd "${CHAINCODE_SOURCE_DIR}/src" 13 | CGO_ENABLED=0 go build -v -o "${BUILD_OUTPUT_DIR}/chaincode" "${GO_PACKAGE_PATH}" 14 | else 15 | CGO_ENABLED=0 GOPATH="${CHAINCODE_SOURCE_DIR}" GO111MODULE=off go build -v -o "${BUILD_OUTPUT_DIR}/chaincode" "${GO_PACKAGE_PATH}" 16 | fi -------------------------------------------------------------------------------- /test-network-nano-bash/external_builders/golang/bin/detect: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | # 5 | set -euo pipefail 6 | exec 1>&2 7 | CHAINCODE_METADATA_DIR="$2" 8 | if [ "$(jq -r .type "${CHAINCODE_METADATA_DIR}/metadata.json" | tr '[:upper:]' '[:lower:]')" = "golang" ]; then 9 | exit 0 10 | fi 11 | exit 1 -------------------------------------------------------------------------------- /test-network-nano-bash/external_builders/golang/bin/release: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | # 5 | set -xeuo pipefail 6 | exec 1>&2 7 | 8 | BUILD_OUTPUT_DIR="$1" 9 | RELEASE_OUTPUT_DIR="$2" 10 | if [ -d "${BUILD_OUTPUT_DIR}/META-INF" ] ; then 11 | cp -a "${BUILD_OUTPUT_DIR}/META-INF/"* "${RELEASE_OUTPUT_DIR}/" 12 | fi 13 | -------------------------------------------------------------------------------- /test-network-nano-bash/external_builders/node/bin/build: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | # 5 | set -euo pipefail 6 | exec 1>&2 7 | CHAINCODE_SOURCE_DIR="$1" 8 | # CHAINCODE_METADATA_DIR="$2" 9 | BUILD_OUTPUT_DIR="$3" 10 | cd "${CHAINCODE_SOURCE_DIR}/src" 11 | tar cf - . | (cd "${BUILD_OUTPUT_DIR}" && tar xf -) 12 | cd "${BUILD_OUTPUT_DIR}" 13 | if [ -f package-lock.json ] || [ -f npm-shrinkwrap.json ]; then 14 | npm ci --only=production 15 | else 16 | npm install --production 17 | fi -------------------------------------------------------------------------------- /test-network-nano-bash/external_builders/node/bin/detect: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | # 5 | set -euo pipefail 6 | exec 1>&2 7 | CHAINCODE_METADATA_DIR="$2" 8 | if [ "$(jq -r .type "${CHAINCODE_METADATA_DIR}/metadata.json" | tr '[:upper:]' '[:lower:]')" = "node" ]; then 9 | exit 0 10 | fi 11 | exit 1 -------------------------------------------------------------------------------- /test-network-nano-bash/external_builders/node/bin/release: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | # 5 | set -euo pipefail 6 | exec 1>&2 7 | BUILD_OUTPUT_DIR="$1" 8 | RELEASE_OUTPUT_DIR="$2" 9 | if [ -d "${BUILD_OUTPUT_DIR}/META-INF" ] ; then 10 | cp -a "${BUILD_OUTPUT_DIR}/META-INF/"* "${RELEASE_OUTPUT_DIR}/" 11 | fi -------------------------------------------------------------------------------- /test-network-nano-bash/join_channel.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | # 5 | set -eu 6 | 7 | # join peer to channel 8 | peer channel join -b "${PWD}"/channel-artifacts/mychannel.block 9 | -------------------------------------------------------------------------------- /test-network-nano-bash/peer1admin.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | # 5 | 6 | # look for binaries in local dev environment /build/bin directory and then in local samples /bin directory 7 | export PATH="${PWD}"/../../fabric/build/bin:"${PWD}"/../bin:"$PATH" 8 | export FABRIC_CFG_PATH="${PWD}"/../config 9 | 10 | export FABRIC_LOGGING_SPEC=INFO 11 | export CORE_PEER_TLS_ENABLED=true 12 | export CORE_PEER_TLS_ROOTCERT_FILE="${PWD}"/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt 13 | export CORE_PEER_ADDRESS=127.0.0.1:7051 14 | export CORE_PEER_LOCALMSPID=Org1MSP 15 | export CORE_PEER_MSPCONFIGPATH="${PWD}"/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp 16 | -------------------------------------------------------------------------------- /test-network-nano-bash/peer2admin.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | # 5 | 6 | # look for binaries in local dev environment /build/bin directory and then in local samples /bin directory 7 | export PATH="${PWD}"/../../fabric/build/bin:"${PWD}"/../bin:"$PATH" 8 | export FABRIC_CFG_PATH="${PWD}"/../config 9 | 10 | export FABRIC_LOGGING_SPEC=INFO 11 | export CORE_PEER_TLS_ENABLED=true 12 | export CORE_PEER_TLS_ROOTCERT_FILE="${PWD}"/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt 13 | export CORE_PEER_ADDRESS=127.0.0.1:7053 14 | export CORE_PEER_LOCALMSPID=Org1MSP 15 | export CORE_PEER_MSPCONFIGPATH="${PWD}"/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp 16 | -------------------------------------------------------------------------------- /test-network-nano-bash/peer3admin.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | # 5 | 6 | # look for binaries in local dev environment /build/bin directory and then in local samples /bin directory 7 | export PATH="${PWD}"/../../fabric/build/bin:"${PWD}"/../bin:"$PATH" 8 | export FABRIC_CFG_PATH="${PWD}"/../config 9 | 10 | export FABRIC_LOGGING_SPEC=INFO 11 | export CORE_PEER_TLS_ENABLED=true 12 | export CORE_PEER_TLS_ROOTCERT_FILE="${PWD}"/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt 13 | export CORE_PEER_ADDRESS=127.0.0.1:7055 14 | export CORE_PEER_LOCALMSPID=Org2MSP 15 | export CORE_PEER_MSPCONFIGPATH="${PWD}"/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp 16 | -------------------------------------------------------------------------------- /test-network-nano-bash/peer4admin.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | # 5 | 6 | # look for binaries in local dev environment /build/bin directory and then in local samples /bin directory 7 | export PATH="${PWD}"/../../fabric/build/bin:"${PWD}"/../bin:"$PATH" 8 | export FABRIC_CFG_PATH="${PWD}"/../config 9 | 10 | export FABRIC_LOGGING_SPEC=INFO 11 | export CORE_PEER_TLS_ENABLED=true 12 | export CORE_PEER_TLS_ROOTCERT_FILE="${PWD}"/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls/ca.crt 13 | export CORE_PEER_ADDRESS=127.0.0.1:7057 14 | export CORE_PEER_LOCALMSPID=Org2MSP 15 | export CORE_PEER_MSPCONFIGPATH="${PWD}"/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp 16 | -------------------------------------------------------------------------------- /test-network-nano-bash/terminal_setup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/test-network-nano-bash/terminal_setup.png -------------------------------------------------------------------------------- /test-network/.gitignore: -------------------------------------------------------------------------------- 1 | /channel-artifacts/*.tx 2 | /channel-artifacts/*.block 3 | /ledgers 4 | /ledgers-backup 5 | /channel-artifacts/*.json 6 | /channel-artifacts/*.pb 7 | /org3-artifacts/crypto-config/* 8 | organizations/fabric-ca/ordererOrg/* 9 | organizations/fabric-ca/org1/* 10 | organizations/fabric-ca/org2/* 11 | addOrg3/fabric-ca/org3/* 12 | organizations/ordererOrganizations/* 13 | organizations/peerOrganizations/* 14 | system-genesis-block/* 15 | *.tar.gz 16 | log.txt 17 | -------------------------------------------------------------------------------- /test-network/addOrg3/compose/compose-ca-org3.yaml: -------------------------------------------------------------------------------- 1 | # Copyright IBM Corp. All Rights Reserved. 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | # 5 | 6 | version: '3.7' 7 | 8 | networks: 9 | test: 10 | name: fabric_test 11 | 12 | services: 13 | ca_org3: 14 | image: hyperledger/fabric-ca:latest 15 | labels: 16 | service: hyperledger-fabric 17 | environment: 18 | - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server 19 | - FABRIC_CA_SERVER_CA_NAME=ca-org3 20 | - FABRIC_CA_SERVER_TLS_ENABLED=true 21 | - FABRIC_CA_SERVER_PORT=11054 22 | ports: 23 | - "11054:11054" 24 | command: sh -c 'fabric-ca-server start -b admin:adminpw -d' 25 | volumes: 26 | - ../fabric-ca/org3:/etc/hyperledger/fabric-ca-server 27 | container_name: ca_org3 28 | -------------------------------------------------------------------------------- /test-network/addOrg3/compose/docker/docker-compose-ca-org3.yaml: -------------------------------------------------------------------------------- 1 | # Copyright IBM Corp. All Rights Reserved. 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | # 5 | 6 | version: '3.7' 7 | 8 | -------------------------------------------------------------------------------- /test-network/addOrg3/compose/docker/docker-compose-couch-org3.yaml: -------------------------------------------------------------------------------- 1 | # Copyright IBM Corp. All Rights Reserved. 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | # 5 | 6 | version: '3.7' 7 | 8 | -------------------------------------------------------------------------------- /test-network/addOrg3/compose/docker/docker-compose-org3.yaml: -------------------------------------------------------------------------------- 1 | # Copyright IBM Corp. All Rights Reserved. 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | # 5 | 6 | version: '3.7' 7 | 8 | networks: 9 | test: 10 | name: fabric_test 11 | 12 | services: 13 | 14 | peer0.org3.example.com: 15 | container_name: peer0.org3.example.com 16 | image: hyperledger/fabric-peer:latest 17 | labels: 18 | service: hyperledger-fabric 19 | environment: 20 | #Generic peer variables 21 | - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock 22 | - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=fabric_test 23 | volumes: 24 | - ./docker/peercfg:/etc/hyperledger/peercfg 25 | - ${DOCKER_SOCK}:/host/var/run/docker.sock 26 | -------------------------------------------------------------------------------- /test-network/addOrg3/compose/podman/podman-compose-ca-org3.yaml: -------------------------------------------------------------------------------- 1 | # Copyright IBM Corp. All Rights Reserved. 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | # 5 | 6 | version: '3.7' 7 | 8 | networks: 9 | test: 10 | name: fabric_test 11 | 12 | services: 13 | ca_org3: 14 | image: hyperledger/fabric-ca:latest 15 | labels: 16 | service: hyperledger-fabric 17 | environment: 18 | - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server 19 | - FABRIC_CA_SERVER_CA_NAME=ca-org3 20 | - FABRIC_CA_SERVER_TLS_ENABLED=true 21 | - FABRIC_CA_SERVER_PORT=11054 22 | ports: 23 | - "11054:11054" 24 | command: sh -c 'fabric-ca-server start -b admin:adminpw -d' 25 | volumes: 26 | - ../fabric-ca/org3:/etc/hyperledger/fabric-ca-server 27 | container_name: ca_org3 28 | -------------------------------------------------------------------------------- /test-network/addOrg3/org3-crypto.yaml: -------------------------------------------------------------------------------- 1 | # Copyright IBM Corp. All Rights Reserved. 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | # 5 | 6 | # --------------------------------------------------------------------------- 7 | # "PeerOrgs" - Definition of organizations managing peer nodes 8 | # --------------------------------------------------------------------------- 9 | PeerOrgs: 10 | # --------------------------------------------------------------------------- 11 | # Org3 12 | # --------------------------------------------------------------------------- 13 | - Name: Org3 14 | Domain: org3.example.com 15 | EnableNodeOUs: true 16 | Template: 17 | Count: 1 18 | SANS: 19 | - localhost 20 | Users: 21 | Count: 1 22 | -------------------------------------------------------------------------------- /test-network/compose/docker/docker-compose-ca.yaml: -------------------------------------------------------------------------------- 1 | # Copyright IBM Corp. All Rights Reserved. 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | # 5 | 6 | version: '3.7' 7 | 8 | -------------------------------------------------------------------------------- /test-network/compose/docker/docker-compose-couch.yaml: -------------------------------------------------------------------------------- 1 | # Copyright IBM Corp. All Rights Reserved. 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | # 5 | 6 | version: '3.7' 7 | -------------------------------------------------------------------------------- /test-network/compose/podman/podman-compose-ca.yaml: -------------------------------------------------------------------------------- 1 | # Copyright IBM Corp. All Rights Reserved. 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | # 5 | 6 | version: '3.7' 7 | -------------------------------------------------------------------------------- /test-network/compose/podman/podman-compose-couch.yaml: -------------------------------------------------------------------------------- 1 | # Copyright IBM Corp. All Rights Reserved. 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | # 5 | 6 | version: '3.7' 7 | -------------------------------------------------------------------------------- /test-network/compose/podman/podman-compose-test-net.yaml: -------------------------------------------------------------------------------- 1 | # Copyright IBM Corp. All Rights Reserved. 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | # 5 | 6 | version: '3.7' 7 | 8 | services: 9 | peer0.org1.example.com: 10 | volumes: 11 | - ./podman/peercfg:/etc/hyperledger/peercfg 12 | 13 | peer0.org2.example.com: 14 | volumes: 15 | - ./podman/peercfg:/etc/hyperledger/peercfg 16 | 17 | -------------------------------------------------------------------------------- /test-network/organizations/cfssl/admin-csr-template.json: -------------------------------------------------------------------------------- 1 | { 2 | "CN": "{USER}", 3 | "key": { 4 | "algo": "ecdsa", 5 | "size": 256 6 | }, 7 | "names": [ 8 | { 9 | "C": "IN", 10 | "ST": "Delhi", 11 | "L": "Aero city", 12 | "O": "cfssl", 13 | "OU": "admin" 14 | } 15 | ], 16 | "hosts": [ 17 | "{USER}", 18 | "localhost", 19 | "127.0.0.1", 20 | "0.0.0.0" 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /test-network/organizations/cfssl/ca-orderer.json: -------------------------------------------------------------------------------- 1 | { 2 | "CN": "cfssl-orderer-ca", 3 | "key": { 4 | "algo": "ecdsa", 5 | "size": 256 6 | }, 7 | "names": [ 8 | { 9 | "C": "IN", 10 | "ST": "Delhi", 11 | "L": "Aero city", 12 | "O": "cfssl", 13 | "OU": "client" 14 | } 15 | ], 16 | "hosts": [ 17 | "localhost", 18 | "127.0.0.1", 19 | "0.0.0.0" 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /test-network/organizations/cfssl/ca-peer.json: -------------------------------------------------------------------------------- 1 | { 2 | "CN": "cfssl-peer-ca", 3 | "key": { 4 | "algo": "ecdsa", 5 | "size": 256 6 | }, 7 | "names": [ 8 | { 9 | "C": "IN", 10 | "ST": "Delhi", 11 | "L": "Aero city", 12 | "O": "cfssl", 13 | "OU": "Fabric" 14 | } 15 | ], 16 | "hosts": [ 17 | "localhost", 18 | "127.0.0.1", 19 | "0.0.0.0" 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /test-network/organizations/cfssl/cert-signing-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "signing": { 3 | "default": { 4 | "expiry": "175200h" 5 | }, 6 | "profiles": { 7 | "sign": { 8 | "usages": [ 9 | "signing", 10 | "key encipherment", 11 | "cert sign", 12 | "digital signature" 13 | ], 14 | "expiry": "175200h" 15 | }, 16 | "tls": { 17 | "usages": [ 18 | "signing", 19 | "key encipherment", 20 | "server auth", 21 | "client auth" 22 | ], 23 | "expiry": "175200h" 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /test-network/organizations/cfssl/client-csr-template.json: -------------------------------------------------------------------------------- 1 | { 2 | "CN": "{USER}", 3 | "key": { 4 | "algo": "ecdsa", 5 | "size": 256 6 | }, 7 | "names": [ 8 | { 9 | "C": "IN", 10 | "ST": "Delhi", 11 | "L": "Aero city", 12 | "O": "cfssl", 13 | "OU": "client" 14 | } 15 | ], 16 | "hosts": [ 17 | "{USER}", 18 | "localhost", 19 | "127.0.0.1", 20 | "0.0.0.0" 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /test-network/organizations/cfssl/orderer-csr-template.json: -------------------------------------------------------------------------------- 1 | { 2 | "CN": "{USER}", 3 | "key": { 4 | "algo": "ecdsa", 5 | "size": 256 6 | }, 7 | "names": [ 8 | { 9 | "C": "IN", 10 | "ST": "Delhi", 11 | "L": "Aero city", 12 | "O": "cfssl", 13 | "OU": "orderer" 14 | } 15 | ], 16 | "hosts": [ 17 | "{USER}", 18 | "localhost", 19 | "127.0.0.1", 20 | "0.0.0.0" 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /test-network/organizations/cfssl/peer-csr-template.json: -------------------------------------------------------------------------------- 1 | { 2 | "CN": "{USER}", 3 | "key": { 4 | "algo": "ecdsa", 5 | "size": 256 6 | }, 7 | "names": [ 8 | { 9 | "C": "IN", 10 | "ST": "Delhi", 11 | "L": "Aero city", 12 | "O": "cfssl", 13 | "OU": "peer" 14 | } 15 | ], 16 | "hosts": [ 17 | "{USER}", 18 | "localhost", 19 | "127.0.0.1", 20 | "0.0.0.0" 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /test-network/prometheus-grafana/grafana/config.monitoring: -------------------------------------------------------------------------------- 1 | GF_SECURITY_ADMIN_PASSWORD=admin 2 | GF_USERS_ALLOW_SIGN_UP=false 3 | -------------------------------------------------------------------------------- /test-network/prometheus-grafana/grafana/provisioning/dashboards/dashboard.yml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | 3 | providers: 4 | - name: 'Prometheus' 5 | orgId: 1 6 | folder: '' 7 | type: file 8 | disableDeletion: false 9 | editable: true 10 | options: 11 | path: /etc/grafana/provisioning/dashboards 12 | -------------------------------------------------------------------------------- /test-network/prometheus-grafana/grafana_db/grafana.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/test-network/prometheus-grafana/grafana_db/grafana.db -------------------------------------------------------------------------------- /test-network/prometheus-grafana/prometheus/prometheus.yml: -------------------------------------------------------------------------------- 1 | global: 2 | scrape_interval: 1s 3 | external_labels: 4 | monitor: 'devopsage-monitor' 5 | 6 | scrape_configs: 7 | - job_name: "prometheus" 8 | static_configs: 9 | - targets: ["localhost:9090"] 10 | - job_name: "orderer" 11 | static_configs: 12 | - targets: ["orderer.example.com:9443"] 13 | - job_name: "peer0_org1" 14 | static_configs: 15 | - targets: ["peer0.org1.example.com:9444"] 16 | - job_name: "peer0_org2" 17 | static_configs: 18 | - targets: ["peer0.org2.example.com:9445"] 19 | - job_name: cadvisor 20 | scrape_interval: 5s 21 | static_configs: 22 | - targets: ['cadvisor:8080'] 23 | - job_name: node 24 | static_configs: 25 | - targets: ['node-exporter:9100'] 26 | -------------------------------------------------------------------------------- /test-network/scripts/orderer.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | channel_name=$1 5 | 6 | export PATH=${ROOTDIR}/../bin:${PWD}/../bin:$PATH 7 | export ORDERER_ADMIN_TLS_SIGN_CERT=${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt /dev/null 2>&1 8 | export ORDERER_ADMIN_TLS_PRIVATE_KEY=${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.key /dev/null 2>&1 9 | 10 | osnadmin channel join --channelID ${channel_name} --config-block ./channel-artifacts/${channel_name}.block -o localhost:7053 --ca-file "$ORDERER_CA" --client-cert "$ORDERER_ADMIN_TLS_SIGN_CERT" --client-key "$ORDERER_ADMIN_TLS_PRIVATE_KEY" >> log.txt 2>&1 -------------------------------------------------------------------------------- /test-network/scripts/orderer2.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | channel_name=$1 5 | 6 | export PATH=${ROOTDIR}/../bin:${PWD}/../bin:$PATH 7 | export ORDERER_ADMIN_TLS_SIGN_CERT=${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/server.crt /dev/null 2>&1 8 | export ORDERER_ADMIN_TLS_PRIVATE_KEY=${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/server.key > /dev/null 2>&1 9 | 10 | osnadmin channel join --channelID ${channel_name} --config-block ./channel-artifacts/${channel_name}.block -o localhost:7055 --ca-file "$ORDERER_CA" --client-cert "$ORDERER_ADMIN_TLS_SIGN_CERT" --client-key "$ORDERER_ADMIN_TLS_PRIVATE_KEY" >> log.txt 2>&1 -------------------------------------------------------------------------------- /test-network/scripts/orderer3.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | channel_name=$1 5 | 6 | export PATH=${ROOTDIR}/../bin:${PWD}/../bin:$PATH 7 | export ORDERER_ADMIN_TLS_SIGN_CERT=${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer3.example.com/tls/server.crt /dev/null 2>&1 8 | export ORDERER_ADMIN_TLS_PRIVATE_KEY=${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer3.example.com/tls/server.key > /dev/null 2>&1 9 | 10 | osnadmin channel join --channelID ${channel_name} --config-block ./channel-artifacts/${channel_name}.block -o localhost:7057 --ca-file "$ORDERER_CA" --client-cert "$ORDERER_ADMIN_TLS_SIGN_CERT" --client-key "$ORDERER_ADMIN_TLS_PRIVATE_KEY" >> log.txt 2>&1 -------------------------------------------------------------------------------- /test-network/scripts/orderer4.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | channel_name=$1 5 | 6 | export PATH=${ROOTDIR}/../bin:${PWD}/../bin:$PATH 7 | export ORDERER_ADMIN_TLS_SIGN_CERT=${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer4.example.com/tls/server.crt /dev/null 2>&1 8 | export ORDERER_ADMIN_TLS_PRIVATE_KEY=${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer4.example.com/tls/server.key > /dev/null 2>&1 9 | 10 | osnadmin channel join --channelID ${channel_name} --config-block ./channel-artifacts/${channel_name}.block -o localhost:7059 --ca-file "$ORDERER_CA" --client-cert "$ORDERER_ADMIN_TLS_SIGN_CERT" --client-key "$ORDERER_ADMIN_TLS_PRIVATE_KEY" >> log.txt 2>&1 -------------------------------------------------------------------------------- /test-network/system-genesis-block/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/test-network/system-genesis-block/.gitkeep -------------------------------------------------------------------------------- /token-erc-1155/chaincode-go/erc1155.go: -------------------------------------------------------------------------------- 1 | /* 2 | 2021 Baran Kılıç 3 | 4 | SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package main 8 | 9 | import ( 10 | "erc1155/chaincode" 11 | 12 | "github.com/hyperledger/fabric-contract-api-go/v2/contractapi" 13 | ) 14 | 15 | func main() { 16 | smartContract := new(chaincode.SmartContract) 17 | 18 | cc, err := contractapi.NewChaincode(smartContract) 19 | 20 | if err != nil { 21 | panic(err.Error()) 22 | } 23 | 24 | if err := cc.Start(); err != nil { 25 | panic(err.Error()) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /token-erc-20/chaincode-go/token_erc_20.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | */ 4 | 5 | package main 6 | 7 | import ( 8 | "log" 9 | 10 | "github.com/hyperledger/fabric-contract-api-go/v2/contractapi" 11 | "github.com/hyperledger/fabric-samples/token-erc-20/chaincode-go/chaincode" 12 | ) 13 | 14 | func main() { 15 | tokenChaincode, err := contractapi.NewChaincode(&chaincode.SmartContract{}) 16 | if err != nil { 17 | log.Panicf("Error creating token-erc-20 chaincode: %v", err) 18 | } 19 | 20 | if err := tokenChaincode.Start(); err != nil { 21 | log.Panicf("Error starting token-erc-20 chaincode: %v", err) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /token-erc-20/chaincode-java/config/checkstyle/suppressions.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /token-erc-20/chaincode-java/docker/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | # 5 | set -euo pipefail 6 | : ${CORE_PEER_TLS_ENABLED:="false"} 7 | : ${DEBUG:="false"} 8 | 9 | if [ "${DEBUG,,}" = "true" ]; then 10 | exec java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:8000 -jar /chaincode.jar 11 | elif [ "${CORE_PEER_TLS_ENABLED,,}" = "true" ]; then 12 | exec java -jar /chaincode.jar # todo 13 | else 14 | exec java -jar /chaincode.jar 15 | fi 16 | 17 | -------------------------------------------------------------------------------- /token-erc-20/chaincode-java/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/token-erc-20/chaincode-java/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /token-erc-20/chaincode-java/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /token-erc-20/chaincode-java/settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | */ 4 | 5 | rootProject.name = 'token_erc20' 6 | -------------------------------------------------------------------------------- /token-erc-20/chaincode-java/src/main/java/org/hyperledger/fabric/samples/erc20/ContractConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | */ 4 | 5 | package org.hyperledger.fabric.samples.erc20; 6 | 7 | /** ERC20 constants for KEYS ,EVENTS and MSP */ 8 | public enum ContractConstants { 9 | BALANCE_PREFIX("balance"), 10 | ALLOWANCE_PREFIX("allowance"), 11 | NAME_KEY("name"), 12 | SYMBOL_KEY("symbolKey"), 13 | DECIMALS_KEY("decimals"), 14 | TOTAL_SUPPLY_KEY("totalSupply"), 15 | TRANSFER_EVENT("Transfer"), 16 | MINTER_ORG_MSPID("Org1MSP"), 17 | APPROVAL("Approval"); 18 | 19 | private final String prefix; 20 | 21 | ContractConstants(final String value) { 22 | this.prefix = value; 23 | } 24 | 25 | public String getValue() { 26 | return prefix; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /token-erc-20/chaincode-java/src/main/java/org/hyperledger/fabric/samples/erc20/ContractErrors.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | package org.hyperledger.fabric.samples.erc20; 6 | /** 7 | * @author Renjith 8 | * ERC20 constants for exceptions. 9 | */ 10 | 11 | public enum ContractErrors { 12 | BALANCE_NOT_FOUND, 13 | UNAUTHORIZED_SENDER, 14 | INVALID_AMOUNT, 15 | NOT_FOUND, 16 | INVALID_TRANSFER, 17 | INSUFFICIENT_FUND, 18 | NO_ALLOWANCE_FOUND 19 | } 20 | -------------------------------------------------------------------------------- /token-erc-20/chaincode-java/src/main/java/org/hyperledger/fabric/samples/erc20/utils/ContractUtility.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | */ 4 | package org.hyperledger.fabric.samples.erc20.utils; 5 | /** 6 | * @author Renjith 7 | * @Desc Utility class 8 | */ 9 | 10 | public final class ContractUtility { 11 | 12 | private ContractUtility() { 13 | } 14 | 15 | 16 | public static boolean stringIsNullOrEmpty(final String string) { 17 | return string == null || string.isEmpty(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /token-erc-20/chaincode-java/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker: -------------------------------------------------------------------------------- 1 | mock-maker-inline -------------------------------------------------------------------------------- /token-erc-20/chaincode-javascript/.editorconfig: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | 5 | root = true 6 | 7 | [*] 8 | indent_style = space 9 | indent_size = 4 10 | end_of_line = lf 11 | charset = utf-8 12 | trim_trailing_whitespace = true 13 | insert_final_newline = true 14 | 15 | [*.md] 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /token-erc-20/chaincode-javascript/.eslintignore: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | 5 | coverage 6 | -------------------------------------------------------------------------------- /token-erc-20/chaincode-javascript/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright IBM Corp. All Rights Reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | 'use strict'; 8 | 9 | const tokenERC20Contract = require('./lib/tokenERC20.js'); 10 | 11 | module.exports.TokenERC20Contract = tokenERC20Contract; 12 | module.exports.contracts = [tokenERC20Contract]; 13 | -------------------------------------------------------------------------------- /token-erc-721/chaincode-go/chaincode/erc721.go: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | */ 4 | 5 | package chaincode 6 | 7 | // Define structs to be used by chaincode 8 | type Nft struct { 9 | TokenId string `json:"tokenId"` 10 | Owner string `json:"owner"` 11 | TokenURI string `json:"tokenURI"` 12 | Approved string `json:"approved"` 13 | } 14 | 15 | type Approval struct { 16 | Owner string `json:"owner"` 17 | Operator string `json:"operator"` 18 | Approved bool `json:"approved"` 19 | } 20 | 21 | type Transfer struct { 22 | From string `json:"from"` 23 | To string `json:"to"` 24 | TokenId string `json:"tokenId"` 25 | } 26 | -------------------------------------------------------------------------------- /token-erc-721/chaincode-java/config/checkstyle/suppressions.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /token-erc-721/chaincode-java/docker/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | # 5 | set -euo pipefail 6 | : ${CORE_PEER_TLS_ENABLED:="false"} 7 | : ${DEBUG:="false"} 8 | 9 | if [ "${DEBUG,,}" = "true" ]; then 10 | exec java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:8000 -jar /chaincode.jar 11 | elif [ "${CORE_PEER_TLS_ENABLED,,}" = "true" ]; then 12 | exec java -jar /chaincode.jar # todo 13 | else 14 | exec java -jar /chaincode.jar 15 | fi 16 | 17 | -------------------------------------------------------------------------------- /token-erc-721/chaincode-java/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/token-erc-721/chaincode-java/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /token-erc-721/chaincode-java/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /token-erc-721/chaincode-java/settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | */ 4 | 5 | rootProject.name = 'token_erc721' 6 | -------------------------------------------------------------------------------- /token-erc-721/chaincode-java/src/main/java/org/hyperledger/fabric/samples/erc721/ContractConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | */ 4 | package org.hyperledger.fabric.samples.erc721; 5 | 6 | public enum ContractConstants { 7 | BALANCE("balance"), 8 | NFT("nft"), 9 | APPROVAL("approval"), 10 | NAMEKEY("nameKey"), 11 | SYMBOLKEY("symbolKey"), 12 | APPROVE_FOR_ALL("ApproveForAll"), 13 | TRANSFER("Transfer"), 14 | MINTER_ORG_MSP("Org1MSP"); 15 | private final String prefix; 16 | 17 | ContractConstants(final String value) { 18 | this.prefix = value; 19 | } 20 | 21 | public String getValue() { 22 | return prefix; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /token-erc-721/chaincode-java/src/main/java/org/hyperledger/fabric/samples/erc721/ContractErrors.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | */ 4 | package org.hyperledger.fabric.samples.erc721; 5 | 6 | public enum ContractErrors { 7 | TOKEN_NOT_FOUND, 8 | TOKEN_ALREADY_EXITS, 9 | NO_OWNER_ASSIGNED, 10 | UNAUTHORIZED_SENDER, 11 | TOKEN_NONOWNER, 12 | INVALID_TOKEN_OWNER 13 | } 14 | -------------------------------------------------------------------------------- /token-erc-721/chaincode-java/src/main/java/org/hyperledger/fabric/samples/erc721/utils/ContractUtility.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | */ 4 | package org.hyperledger.fabric.samples.erc721.utils; 5 | 6 | public final class ContractUtility { 7 | 8 | private ContractUtility() { 9 | 10 | } 11 | 12 | /** 13 | * @param string 14 | * @return 15 | */ 16 | public static boolean stringIsNullOrEmpty(final String string) { 17 | return string == null || string.isEmpty(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /token-erc-721/chaincode-java/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker: -------------------------------------------------------------------------------- 1 | mock-maker-inline -------------------------------------------------------------------------------- /token-erc-721/chaincode-javascript/.editorconfig: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | 5 | root = true 6 | 7 | [*] 8 | indent_style = space 9 | indent_size = 4 10 | end_of_line = lf 11 | charset = utf-8 12 | trim_trailing_whitespace = true 13 | insert_final_newline = true 14 | 15 | [*.md] 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /token-erc-721/chaincode-javascript/.eslintignore: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | 5 | coverage 6 | -------------------------------------------------------------------------------- /token-erc-721/chaincode-javascript/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | */ 4 | 5 | 'use strict'; 6 | 7 | const tokenERC721Contract = require('./lib/tokenERC721.js'); 8 | 9 | module.exports.tokenERC721Contract = tokenERC721Contract; 10 | module.exports.contracts = [tokenERC721Contract]; -------------------------------------------------------------------------------- /token-sdk/.dockerignore: -------------------------------------------------------------------------------- 1 | oapi-server.yaml -------------------------------------------------------------------------------- /token-sdk/.gitignore: -------------------------------------------------------------------------------- 1 | bin/ 2 | keys/ 3 | data/ 4 | tokenchaincode/zkatdlog_pp.json 5 | 6 | auditor/auditor 7 | issuer/issuer 8 | owner/owner -------------------------------------------------------------------------------- /token-sdk/Dockerfile: -------------------------------------------------------------------------------- 1 | #build stage 2 | FROM golang:1.23-bookworm AS builder 3 | WORKDIR /go/src/app 4 | COPY go.mod . 5 | COPY go.sum . 6 | RUN go mod download 7 | COPY . . 8 | RUN go build -o /go/bin/app 9 | 10 | #final stage 11 | FROM golang:1.23-bookworm 12 | COPY --from=builder /go/bin/app /app 13 | ENTRYPOINT /app 14 | LABEL Name=tokens Version=0.1.0 15 | 16 | ENV PORT=9000 17 | ENV CONF_DIR=/conf 18 | EXPOSE 9000 19 | EXPOSE 9001 20 | -------------------------------------------------------------------------------- /token-sdk/auditor/oapi-server.yaml: -------------------------------------------------------------------------------- 1 | package: routes 2 | generate: 3 | echo-server: true 4 | strict-server: true 5 | models: true 6 | embedded-spec: true 7 | output-options: 8 | include-tags: 9 | - operations 10 | - auditor 11 | output: auditor/routes/routes.gen.go 12 | -------------------------------------------------------------------------------- /token-sdk/auditor/routes/operations.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright IBM Corp. All Rights Reserved. 3 | 4 | SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package routes 8 | 9 | import ( 10 | "context" 11 | ) 12 | 13 | // (GET /readyz) 14 | func (c Controller) Readyz(ctx context.Context, request ReadyzRequestObject) (ReadyzResponseObject, error) { 15 | // TODO: what defines readiness if the REST API is available after FSC? 16 | return Readyz200JSONResponse{ 17 | HealthSuccessJSONResponse: HealthSuccessJSONResponse{ 18 | Message: "ok", 19 | }, 20 | }, nil 21 | } 22 | 23 | // (GET /healthz) 24 | func (c Controller) Healthz(ctx context.Context, request HealthzRequestObject) (HealthzResponseObject, error) { 25 | // TODO: how to determine health? 26 | return Healthz200JSONResponse{ 27 | HealthSuccessJSONResponse: HealthSuccessJSONResponse{ 28 | Message: "ok", 29 | }, 30 | }, nil 31 | } 32 | -------------------------------------------------------------------------------- /token-sdk/components.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/token-sdk/components.png -------------------------------------------------------------------------------- /token-sdk/compose-ca.yaml: -------------------------------------------------------------------------------- 1 | # Copyright IBM Corp. All Rights Reserved. 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | # 5 | 6 | version: '3.7' 7 | 8 | services: 9 | ca_token_network: 10 | image: hyperledger/fabric-ca:1.5.7 11 | labels: 12 | service: hyperledger-fabric 13 | environment: 14 | - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server 15 | - FABRIC_CA_SERVER_CA_NAME=ca-token-network 16 | - FABRIC_CA_SERVER_TLS_ENABLED=false 17 | - FABRIC_CA_SERVER_PORT=27054 18 | ports: 19 | - "27054:27054" 20 | command: sh -c 'fabric-ca-server start -b admin:adminpw --idemix.curve gurvy.Bn254 -d' 21 | volumes: 22 | - ${PWD}/keys/ca:/etc/hyperledger/fabric-ca-server 23 | container_name: ca_token_network 24 | -------------------------------------------------------------------------------- /token-sdk/dependencies.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/token-sdk/dependencies.png -------------------------------------------------------------------------------- /token-sdk/e2e/oapi-client.yaml: -------------------------------------------------------------------------------- 1 | package: e2e 2 | generate: 3 | client: true 4 | models: true 5 | output: e2e/client.gen.go 6 | -------------------------------------------------------------------------------- /token-sdk/explorer/.env: -------------------------------------------------------------------------------- 1 | PORT=8081 2 | EXPLORER_CONFIG_FILE_PATH=./config.json 3 | EXPLORER_PROFILE_DIR_PATH=./connection-profile 4 | FABRIC_CRYPTO_PATH=../../test-network/organizations -------------------------------------------------------------------------------- /token-sdk/explorer/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "network-configs": { 3 | "test-network": { 4 | "name": "Test Network", 5 | "profile": "./connection-profile/test-network.json" 6 | } 7 | }, 8 | "license": "Apache-2.0" 9 | } 10 | -------------------------------------------------------------------------------- /token-sdk/go.work: -------------------------------------------------------------------------------- 1 | go 1.23.0 2 | 3 | use ( 4 | ./auditor 5 | ./e2e 6 | ./issuer 7 | ./owner 8 | ) 9 | -------------------------------------------------------------------------------- /token-sdk/issuer/oapi-server.yaml: -------------------------------------------------------------------------------- 1 | package: routes 2 | generate: 3 | echo-server: true 4 | strict-server: true 5 | models: true 6 | embedded-spec: true 7 | output-options: 8 | include-tags: 9 | - operations 10 | - issuer 11 | output: issuer/routes/routes.gen.go 12 | -------------------------------------------------------------------------------- /token-sdk/issuer/routes/operations.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright IBM Corp. All Rights Reserved. 3 | 4 | SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package routes 8 | 9 | import ( 10 | "context" 11 | ) 12 | 13 | // (GET /readyz) 14 | func (c Controller) Readyz(ctx context.Context, request ReadyzRequestObject) (ReadyzResponseObject, error) { 15 | // TODO: what defines readiness if the REST API is available after FSC? 16 | return Readyz200JSONResponse{ 17 | HealthSuccessJSONResponse: HealthSuccessJSONResponse{ 18 | Message: "ok", 19 | }, 20 | }, nil 21 | } 22 | 23 | // (GET /healthz) 24 | func (c Controller) Healthz(ctx context.Context, request HealthzRequestObject) (HealthzResponseObject, error) { 25 | // TODO: how to determine health? 26 | return Healthz200JSONResponse{ 27 | HealthSuccessJSONResponse: HealthSuccessJSONResponse{ 28 | Message: "ok", 29 | }, 30 | }, nil 31 | } 32 | -------------------------------------------------------------------------------- /token-sdk/owner/oapi-server.yaml: -------------------------------------------------------------------------------- 1 | package: routes 2 | generate: 3 | echo-server: true 4 | strict-server: true 5 | models: true 6 | embedded-spec: true 7 | output-options: 8 | include-tags: 9 | - operations 10 | - owner 11 | output: owner/routes/routes.gen.go 12 | -------------------------------------------------------------------------------- /token-sdk/owner/routes/operations.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright IBM Corp. All Rights Reserved. 3 | 4 | SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | package routes 8 | 9 | import ( 10 | "context" 11 | ) 12 | 13 | type OperationsAPI struct{} 14 | 15 | // (GET /readyz) 16 | func (c Controller) Readyz(ctx context.Context, request ReadyzRequestObject) (ReadyzResponseObject, error) { 17 | // TODO: what defines readiness if the REST API is available after FSC? 18 | return Readyz200JSONResponse{ 19 | HealthSuccessJSONResponse: HealthSuccessJSONResponse{ 20 | Message: "ok", 21 | }, 22 | }, nil 23 | } 24 | 25 | // (GET /healthz) 26 | func (c Controller) Healthz(ctx context.Context, request HealthzRequestObject) (HealthzResponseObject, error) { 27 | // TODO: how to determine health? 28 | return Healthz200JSONResponse{ 29 | HealthSuccessJSONResponse: HealthSuccessJSONResponse{ 30 | Message: "ok", 31 | }, 32 | }, nil 33 | } 34 | -------------------------------------------------------------------------------- /token-sdk/scripts/down.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # This script fully tears down and deletes all artifacts from the sample network that was started with ./scripts/up.sh. 4 | 5 | 6 | ls scripts/down.sh || { echo "run this script from the root directory: ./scripts/down.sh"; exit 1; } 7 | TEST_NETWORK_HOME="${TEST_NETWORK_HOME:-$(pwd)/../test-network}" 8 | ls "$TEST_NETWORK_HOME/network.sh" 1> /dev/null || { echo "Set the TEST_NETWORK_HOME environment variable to the directory of your fabric-samples/test-network; e.g.: 9 | 10 | export TEST_NETWORK_HOME=\"$TEST_NETWORK_HOME\" 11 | "; exit 1; } 12 | 13 | docker-compose down 14 | docker-compose -f compose-ca.yaml down 15 | 16 | docker stop peer0org1_tokenchaincode_ccaas peer0org2_tokenchaincode_ccaas 17 | bash "$TEST_NETWORK_HOME"/network.sh down 18 | 19 | rm -rf keys 20 | rm -rf data 21 | rm tokenchaincode/zkatdlog_pp.json 22 | -------------------------------------------------------------------------------- /token-sdk/transfer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger/fabric-samples/cc85f96d9eecf74a66f9e4d947acf739a68e8dbc/token-sdk/transfer.png -------------------------------------------------------------------------------- /token-utxo/chaincode-go/token_utxo.go: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-License-Identifier: Apache-2.0 3 | */ 4 | 5 | package main 6 | 7 | import ( 8 | "log" 9 | 10 | "github.com/hyperledger/fabric-contract-api-go/v2/contractapi" 11 | "github.com/hyperledger/fabric-samples/token-utxo/chaincode-go/chaincode" 12 | ) 13 | 14 | func main() { 15 | tokenChaincode, err := contractapi.NewChaincode(&chaincode.SmartContract{}) 16 | if err != nil { 17 | log.Panicf("Error creating token-utxo chaincode: %v", err) 18 | } 19 | 20 | if err := tokenChaincode.Start(); err != nil { 21 | log.Panicf("Error starting token-utxo chaincode: %v", err) 22 | } 23 | } 24 | --------------------------------------------------------------------------------