Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/hyperledger/fabric-samples

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/hyperledger/fabric-samples

  • v2.4.9+incompatible
  • Source
  • Go
  • Socket score

Version published
Created
Source

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 ContractDescriptionTutorialSmart contract languagesApplication languages
BasicThe 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 applicationGo, JavaScript, TypeScript, JavaGo, JavaScript, TypeScript, Java
Ledger queriesThe 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 CouchDBGo, JavaScriptJava, JavaScript
Private dataThis 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 DataGo, JavaJavaScript
State-Based EndorsementThis sample demonstrates how to override the chaincode-level endorsement policy to set endorsement policies at the key-level (data/asset level).Using State-based endorsementJava, TypeScriptJavaScript
Secured agreementSmart 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 transferGoJavaScript
EventsThe events sample demonstrates how smart contracts can emit events that are read by the applications interacting with the network.READMEJavaScript, JavaJavaScript
Attribute-based access controlDemonstrates the use of attribute and identity based access control using a simple asset transfer scenarioREADMEGoNone

Additional samples

Additional samples demonstrate various Fabric use cases and application patterns.

SampleDescriptionDocumentation
Off chain dataLearn how to use block events to build an off-chain database for reporting and analytics.Peer channel-based event services
Token ERC-20Smart contract demonstrating how to create and transfer fungible tokens using an account-based model.README
Token UTXOSmart contract demonstrating how to create and transfer fungible tokens using a UTXO (unspent transaction output) model.README
Token ERC-1155Smart contract demonstrating how to create and transfer multiple tokens (both fungible and non-fungible) using an account based model.README
Token ERC-721Smart contract demonstrating how to create and transfer non-fungible tokens using an account-based model.README
High throughputLearn how you can design your smart contract to avoid transaction collisions in high volume environments.README
Simple AuctionRun an auction where bids are kept private until the auction is closed, after which users can reveal their bid.README
Dutch AuctionRun 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
ChaincodeA set of other sample smart contracts, many of which were used in tutorials prior to the asset transfer sample series.
Interest rate swapsDeprecated in favor of state based endorsement asset transfer sample
FabcarDeprecated in favor of basic asset transfer sample

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/.

FAQs

Package last updated on 18 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc