Samples for Hyperledger Fabric
Find a file
Arne Rutjes 98f748155b add a retry to the test-network ccaas chaincode init command
Without this, the init command fails if the chaincode container is not ready.

Signed-off-by: Arne Rutjes <arne123@gmail.com>
2023-09-27 08:14:33 -06:00
.github Update CI to Fabric v2.5.1 (#1032) 2023-05-05 13:34:07 +01:00
asset-transfer-abac Update Go and Go dependencies (#996) 2023-03-07 14:44:33 +00:00
asset-transfer-basic Fixes for build breakages 2023-09-19 13:08:40 -04:00
asset-transfer-events Fixes for build breakages 2023-09-19 13:08:40 -04:00
asset-transfer-ledger-queries Fixes for build breakages 2023-09-19 13:08:40 -04:00
asset-transfer-private-data Fixes for build breakages 2023-09-19 13:08:40 -04:00
asset-transfer-sbe Fixes for build breakages 2023-09-19 13:08:40 -04:00
asset-transfer-secured-agreement Fixes for build breakages 2023-09-19 13:08:40 -04:00
auction-dutch Fixes for build breakages 2023-09-19 13:08:40 -04:00
auction-simple Fixes for build breakages 2023-09-19 13:08:40 -04:00
ci Correct the private data collection information 2023-03-22 16:19:56 -04:00
full-stack-asset-transfer-guide minor documentation fixes smart contract dev 2023-07-28 14:19:58 +09:00
hardware-security-module Update TypeScript HSM sample application 2023-09-19 13:08:40 -04:00
high-throughput fix typo in high-througput/README.md (#1073) 2023-07-14 17:42:13 +09:00
off_chain_data Fixes for build breakages 2023-09-19 13:08:40 -04:00
test-application/javascript Add SBE javascript application 2020-09-10 11:26:21 -04:00
test-network add a retry to the test-network ccaas chaincode init command 2023-09-27 08:14:33 -06:00
test-network-k8s test-network-k8s: Update k8s CC builder to 0.11.0 2023-05-09 22:11:57 -04:00
test-network-nano-bash Minor improvements on test-network-nano-bash 2023-06-16 16:45:22 -04:00
token-erc-20 Update token_contract.go, checking the input params > 0 in function sub(). 2023-06-20 12:21:41 -04:00
token-erc-721 Update Go and Go dependencies (#996) 2023-03-07 14:44:33 +00:00
token-erc-1155 Fix erc-1155 sample README 2023-04-24 17:27:08 -04:00
token-utxo Update Go and Go dependencies (#996) 2023-03-07 14:44:33 +00:00
.gitignore Moves the Full Stack Asset Transfer Development Guide to fabric-samples (#852) 2022-11-10 10:40:27 -05:00
CHANGELOG.md Add CHANGELOG.md with script to update it (#162) 2020-05-19 15:52:13 +01:00
CODE_OF_CONDUCT.md FAB-9362 add CONTRIBUTING.md and CODE_OF_CONDUCT.md 2018-04-04 19:25:55 -04:00
CODEOWNERS Perform General Cleanup (#151) 2020-04-06 21:49:14 +02:00
CONTRIBUTING.md Fix doc link 2019-01-24 16:47:03 +08:00
LICENSE FAB-4853 initial content 2017-06-21 07:30:04 +08:00
MAINTAINERS.md Nominate Tatsuya Sato as fabric-samples maintainer 2023-05-22 07:53:42 -04:00
README.md Remove heritage chaincode samples 2023-03-01 11:50:47 -05:00
SECURITY.md Add repolinter support 2021-04-23 15:35:20 -04:00

Hyperledger Fabric Samples

Build Status

You can use Fabric samples to get started working with Hyperledger Fabric, explore important Fabric features, and learn how to build applications that can interact with blockchain networks using the Fabric SDKs. To learn more about Hyperledger Fabric, visit the Fabric documentation.

Getting started with the Fabric samples

To use the Fabric samples, you need to download the Fabric Docker images and the Fabric CLI tools. First, make sure that you have installed all of the Fabric prerequisites. You can then follow the instructions to Install the Fabric Samples, Binaries, and Docker Images in the Fabric documentation. In addition to downloading the Fabric images and tool binaries, the Fabric samples will also be cloned to your local machine.

Test network

The Fabric test network in the samples repository provides a Docker Compose based test network with two Organization peers and an ordering service node. You can use it on your local machine to run the samples listed below. You can also use it to deploy and test your own Fabric chaincodes and applications. To get started, see the test network tutorial.

The Kubernetes Test Network sample builds upon the Compose network, constructing a Fabric network with peer, orderer, and CA infrastructure nodes running on Kubernetes. In addition to providing a sample Kubernetes guide, the Kube test network can be used as a platform to author and debug cloud ready Fabric Client applications on a development or CI workstation.

Asset transfer samples and tutorials

The asset transfer series provides a series of sample smart contracts and applications to demonstrate how to store and transfer assets using Hyperledger Fabric. Each sample and associated tutorial in the series demonstrates a different core capability in Hyperledger Fabric. The Basic sample provides an introduction on how to write smart contracts and how to interact with a Fabric network using the Fabric SDKs. The Ledger queries, Private data, and State-based endorsement samples demonstrate these additional capabilities. Finally, the Secured agreement sample demonstrates how to bring all the capabilities together to securely transfer an asset in a more realistic transfer scenario.

Smart Contract Description Tutorial Smart contract languages Application languages
Basic The Basic sample smart contract that allows you to create and transfer an asset by putting data on the ledger and retrieving it. This sample is recommended for new Fabric users. Writing your first application Go, JavaScript, TypeScript, Java Go, JavaScript, TypeScript, Java
Ledger queries The ledger queries sample demonstrates range queries and transaction updates using range queries (applicable for both LevelDB and CouchDB state databases), and how to deploy an index with your chaincode to support JSON queries (applicable for CouchDB state database only). Using CouchDB Go, JavaScript Java, JavaScript
Private data This sample demonstrates the use of private data collections, how to manage private data collections with the chaincode lifecycle, and how the private data hash can be used to verify private data on the ledger. It also demonstrates how to control asset updates and transfers using client-based ownership and access control. Using Private Data Go, Java JavaScript
State-Based Endorsement This sample demonstrates how to override the chaincode-level endorsement policy to set endorsement policies at the key-level (data/asset level). Using State-based endorsement Java, TypeScript JavaScript
Secured agreement Smart contract that uses implicit private data collections, state-based endorsement, and organization-based ownership and access control to keep data private and securely transfer an asset with the consent of both the current owner and buyer. Secured asset transfer Go JavaScript
Events The events sample demonstrates how smart contracts can emit events that are read by the applications interacting with the network. README JavaScript, Java JavaScript
Attribute-based access control Demonstrates the use of attribute and identity based access control using a simple asset transfer scenario README Go None

Additional samples

Additional samples demonstrate various Fabric use cases and application patterns.

Sample Description Documentation
Off chain data Learn how to use block events to build an off-chain database for reporting and analytics. Peer channel-based event services
Token ERC-20 Smart contract demonstrating how to create and transfer fungible tokens using an account-based model. README
Token UTXO Smart contract demonstrating how to create and transfer fungible tokens using a UTXO (unspent transaction output) model. README
Token ERC-1155 Smart contract demonstrating how to create and transfer multiple tokens (both fungible and non-fungible) using an account based model. README
Token ERC-721 Smart contract demonstrating how to create and transfer non-fungible tokens using an account-based model. README
High throughput Learn how you can design your smart contract to avoid transaction collisions in high volume environments. README
Simple Auction Run an auction where bids are kept private until the auction is closed, after which users can reveal their bid. README
Dutch Auction Run an auction in which multiple items of the same type can be sold to more than one buyer. This example also includes the ability to add an auditor organization. README

License

Hyperledger Project source code files are made available under the Apache License, Version 2.0 (Apache-2.0), located in the LICENSE file. Hyperledger Project documentation files are made available under the Creative Commons Attribution 4.0 International License (CC-BY-4.0), available at http://creativecommons.org/licenses/by/4.0/.