imtoken钱包官网下载2.0|hyperledger

作者: imtoken钱包官网下载2.0
2024-03-07 19:13:27

Hyperledger - The Open Global Ecosystem for Enterprise Blockchain

Hyperledger - The Open Global Ecosystem for Enterprise Blockchain

Introducing new project Hyperledger Web3j  > Find out more 

About

About

About Us

Members

TOC

Governing Board

Speakers Bureau

Staff

Charter

Code of Conduct

FAQ

Logos & Guidelines

Hyperledger Store

Featured

White Paper

An Overview of Hyperledger Foundation

New Brand Study

Get the latest insights

Projects

Projects

Projects Overview

Aries

Besu

Cacti

Fabric

Firefly

Indy

Iroha

All Projects

Project Matrix

Labs

Contribute to coding

/dev/weekly newsletter

Featured

Workshop

Register now for the Web3j workshop

Upcoming Workshop

Register now for the ZK Proofs & Programming Workshop

Participate

Participate

Get started →

Attend an event

Find a meetup near you

Find a regional chapter

Join a Special Interest Group

Look for a job

Additional Resources

Wiki

Discord

Mailing Lists

Github Repos

Linux Foundation ID

Member Portal

Use

Use

Training and Certification

Workshops & Tutorials

Vendor Directory

Hyperledger Certified Service Providers

Training Partners

Featured

New Certification

Demonstrate your understanding of the fundamentals of blockchain tech with the new Hyperledger Fabric certification

FREE COURSE

Introduction to Hyperledger Self-Sovereign Identity Blockchain Solutions (LFS172x)

Learn

Learn

Case Studies

Use Case Tracker

Webinars

White Papers

Research

DLT Landscape

Featured

Training & Certifications

Discover technical training courses and professional certifications to get up-to-speed on blockchain and DLT technologies.

Case Study

Circulor Readies Market for New Regulations by Adding Battery Passport to Hyperledger Fabric-Powered traceability Platform

Blog & News

Blog & News

Blog

Announcements

Newsletters

Videos

Featured

Anniversary Webinar

Insights from the Governing Board

New Project

Introducing Hyperledger Web3j

Join

Building better together

The open source global ecosystem for enterprise-grade blockchain technologies

Join us

Hyperledger technologies are used by more of the top 100 companies than any other platform 

Join hundreds of member companies, including world leaders in finance, banking, IoT, supply chains, manufacturing and technology and more

All are welcome in our inclusive global community 

Meet our members

Latest news

Hyperledger Collaborative Learning Spotlight: BiniBFT - An Optimized BFT on Fabric

Hyperledger Collaborative Learning Project Spotlight: Abhishek Ranjan, Ajitesh Kumar Soni, Ashna P S, Riddhi Ravindra Katarki, Sahilsher Singh, and Siddhant Prateek Mahanayak

share their collective experience working on BiniBFT - An Optimized BFT on Fabric, a pilot collaborative learning project

Read More

Meet Aries Agent Controller, a New Hyperledger Lab

Introduction to Aries Agent Controller, a new Hyperledger lab that simplifies deploying Hyperledger Aries agents, making the process more robust and manageable for organizations and developers alike

Read More

Building Better Together: Insights from the Governing Board to Mark Hyperledger Foundation’s 8th Anniversary

A Q+A with Hyperledger Foundation Governing Board Members to mark the open source community's 8th anniversary.

Read More

Learn how members are using the tech

All case studies

Case Study

Materials Traceability Leader Circulor Expands Hyperledger Fabric-Based Solution To Underpin Digital Battery Passports

Case Study

How Tradewaltz is using Hyperledger Fabric to Create the Future of Global Trade

Case Study

The Hyperledger FireFly Story: Kaleido Taps into the Hyperledger Community to Develop Next-Gen Solutions

All case studies

Build solutions using Hyperledger tech

Enabling developers, enterprises, and organizations to openly develop and govern blockchain frameworks & tools

Enterprise-grade

Highly secure

Modular

Interoperable

Crypto-agnostic

Complete with API'S 

 

Explore projects

Members

Building & selling the tech?

Hyperledger technologies are used by more of the top 100 public companies in the world than any other blockchain platform.

Become a member

Contributors

Looking to get involved?

Collaborate with leading coders and creatives in the industry, from global organizations to individual developers and enthusiasts. 

Become a contributor

End users

Using Hyperledger tech?

Speed up your implementation process by working closely with peers, project maintainers, and Hyperledger Foundation.

Join the community

Upcoming events

In addition to organizing our annual conference Hyperledger Global Forum, the Hyperledger Foundation team participates in multiple events throughout the year

View all events

Sign up for Hyperledger Horizon & /dev/weekly newsletters 

By signing up, you acknowledge that your information is subject to The Linux Foundation's Privacy Policy

 

About

Projects

Participate

Blog & News

Contact Us

Join

Copyright © 2024 The Linux Foundation®. All rights reserved. Hyperledger Foundation, Hyperledger, and the other Hyperledger Foundation trademarks are trademarks of The Linux Foundation. For a list of Hyperledger Foundation trademarks, please see our Trademark Usage page. Linux is a registered trademark of Linus Torvalds. Privacy Policy and Terms of Use.

超级账本(Hyperledger) - 知乎

超级账本(Hyperledger) - 知乎切换模式写文章登录/注册超级账本(Hyperledger)链学堂背景区块链是-种新兴技术,它能够彻底改变融资、供应链、及其他交易网络,为创新与发展带去新的机遇,同时还能减少运营成本,降低风险。自2009年来比特币在交易领域迅速崛起,许多企业及行业投入了大量资源来研究其底层技术,从而传播这广受欢迎但又颇具争议的加密币。区块链是一种点对点分布式账本技术,它是第一-个在金融领域获得动力的技术,因为它能够有效而安全地发行、交易、管理、服务资产。在记录系统(SoR)范围内,生态系统中的每一位成员都需要维护好自己的账本系统,并审核与其他成员的交易进展,这个过程既低效,又昂贵,而且没有内部组织操作流标准。而分布式账本则完全不同,它能够减少成本,使业务网络的建立更加容易,并且不再需要提供中心点控制。由于共享账本概念在商业领域越来越受关注,区块链智能合约也因此引起了人们的注意。智能合约是各种商业规则的集合,它在区块链上运行,由一组利益相关方共有并进行验证。智能合约在商业自动化进程中非常管用,而且诚信可靠,它能够使利益相关方以团体形式处理并验证合约条款。Hyperledger就是采用链上代码(chaincode) 执行智能合约的。比特币及其他加密币的开发就是用来对抗任何形式的审查的一任何人都能参与,而且不需要建立身份,只要贡献一点时间来完成运算周期就行。在比特币区块链模型中,没有中心机构来发放许可,因为这些网络是非授权的。他们要进行无数工作量证明运算,成本非常高。Hyperledger对传统区块链模型进行了革新,其中包括管理参与者的访问许可权。换句话说,Hyperledger 是有权限的共享账本。Hyperledger为身份识别、审核及隐私提供了一个安全、健康的模型,从而缩短运算周期,实现有效扩展,应对业内各种运用要求。进入2016年,关于区块链的认识越来越多,研究出一个适用且可扩展的解?决方案变得日益紧迫。为什么是一个新构架作为一项刚开发的技术,区块链还不能满足商业交易中各类复杂要求。其可扩展性还存在问题,也不能支持私下机密交易,这些限制都使其难以在众多以业务为主的应用程序中运行自如。为了应对各种各样的市场需求,Hyperledger的设计以产业应用为重点,解决了现有缺点,扩展了业内先行者原有的功能。设想区块链技术会为现代商业交易带来的革新与改变,分析了业内的使用案例及密钥要求,设计并建立了一套系统来推动区块链技术的广泛运用。一个涵盖众多网络的世界希望能够出现众多区块链网络,使每个网络账本都能执行不同的业务。开发了Hyperledger。现在单一普遍的通用网络或许已经出现,但是要想网络账本核心功能的运行依靠其他网络来完成,还尚未有实例。Hyperledger除了能够实现这种网络独立运行之外,它还有一个寻址系统,能够通过一个账本的交易,发现并利用另一账本中的正当交易与智能合约(链上代码chaincode)。对网络权限的需求日益增加有权限的网络是通过已知白名单组织来运行验证与非验证节点的,由网络发行机关来授予交易者一个识别身份。发行机关根据网络的目的来确定适当的访问权限,而这种权限需要进行身份识别,然后才能在网络进行交易。这一网络能够公开运行,并且很容易就能融入到移动应用。它也能完全私下运行,受邀参与者只有通过验证,才能获悉其情况。因为Hyperledger构架的设计符合各种目的,能够允许各网络之间互相访问,而且其协议也能够满足各类使用要求,并且还设有不同级别的权限。隐私及机密的重要性我们相信任何区块链构架都有一个基本要求,那就是网络上任何一方的身份及行为模式,都不能允许未经授权的人通过账本来打探情况。我们也希望能够保证区块链用户的业务逻辑及其他交易参数的机密性,做到除了合约涉及的利益相关方或交易中的资产,没有人能够访问这些数据。行业用例商务合同商务合同能够通过编码,使双方或更多参与者自动执行合约条款,并且保证诚信。虽然区块链上的信息本质上是公开的,但是商对商合约要求具备隐私保护的机制,来保护敏感的商业信息,防止信息泄露给同样能够访问账本的外部人员。虽然说保密协议对商业案例来说很重要,但是也有很多场合需要也应该做到合约公开,从而保证账本上所有人员都能轻松获取消息:比如,用来确定报价以供竞标的账本。这种合约就需要标准化,这样竞标人就可以很快获取信息。资产存管金融证券之类的资产必须在区块链网络上实现去中心化,这样所有同种资产的利益相关方就能直接访问每一资产,从而发起交易,获取相关信息,而不再需要通过层层中间人来进行了。交易基本实现实时结算,而且也必须保证所有利益相关方能够实时掌握资产情况。对任何资产种类,利益相关方都应有权增加商务规则,这样也能通过自动化逻辑应用来减少运营成本。创造资产的人必须像用例保证的那样,实现资产及相关交易规则保密或者公开。供应链区块链框架必须保证每一位供应链网络中的参与者都能够:输入并追踪原材料来源;记录部件生产的遥测数据;追踪航运商品的出处;保证包括成品生产、贮存、销售及后续事宜在内的所有记录都不可改变。除了之前描述过的商务合约及资产存管模式,供应链这一用例更多强调的是其深度搜索性,保证可以在过去层层交易中追溯所需记录。其核心是为每一个从其他组件品中制造出来的商品创建出处。特色要求下面提到的特色要求以健全产业的用例为基础,推动了Hyperledger构架的开发。这些要求包括身份识别与可审核性、私下交易、保密合约、模块共识、性能绩效、可扩展性、链上代码( chaincode)以及智能合约。身份识别与可审核性交易的隐私性固然重要,但是区块链商业用途也要遵守--定的规章制度,使监管方能够访问调查交易记录。事后(有时得好几年后)交易一方必须提供身份识别以及资产所有权,在没有机制的情况下,通过身份识别来确定当事人身份以及其在账本上的活动。于是Hyperledger协议顺势而生,它在注册机关登记了一个加密证书,从而锁定用户的机密数据。注册机关能够发布并撤销网络参与者的身份验证。针对每一个身份,协议都会生成一个秘钥,供成员在网络上进行交易,而且不会透露交易方的身份,保障网络隐私。私下交易及保密合约如果交易模式能够进行公开观察与分析,那么共享账本就会泄露商业关系的细节,而这些细节本不应透露给竞争者的。供应方或买方的圈子本来就小,支持双方贸易的系统就更不应该泄露任何一方的交易情况。因此,运用于商业活动的区块链就必须提供一个机制,来保证未授权的第三方不能获悉有关身份、交易模式、以及保密合约等条款。Hyperledger可以通过加密交易来保证其内容的机密性,只有利益相关方能够对其进行解密并执行。此外,业务逻辑(通过智能合约来实现)也做了加密处理来确保安全(如果利益相关方要求机密的话),并且只有在运行的时候才能加载、破解。关于这一点,会在之后架构部分详细阐明。模块共识由于不同行业及领域有各自的网络要运行,所以不同的网络也要配置不同的共识算法来满足不同的使用要求。Hyperledger协议下的共识必须运用可插入式算法,使用户自行在配置中自行选择共识算法。Hyperledger协议的首次发行将提供拜占庭容错算法(BFT),这种算法采用的是实用拜占庭容错算法(PBFT)协议。我们期待今后社区中能有更多人分享其他共识算法模型。逻辑=链上代码=智能合约区块链逻辑,或者我们常说的“智能合约”,是各方之间自动执行的协议,其中所有相关条款都由代码编成,能够进行自动结算,今后通过签名或其他触发事件来执行。在Hyperledger项目中,我们把它叫做“链上代码”(chaincode) , 通过链上代码来建立并区分区块链逻辑及其书面合约。(这 个术语还在检测中,可能会有所改变。)链上代码(chaincode)概念比智能合约还要再宽泛一些,智能合约这一概念是由NickSzabo提出来的。链上代码能够通过任何主流编程语言进行编写,并且在Hyperledger的上下文背景层内执行。链上代码能够定义智能合约模块语言(类似Velocity或者Jade),限制环境函数的执行以及其运算灵活度,从而满足法律合约的要求。性能绩效以及可扩展性如果从经济角度来认识区块链框架的网络应用,那么在设计过程中就必须把长期的业绩考虑进去。一个账本或一套账本必须能够持续运作100多年,并且在用户可获取的时效内,允许客户使用其发掘、搜索、身份识别及其他功能。不过随着时间的推移,指定网络的节点数量及交易人员也会越来越多,因此,其框架还必须在保证性能表现的前提下,解决这些问题。架构下面图2将为您展示Hyperledger所参考的架构,包括三大类:会员制、区块链、链上代码。这些都是逻辑结构,而不是对独立步骤、地址空间或者(虚拟)机器中分区组件的物理描述。其中有些部分会从头建起,有的会采用现有的开源码,还有一些则与现有服务结合从而实现所需功能。会员制服务负责管理的是网络上的身份识别、隐私与机密。参与者通过注册来获取身份,然后属性授权机构才能发放密钥来进行交易。声誉管理器能够使审计人员浏览某参与者的交易情况,如果审计人员已经获得参与者授予的适当访问权限的话。区块链服务负责管理分布式账本,通过在超文本传输协议2.0建立的点对点协议进行。数据结构经过优化能够有效维护众参与者重复的整体状态。不同的共识算法或将嵌入每一个配置中,以保证高度一致性(通过拜占庭容错算法来处理错误,通过崩溃容忍来处理延误与中断,或借助工作量证明方案来应对审查)。链上代码(Chaincode)服务负责提供安全又轻便的沙盒装载路径,供链上代码执行验证节点。整个环境是一个封锁且安全的容器,内含一个 签署过的图片库,包括安全的操作系统及链上代码语言,以及Golang (准备期)、Java (计划期)、Node. js (计划期)等软件开发工具包组图与执行环境。如果有需要的话,也能添加其他程序语言。会员制区块链分布式账本运用RocksDB来长久保存数据集,并且为了符合其三大属性,它还建立了一个内部数据结构来反映状态。大型文件(文档等)存储在区块链账本之外的贮存库中,而其散列值则能够作为交易的一部分存放在链内,这是为了保证文件的完整性。Hyperledger能够支持两种交易:代码部署交易以及代码调用交易。代码部署交易能够执行一条链上代码的提交、更新或者终止等命令,其验证节点必须保护代码及其执行环境的真实性与完整性。相比之下,代码调用交易则是一种用来执行链E代码函数的应用程序界面,其过程类似于运用统--资源标识符来调用JEE的小型服务程序。值得注意的是,其中每一个链上代码都负责维护自己的状态,而且函数调用是改变链上代码状态的一个常见办法。共识管理器是一个抽象概念,它定义了共识算法与其他Hyperledger组件之间的接口。共识管理器接收交易,根据算法来决定如何组织以及何时执行这些交易。交易成功执行后就会在账本上反映变化。Hyperledger执行的是拜占庭协议,其在容错与扩展性方面都有强大优势。Event Hub是一个去中心化网络,它的属性很复杂,因为同一事件可能会多次出现,而且每次都会覆盖到每个对等节点。回调函数能够终止接收同一事件的多次调用,这样一来,对等节点(最好是非验证的本机节点)就能够管理应用程序相关的发布或订阅事件了。只要条件满足,对等节点就发动事件,顺序不分先后。这些事件不会永远存在,所以应用程序如果有需要就得及时捕捉。链上代码( chaincode )链上代码交易是有时间限定的,并且在链上代码装置过程中是按特定形式装配的,这和数据库调用或网站服务调用类似。如果超过交易时限,那么就按出错处理,不会给账本状态带去任何改变。如果调用的函数有相同保密范围限制的话,一个链上代码函数就能够调用另一个链上代码函数一也就是 说,如果两个机密链上代码之间,有相同的一组验证器,那么它们之间就能互相调用。新区块进行交易时,会维持区块链上最后区块的整体状态差量。如果当前区块达到共识,那么变量就会提交到数据库,之后整体状态的区块数量就会增加1个。如果节点没有达到共识,那么差量就会不会算入,数据库也不会进行修改。应用编程界面Hyperledger包括了REST、JSON RPC应用程序界面、事件以及连接网络的应用程序软件开发工具包。典型的一点是,应用程序与一个对等节点进行交互需要通过某种形式来验证该个体的正当权限,其中客户的信息是有其身份识别签名的,而且要经过节点的核实。Hyperledger有--套命令行界面(CLI)来管理运行网络。这套命令行界面也可以用于链上代码测试过程中。REST应用程序界面以及软件开发工具包(SDK)是建立在JSON-RPC应用程序界面上的,这也是现在最完整的应用程序界面层。软件开发工具包则能够适用于Golang, JavaScript, Java 等语言中,如果有需要,也可以添加其他编程语言。这一应用程序界面能够分成以下几类: :· 身份识别——通过登记来获得或撤销认证· 寻址——定位并追踪交易来源· 交易一一账本上的执行单元· 链上代码——在区块链上运行的程序· 区块链——账本的内容· 网络——区块链网络的信息· 存储库一一文件或文档的外部储存· 事件一一区块链上的订阅或发行事件应用模型网络技术有三种潜在配置模型:云服务器托管的单一网络、云服务器托管的多个网络,以及参与者托管的内联网。云服务器托管的单一网络是最简易、最高效的拓扑结构,其中每一位参与者都有一组对等节点,包括验证节点。尽管网络在云环境下运行并且托管给物理硬件厂商,参与者还是能够根据合约来控制运算资源,从而在中心化环境中实现去中心化配置。云服务器托管的多个网络能够使参与者通过云供应商管理对等节点,如果这些节点能够在超文本传输协议(Hyper ledgerTTP)下互相连接的话。参与者托管的内联网通过超文本传输协议来使用参与者所有的网络。结论Hyperledger的任务是将区块链技术引入大众市场。回顾了可行的区块链解决方案,也了解了业界领先者及技术推广者给出的相关用例后,我们相信区块链将会成为至关重要的技术模型,推动众多工业与企业进行革新。我们注意到,业内目前急需-套为企业打造的区块链框架,做到既高效,又可扩展,并且能够为隐私与机密相关的需求提供企业级的支持。我们也发现了各种不同的用例,而每一用例可能需要不同的区块链底层实现。为了全面发掘区块链技术的潜能,并且开创一套能满足各种使用需求的标准,我们设计了灵活且可延伸的Hyperledger构架。此外,我们还在引导Hyper ledger协议的默认实现,其中涉及了各种计算机科学学科的先进成果。编辑于 2022-07-16 22:30Hyperledger​赞同 7​​添加评论​分享​喜欢​收藏​申请

Hyperledger中文文档

Hyperledger中文文档

Hyperledger中文文档

欢迎

简介

如何贡献

词汇表

简介

快速入门

协议规范

Fabric教程

构建第一个fabric网络

编写第一个应用

Chaincode 指南

Chaincode 开发手册

Chaincode 操作手册

Fabric操作指南

MSP

Channel 配置(configtx)

Channel 配置(configtxgen)

Channel 重新配置(configtxlator)

背书策略

错误处理

日志控制

Fabric设计

架构说明

交易流程

CA

SDK--node

SDK--java

基于kafka的排序服务

Channels

账本

Read-Write set

Gossip数据传输协议

故障排除和常见问题

Hyperledger Fabric 答疑

MSP&ACL

Fabric SDK 设计

Makefile文件解析

BCCSP密码算法套件解析

Zanata使用指南

 

Hyperledger中文文档

Docs »

欢迎

Edit on GitHub

欢迎阅读!!!

欢迎贡献!!!

简介¶

Hyperledger国际化工作组是Hyperledger中国工作组(TWGC)下属的一个小组,主要负责相关文档的中文编写和翻译,以及组织讨论、教育培训活动等。

目前小组有成员100余名,活跃贡献者20余名,已完成文章30余篇。

如何贡献¶

以前我们用Hyperledger Wiki管理文章,但Wiki读写操作有诸多不便,为此我们将文档转移到github上,以使大家更方便地阅读和编辑贡献资源。

使用github上后发现翻译内容校正不方便,不支持多种语言翻译,为此我们使用专翻译平台Zanata。

贡献内容包括但不限于:文档翻译、知识总结、经验教训、好文链接、奇思妙想…

如果您不想作如下操作,可将直接内容邮件(见页面最下方)发送给工作组,我们为您发布

最新贡献方法请参考这里

Next

Hyperledger国际化工作组(yls@chainnova.com)

Built with MkDocs using a theme provided by Read the Docs.

GitHub

Next »

简介 - Hyperledger中文文档

简介 - Hyperledger中文文档

Hyperledger中文文档

欢迎

词汇表

简介

简介

区块链是什么?

分布式账本

智能合约

共识

区块链为什么切实可行?

当前的记录系统

区块链的不同点

Hyperledger Fabric是什么?

共享账本

智能合约

隐私

共识

后续学习

快速入门

Hyperledger Fabric模型

快速入门

协议规范

Fabric教程

构建第一个fabric网络

编写第一个应用

Chaincode 指南

Chaincode 开发手册

Chaincode 操作手册

Fabric操作指南

MSP

Channel 配置(configtx)

Channel 配置(configtxgen)

Channel 重新配置(configtxlator)

背书策略

错误处理

日志控制

Fabric设计

架构说明

交易流程

CA

SDK--node

SDK--java

基于kafka的排序服务

Channels

账本

Read-Write set

Gossip数据传输协议

故障排除和常见问题

Hyperledger Fabric 答疑

MSP&ACL

Fabric SDK 设计

Makefile文件解析

BCCSP密码算法套件解析

Zanata使用指南

 

Hyperledger中文文档

Docs »

简介

Edit on GitHub

原文

作者

审核修正

原文

Wei Li

简介¶

Hyperledger Fabric是一个提供分布式账本解决方案的平台。Hyperledger Fabric由模块化架构支撑,并具备极佳的保密性、可伸缩性、灵活性和可扩展性。Hyperledger Fabric被设计成支持不同的模块组件直接拔插启用,并能适应在经济生态系统中错综复杂的各种场景。

Hyperledger Fabric提供了一个独特的可伸缩、可扩展的架构,这也是Hyperledger Fabric与其他区块链解决方案的显著区别。假如你正在计划部署具备完整审查机制以及开源架构的企业级区块链,Hyperledger Fabric是你的一个不错的起点。

对于初学者,推荐首先阅读下文中的简介,以便于理解区块链的工作原理、具有的主要特点以及Hyperledger Fabric中包含的组件。

如果你已经对区块链和Hyperledger Fabric有所了解,可直接阅读快速入门,在快速入门中包含相关示例、技术规格以及APIs等等。

区块链是什么?¶

分布式账本¶

一个区块链网络的核心是一个分布式账本,在这个账本中记录了网络中发生的所有交易信息。

区块链账本通常被定义为去中心化,这是因为在整个网络中,每个参与者都保存着一个区块链账本的副本,所有参与者通过协作共同维护着账本。接下来我们会看到,去中心化与协作这两个特点在现实世界的商业货物交易和商务服务中展现出的显著优点。

除了去中心化与协作,区块链的另一个显著特点是信息在只能以“附加”的方式记录在区块链中,同时使用加密技术保障了交易一旦被添加进账本中,就无法被篡改。区块链的这种不可篡改性使得信息来源的确认变得异常容易,这是由于参与者可以肯定信息一旦被写入区块链中就几乎不可被篡改。这也是为什么区块链常常也被称为证明的系统的原因。

智能合约¶

为了持续的进行信息的更新,以及对账本进行管理(写入交易,进行查询等),区块链网络引入了智能合约来实现对账本的访问和控制。

智能合约不仅仅可用于在区块链网络中打包信息,它们也可以被用于自动的执行由参与者定义的特定交易操作。

例如,买卖双方可以定义一个智能合约,以保证当卖方发货的商品运送到达时,买方支付的货款会自动转账给卖方。

共识¶

保持网络中所有账本交易的同步流程,就是共识。共识保证了账本只会在交易双方都确认后才进行更新。同时在账本更新时,交易双方能够在账本中的相同位置,更新一个相同的交易信息。

后面我们会详细介绍账本、智能合约和共识的相关内容。但目前为止,我们只需把区块链理解为一个共享的,通过智能合约更新的多副本交易系统,同时这个系统通过协作共识机制保证了网络中所有账本副本的同步。

区块链为什么切实可行?¶

当前的记录系统¶

自从商业数据记录网络系统诞生以来,直到今天的交易网络并没有发生太大的变化。在商业网络中的成员进行相互交易时,他们各自维护着自己独立的交易记录。同时,人们交易的物品——无论是16世纪佛兰德的挂毯,还是现代的有价证券——都任然需要在每次卖出交易过程中提供来源信息,以确保卖方拥有所出售商品的所有权。

当前的商业网络就像下图描述的一样:

随着科技的进步,上图中的交易流程不断演化发展,经历了从使用石碑、使用纸质账本、使用硬盘存储器直到使用云计算平台的不同阶段,但流程的底层架构并没有发生任何变化。并不存在一个可以统一管理网络参与者身份的系统,确认商品来源十分费劲,常常会耗费数天的时间明确证券的交易(包含数以万计美元的数量)。人们必须签订合约并手动执行,每一个系统中的数据库都包含着独立的信息并最终代表一个单点的错误。

在今天的信息和过程共享断裂的方法中,建立一个跨越商业网络的记录系统是不可能的,尽管可见性和信任的需求是明确的。

区块链的不同点¶

那我们为什么不用“现代”的交易系统来替代这种效率低下的网络?新的商业网络可以具有标准的方法建立身份信息,执行交易,并且存储数据。为什么不建立一个可信的交易链条记录?通过查询这个链条上的所有交易,来确定交易商品来源,并且这个链条上的信息一旦被写入,就无法被再次篡改。

以上描述的商业网络就如下图所示:

这就是区块链网络。在区块链网络中,每一个参与者都保有一份账本的副本。在区块链网络中,不仅仅是账本信息会被共享,更新账本的流程也是共享的。不同于目前的系统——参与者使用私有的程序对私有的账本进行更新,而区块链系统使用共享的程序对共享的账本进行更新。

通过使用共享账本协调整个商业网络,区块链网络能够减少时间、成本以及隐私信息泄露的风险,并且能使流程更加可信和透明。

现在你已经明白了什么是区块链以及它的用途。同时还有许多其他的内容也非常重要,他们是信息与流程共享的基础知识。

Hyperledger Fabric是什么?¶

2015年,Linux基金会启动了Hyperledger项目,目标是发展跨行业的区块链技术。Hyperledger项目并不仅仅是定义一个单一的区块链标准,它更鼓励通过开源社区的力量协作开发区块链技术。

Hyperledger Fabric是Hyperledger中的一个区块链项目。与其他区块链技术类似,Hyperledger Fabric包含一个账本,使用智能合约并且是一个通过所有参与者管理交易的系统。

Hyperledger Fabric与其他区块链系统最大的不同体现在私有和许可。与开放无需许可的网络系统允许未知身份的参与者加入网络不同(需要通过工作量证明协议来保证交易有效并维护网络的安全),Hyperledger Fabric通过Membership Service Provider(MSP)来登记所有的成员。

Hyperledger Fabric也提供了多个可拔插选项。账本数据可被存储为多种格式,共识机制可被接入或者断开,同时支持多种不同的MSP。

Hyperledger Fabric提供了建立channel的功能,这允许参与者为交易新建一个单独的账本。当网络中的一些参与者是竞争对手时,这个功能变得尤为重要。因为这些参与者并不希望所有的交易信息——比如提供给部分客户的特定价格信息——都对网络中所有参与者公开。只有在同一个channel中的参与者,才会拥有该channel中的账本,而其他不在此channel中的参与者则看不到这个账本。

共享账本¶

Hyperledger Fabric包含一个账本子系统,这个子系统包含两个组件:世界状态(world state)和交易记录。在Hyperledger Fabric网络中的每一个参与者都拥有一个账本的副本。

世界状态组件描述了账本在特定时间点的状态,它是账本的数据库。交易记录组件记录了产生世界状态当前值的所有交易,它是世界状态的更新历史。那么,账本则是世界状态数据库和交易历史记录的集合。

账本的世界状态存储数据库是可更换的。默认配置下,这是一个key-value存储数据库。交易记录模块不需要被接入。只需要记录在区块链网络中账本数据库被使用时之前和之后的值就可以了。

智能合约¶

Hyperledger Fabric智能合约被称为chaincode,当一个区块链外部的一个应用程序需要访问账本时,就会调用chaincode。大多数情况下,chaincode只会访问账本的数据库组件和世界状态(world state)(比如查询),但不会查询交易记录。

chaincode可通过多种不同编程语言实现。目前支持chaincode的语言是Go(包含对java的支持),更多的编程语言会在今后的版本中获得支持。

隐私¶

根据网络的需求,在一个Business-to-Business(B2B)网络中的参与者会对信息共享的程度极为敏感。然而,对于其他的网络,隐私并不是首要考虑的因素。

Hyperledger Fabric支持构建隐私保护严格的网络,也支持构建相对开放的网络。

共识¶

在网络中,不同的参与者写入的交易必须按照产生顺序依次被写入账本中。要实现这一目标,交易顺序必须被正确的建立并且必须包含拒绝错误(或者恶意)插入账本中的无效交易的方法。

这完全是计算机科学的研究领域,可以有多种方法实现上面提到的目标,这些方法各有优缺点。例如,PBFT (Practical Byzantine Fault Tolerance)可以为文件副本提供一种机制来相互通信,即使是在发生腐败的情况下,也可以保证每个副本保持一致。另外,在比特币中,通过一种称为挖矿的行为进行排序。在挖矿过程中,竞争的计算机竞相解决一个密码难题,这个谜题定义了所有后续的构建顺序。

Hyperledger Fabric被设计为允许网络构建者依据业务需求来选择采用的共识机制。好比考虑隐私性,就会有一连串的需求,从高度结构化的网络或是更加点对点的网络。

更多的Hyperledger Fabric共识机制会在另一份文档中详细描述,这些共识机制目前包含SOLO,Kafka以及后续会添加的SBFT (Simplified Byzantine Fault Tolerance)。

后续学习¶

快速入门¶

在快速入门中,我们提供了一些区块链网络核心组件介绍的教程。通过这些教程,你可以更进一步的学习到这些组件的运行机制,同时你也可以获取完整的代码并直接在一个区块链网络中运行一些简单的交易。同时,我们也提供了一些面向Hyperledger Fabric区块链网络维护人员的教程。

Hyperledger Fabric模型¶

在Hyperledger Fabric模型中,会对在这篇简介中提到的组件和概念进行了深入讲解,也包含一些其他未提到的内容,并通过一个交易流程示例描述了他们的工作机制。

Next

Previous

Hyperledger国际化工作组(yls@chainnova.com)

Built with MkDocs using a theme provided by Read the Docs.

GitHub

« Previous

Next »

什么是 Hyperledger Fabric? | IBM

什么是 Hyperledger Fabric? | IBM

什么是 Hyperledger Fabric?

IBM Blockchain Platform 背后使用的灵活区块链框架将帮助创新者加速实现全球业务转型

设计和开发指南

查看 IBM Blockchain Platform

什么是 Hyperledger Fabric?

Hyperledger Fabric 是来自 Linux Foundation 的开源项目,这是一个模块化区块链框架,也是企业区块链平台实际采用的标准。 作为开发企业级应用程序和行业解决方案的基础,开放式模块化架构使用即插即用组件来满足各种用例的要求。

在 120000 多个参与组织和 15000 多名参与工程师的共同努力下,Hyperledger Fabric 提供了一种独特的共识方法,既可以大规模提升性能,又可以保护企业要求的数据隐私。

Hyperledger 简介 (PDF,109 KB)

Hyperledger Fabric 如何工作

Hyperledger Fabric 是一种开放式、经过验证的企业级分布式分类帐平台。 它提供了一些高级隐私控件,因此只会在“要求许可权” (已知)的网络参与者之间共享您希望共享的数据。

智能合同会记录您要根据写入代码行的各方之间的自执行条款来自动执行的业务流程。 其中包含的代码和协议存在于分布式(分散式)区块链网络中。 交易可跟踪且不可逆,并会在组织之间建立信任。 这可让企业更快地做出更明智的决策,从而节省时间、降低成本并降低风险。

Hyperledger Fabric 的优势

要求许可权的网络

在已知参与者的网络中建立分散式信任,而不是在匿名参与者的开放网络中建立。

保密交易

仅向您要与之共享数据的相关方共享您希望共享的数据。

可插拔架构

利用可插拔架构(而不是采用“一刀切”方法),根据行业需求量身定制区块链。

易于入门

用您团队今天使用的语言编写智能合同,而不是使用学习定制语言和架构。

为什么使用 Hyperledger Fabric 作为区块链平台下的框架

IBM 建议企业不要仅使用免费的开放式源代码来构建生产区块链解决方案。 IBM(和其他供应商)提供了包含工具和支持的商业分发版。

IBM Blockchain Platform 是 IBM 推出的 Hyperledger Fabric 商用发行版,它为具有服务级别协议 (SLA) 的开源解决方案提供了完整的全天候 (24x7x365) 支持。 它附带了一组最先进的生产力工具,这些工具可用于构建、管理和运行 区块链解决方案。

阅读有关为何在 Hyperledger 上使用 IBM Blockchain Platform 的博客帖子

为什么要在 Hyperledger 使用 Platform

了解有关 IBM Blockchain Platform 的更多信息

Hyperledger Fabric 是一种企业级开源区块链

金融、银行、医疗保健、物联网、供应链、制造和技术等行业的创新者正在使用 Hyperledger Fabric 创建开放的标准化企业级区块链框架和代码库,以便产生切实的业务成果。

148  个 Hyperledger 公司部分

1840 万 行代码 

区块链用例

了解区块链和 we.trade 如何简化贸易过程。

了解 Farmer Connect 和 IBM Food Trust 如何通过区块链将咖啡种植者与咖啡饮用者联系在一起。

了解区块链如何在从发货到收货的整个过程中提供实时、共享且可信赖的商品信息。

行业首创的区块链平台转变了银行担保流程

了解该流程如何使各方都能获得和管理具有法律约束力的担保,并将签发时间减少到一天。

探索 Vertrax 和 Chateaux 软件的多云成功案例。

通过非接触式的区块链数字售票服务重新开放场馆

迈阿密的 Adrienne Arsht 表演艺术中心找到了举办小型户外活动和现场表演的新方式,那就是使用区块链技术提供安全的非接触式数字售票服务。

相关解决方案

区块链医疗保健和生命科学解决方案

利用基于区块链的网络和解决方案,解决信任、透明度和数据完整性方面的问题。

了解有关区块链医疗解决方案的更多信息

用于供应链解决方案的区块链

利用 IBM Blockchain,可以更快地解决问题,建立信任并改善供应链网络。

探索供应链区块链

贸易融资区块链解决方案

借助我们的网络召集专业知识和行业领先的平台,重塑贸易和贸易融资流程。

发现区块链贸易融资解决方案

金融服务区块链

加强所有人的信任度,并提高所有金融交易的透明度、简便性和效率。

探索金融服务区块链

政府区块链

使用新的自动化功能节省预算,更安全地共享数据,并

了解有关政府区块链的更多信息

媒体和娱乐区块链

区块链正改变着在线广告购买、网上售票、权限管理等领域。

探索媒体和娱乐区块链

资源

了解有关区块链的更多信息

深入了解区块链、其工作方式以及它给企业带来的好处。

区块链安全功能

了解区块链保护数据所使用的多种方式,具体取决于数据的固有结构、您选择的网络类型以及您授予的许可权。

顺利集成智能合同和网络管理

试用 IBM Blockchain Platform Extension for VSCode。 在单个工具中发现、编写、测试、调试、打包、部署和发布智能合同及应用程序。

促进业务区块链的采用

了解有关 Hyperledger 社区如何促进全球开源协作的更多信息。

区块链在中断期间所起的作用

一场关于区块链应对 2020 年各种挑战的方式以及未来工作方向的小组讨论。

欧盟区块链国家

与行业领导者一起参加面向开发人员和技术领导者的区块链讨论。

后续步骤

浏览我们的参考指南,更深入地了解区块链的各个方面,包括工作方式、使用方法以及实施注意事项。

区块链主题

什么是区块链

区块链的优点

智能合同

面向商业的区块链

区块链安全性

Blockchain for good

区块链和物联网

Hyperledger · GitHub

Hyperledger · GitHub

Skip to content

Toggle navigation

Sign in

hyperledger

Product

Actions

Automate any workflow

Packages

Host and manage packages

Security

Find and fix vulnerabilities

Codespaces

Instant dev environments

Copilot

Write better code with AI

Code review

Manage code changes

Issues

Plan and track work

Discussions

Collaborate outside of code

Explore

All features

Documentation

GitHub Skills

Blog

Solutions

For

Enterprise

Teams

Startups

Education

By Solution

CI/CD & Automation

DevOps

DevSecOps

Resources

Learning Pathways

White papers, Ebooks, Webinars

Customer Stories

Partners

Open Source

GitHub Sponsors

Fund open source developers

The ReadME Project

GitHub community articles

Repositories

Topics

Trending

Collections

Pricing

Search or jump to...

Search code, repositories, users, issues, pull requests...

Search

Clear

Search syntax tips

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Cancel

Submit feedback

Saved searches

Use saved searches to filter your results more quickly

Name

Query

To see all available qualifiers, see our documentation.

Cancel

Create saved search

Sign in

Sign up

You signed in with another tab or window. Reload to refresh your session.

You signed out in another tab or window. Reload to refresh your session.

You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

Hyperledger

1.4k

followers

United States of America

https://www.hyperledger.org

X

@hyperledger

https://discord.gg/hyperledger

github@hyperledger.org

Verified

We've verified that the organization hyperledger controls the domains:

www.hyperledger.org

hyperledger.org

Learn more about verified organizations

Overview

Repositories

Projects

Packages

People

Sponsoring

0

More

Overview

Repositories

Projects

Packages

People

Sponsoring

README.md

The mission of the Hyperledger Foundation is to foster and coordinate the premier community of software developers building enterprise grade open source software, in the form of platforms, libraries, tools and solutions, for multiparty systems using blockchain, distributed ledger, and related technologies; host the technical infrastructure for the Foundation, establishing a neutral home for community infrastructure, meetings, events, and collaborative discussions; drive broad adoption of the technology by building a substantial and diverse ecosystem of solution providers delivering production solutions and networks, and organizing industry end-users; advocate for the use and adoption of enterprise multiparty systems technologies through marketing, education and outreach; and work with other aligned organizations to accelerate implementation and public acceptance.

This organization contains the repositories for the Hyperledger Foundation and many of the hosted projects and working groups. Below is the list of core Academy Software Foundation repositories hosted here.

TOC is the home of the TOC processes, policies, programs, and meeting minutes. You can most easily view these materials at toc.hyperledger.org.

The hyperledger-dlt-landscape is the source for the Hyperledger Foundation DLT Landscape and where you can suggest changes and new entries. You can view the landscape at dltlandscape.hyperledger.org/

There are a number of ways that you can get involved with the Hyperledger community: participate on the Hyperledger mailing lists, start or join a Hyperledger meetup, or join us on Hyperledger's Discord server

Pinned

toc

toc Public

Hyperledger TOC documents

34

38

governance

governance Public

8

4

Repositories

Type

Select type

All

Public

Sources

Forks

Archived

Mirrors

Templates

Language

Select language

All

Assembly

C#

C++

CSS

Go

HTML

Java

JavaScript

Jinja

Kotlin

Makefile

Objective-C

Python

Ruby

Rust

Shell

Smarty

Swift

TeX

TypeScript

Sort

Select order

Last updated

Name

Stars

Showing 10 of 130 repositories

besu

Public

An enterprise-grade Java-based, Apache 2.0 licensed Ethereum client https://wiki.hyperledger.org/display/besu

Java

1,357

Apache-2.0

674

337

(7 issues need help)

39

Updated Mar 7, 2024

iroha

Public

Iroha - A simple, enterprise-grade decentralized ledger

C++

407

Apache-2.0

265

448

(1 issue needs help)

12

Updated Mar 7, 2024

fabric-gateway

Public

Go, Node and Java client API for Hyperledger Fabric v2.4+

Java

130

Apache-2.0

86

11

(3 issues need help)

0

Updated Mar 7, 2024

aries-framework-swift

Public

A Swift framework for Aries.

Swift

16

Apache-2.0

6

4

0

Updated Mar 7, 2024

fabric

Public

Hyperledger Fabric is an enterprise-grade permissioned distributed ledger framework for developing solutions and applications. Its modular and versatile design satisfies a broad range of industry use cases. It offers a unique approach to consensus that enables performance at scale while preserving privacy.

Go

15,270

Apache-2.0

8,697

162

(5 issues need help)

20

Updated Mar 7, 2024

cacti

Public

Hyperledger Cacti is a new approach to the blockchain interoperability problem

TypeScript

303

Apache-2.0

254

302

(20 issues need help)

13

Updated Mar 7, 2024

aries-acapy-plugins

Public

aries-acapy-plugins

Python

2

Apache-2.0

14

9

10

Updated Mar 7, 2024

fabric-chaincode-go

Public

Hyperledger Fabric Packages for Go Chaincode

Go

133

Apache-2.0

127

5

6

Updated Mar 7, 2024

aries-cloudagent-python

Public

Hyperledger Aries Cloud Agent Python (ACA-Py) is a foundation for building decentralized identity applications and services running in non-mobile environments.

Python

382

Apache-2.0

476

213

(9 issues need help)

12

Updated Mar 7, 2024

aries-endorser-service

Public

endorser-service

Python

5

Apache-2.0

10

4

0

Updated Mar 6, 2024

View all repositories

People

View all

Top languages

Go

Python

Rust

TypeScript

Java

Most used topics

hyperledger

blockchain

distributed-ledger

hacktoberfest

fabric

Footer

© 2024 GitHub, Inc.

Footer navigation

Terms

Privacy

Security

Status

Docs

Contact

Manage cookies

Do not share my personal information

You can’t perform that action at this time.

快速入门 - Hyperledger中文文档

快速入门 - Hyperledger中文文档

Hyperledger中文文档

欢迎

词汇表

简介

快速入门

前提

执行完整脚本

清理

configtxgen

执行generateCfgTrx.sh脚本

启动网络

背后发生了什么?

这表明了什么?

查看交易

查看chaincode日志

手动执行交易

修改docker-compose文件

命令语法

Create channel

Join channel

Install chaincode

Instantiate chaincode

Invoke chaincode

Query chaincode

手动构建镜像

使用本地二进制文件

终端1

终端2

终端1

终端3

Create channel

Join channel

Install chaincode

Instantiate chaincode

Invoke chaincode

Query chaincode

使用CouchDB

数据持久化

故障排出

协议规范

Fabric教程

构建第一个fabric网络

编写第一个应用

Chaincode 指南

Chaincode 开发手册

Chaincode 操作手册

Fabric操作指南

MSP

Channel 配置(configtx)

Channel 配置(configtxgen)

Channel 重新配置(configtxlator)

背书策略

错误处理

日志控制

Fabric设计

架构说明

交易流程

CA

SDK--node

SDK--java

基于kafka的排序服务

Channels

账本

Read-Write set

Gossip数据传输协议

故障排除和常见问题

Hyperledger Fabric 答疑

MSP&ACL

Fabric SDK 设计

Makefile文件解析

BCCSP密码算法套件解析

Zanata使用指南

 

Hyperledger中文文档

Docs »

快速入门

Edit on GitHub

原文

作者

审核修正

原文

Linsheng Yu

Kewei Sun

本文设定了一个简单的Fabric网络场景,包括2个organization,每个有2个peer,并使用“solo” ordering服务。网络实体所需的加密材料(x509证书)已预先生成并放到相应目录和配置文件里了,你无需修改这些配置。examples/e2e_cli文件夹里包含了docker-compose文件和要用来创建和测试网络的脚本文件。

本文还演示了使用配置生成工具configtxgen生成网络配置。

前提¶

完成以下安装Fabric源码和编译configtxgen工具:

完成环境安装,并设置正确的$GOPATH环境变量。

拉取Fabric源码

git clone https://github.com/hyperledger/fabric.git

编译configtxgen工具

如果运行在Linux,在Fabric目录下执行以下命令:

cd $GOPATH/src/github.com/hyperledger/fabric

make configtxgen

# 如果出错:'ltdl.h' file not found

sudo apt install libtool libltdl-dev

# 然后再运行make

make configtxgen

如果运行在OSX,先安装Xcode 8.0或以上版本,然后在Fabric目录下执行以下命令:

# 安装 Homebrew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

# 添加 gnu-tar

brew install gnu-tar --with-default-names

# 添加 libtool

brew install libtool

# 编译 configtxgen

make configtxgen

编译成功后输出:

build/bin/configtxgen

CGO_CFLAGS=" " GOBIN=/Users/johndoe/work/src/github.com/hyperledger/fabric/build/bin go install -ldflags "-X github.com/hyperledger/fabric/common/metadata.Version=1.0.0-snapshot-8d3275f -X github.com/hyperledger/fabric/common /metadata.BaseVersion=0.3.0 -X github.com/hyperledger/fabric/common/metadata.BaseDockerLabel=org.hyperledger.fabric" github.com/hyperledger/fabric/common/configtx/tool/configtxgen

Binary available as build/bin/configtxgen``

编译后执行文件放在Fabric目录下的的build/bin/configtxgen

执行完整脚本¶

为了加快部署过程,我们提供了一个脚本来执行所有任务。执行该脚本会生成配置结果、本地网络、Chaincode测试。

进入examples/e2e_cli目录,首先从Docker Hub拉取镜像:

# 使脚本可执行

chmod +x download-dockerimages.sh

# 执行脚本

./download-dockerimages.sh

这个过程会需要几分钟,脚本执行后输出:

===> List out hyperledger docker images

hyperledger/fabric-ca latest 35311d8617b4 7 days ago 240 MB

hyperledger/fabric-ca x86_64-1.0.0-alpha 35311d8617b4 7 days ago 240 MB

hyperledger/fabric-couchdb latest f3ce31e25872 7 days ago 1.51 GB

hyperledger/fabric-couchdb x86_64-1.0.0-alpha f3ce31e25872 7 days ago 1.51 GB

hyperledger/fabric-kafka latest 589dad0b93fc 7 days ago 1.3 GB

hyperledger/fabric-kafka x86_64-1.0.0-alpha 589dad0b93fc 7 days ago 1.3 GB

hyperledger/fabric-zookeeper latest 9a51f5be29c1 7 days ago 1.31 GB

hyperledger/fabric-zookeeper x86_64-1.0.0-alpha 9a51f5be29c1 7 days ago 1.31 GB

hyperledger/fabric-orderer latest 5685fd77ab7c 7 days ago 182 MB

hyperledger/fabric-orderer x86_64-1.0.0-alpha 5685fd77ab7c 7 days ago 182 MB

hyperledger/fabric-peer latest 784c5d41ac1d 7 days ago 184 MB

hyperledger/fabric-peer x86_64-1.0.0-alpha 784c5d41ac1d 7 days ago 184 MB

hyperledger/fabric-javaenv latest a08f85d8f0a9 7 days ago 1.42 GB

hyperledger/fabric-javaenv x86_64-1.0.0-alpha a08f85d8f0a9 7 days ago 1.42 GB

hyperledger/fabric-ccenv latest 91792014b61f 7 days ago 1.29 GB

hyperledger/fabric-ccenv x86_64-1.0.0-alpha 91792014b61f 7 days ago 1.29 GB

现在运行完整脚本:

./network_setup.sh up

如果没有设置channel-ID参数,channel名默认是mychannel。脚本执行成功后输出:

===================== Query on PEER3 on channel 'mychannel' is successful =====================

===================== All GOOD, End-2-End execution completed =====================

此时,网络启动运行并测试成功。

清理¶

停止网络:

# 在e2e_cli目录下

docker rm -f $(docker ps -aq)

然后执行docker images命令查看Chaincode镜像,类似输出如下:

REPOSITORY TAG IMAGE ID CREATED SIZE

dev-peer3-mycc-1.0 latest 13f6c8b042c6 5 minutes ago 176 MB

dev-peer0-mycc-1.0 latest e27456b2bd92 5 minutes ago 176 MB

dev-peer2-mycc-1.0 latest 111098a7c98c 5 minutes ago 176 MB

删除这些镜像:

docker rmi

例如:

docker rmi -f 13f e27 111

最后删除配置结果,在crypto/orderer目录删除orderer.block和channel.tx。

configtxgen¶

configtxgen工具生成两个内容: Orderer的bootstrap block和Fabric的channel configuration transaction。

orderer block是ordering服务的创世区块;channel transaction文件在create channel时会被广播给orderer。

configtx.yaml包含网络的定义,并给出了网络组件的拓扑结构–2个成员(Org0和Org1)分别管理维护2个peer。还指出每个网络实体的加密材料的存储位置。crypto目录包含每个实体的admin证书、ca证书、签名证书和私钥。

为了方便使用,我们提供了一个脚本generateCfgTrx.sh,该脚本整合了configtxgen的执行过程,执行后会生成两个配置结果:orderer.block和channel.tx。如果你运行过上边的network_setup.sh则这两个配置结果已生成,要先到crypto/orderer目录将之删除。

执行generateCfgTrx.sh脚本¶

在e2e_cli目录下:

cd $GOPATH/src/github.com/hyperledger/fabric/examples/e2e_cli

generateCfgTrx.sh脚本有个可选参数channel-ID,如果不设此参数,则默认为mychannel。

# 如上所述, 参数是可选的

./generateCfgTrx.sh

执行成功后输出:

2017/02/28 17:01:52 Generating new channel configtx

2017/02/28 17:01:52 Creating no-op MSP instance

2017/02/28 17:01:52 Obtaining default signing identity

2017/02/28 17:01:52 Creating no-op signing identity instance

2017/02/28 17:01:52 Serializing identity

2017/02/28 17:01:52 signing message

2017/02/28 17:01:52 signing message

2017/02/28 17:01:52 Writing new channel tx

生成的orderer.block和channel.tx两个文件存放在crypto/orderer目录。

orderer.block是ordering服务的创世区块,channel.tx包含新channel的配置信息。如前所述,这俩文件都来自configtx.yaml及其所包含的加密材料和网络信息的数据。

注意:也可手动执行脚本generateCfgTrx.sh里的命令。如果使用这种方式,则必须先用e2e_cli目录下的configtx.yaml替换Fabric sampleconfig目录下默认的configtx.yaml,然后返回fabric目录执行这些命令,前提是删除之前generateCfgTrx.sh生成的两个文件。

启动网络¶

使用docker-compose启动网络,如果没有拉取Fabric镜像,则返回之前的操作去拉取镜像。

脚本script.sh嵌入到docker-compose文件里,该脚本将peer加入到channel并向peer发送read/write请求,如此便可自动执行交易流程。如果不想使用这个脚本自动执行交易,可以跳到下面“手动执行交易”一节。

在e2e_cli目录下使用docker-compose生成网络实体并执行嵌入的脚本:

CHANNEL_NAME= docker-compose up -d

如果之前创建了一个channel名,就必须将其作为参数,否则使用默认的mychannel。例如:

CHANNEL_NAME=mychannel docker-compose up -d

等待一会儿,因为背后有交易会发送到peer。执行docker ps查看运行状态的container,可以看到如下内容:

vagrant@hyperledger-devenv:v0.3.0-4eec836:/opt/gopath/src/github.com/hyperledger/fabric/examples/e2e_cli$ docker ps

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

45e3e114f7a2 dev-peer3-mycc-1.0 "chaincode -peer.a..." 4 seconds ago Up 4 seconds dev-peer3-mycc-1.0

5970f740ad2b dev-peer0-mycc-1.0 "chaincode -peer.a..." 24 seconds ago Up 23 seconds dev-peer0-mycc-1.0

b84808d66e99 dev-peer2-mycc-1.0 "chaincode -peer.a..." 48 seconds ago Up 47 seconds dev-peer2-mycc-1.0

16d7d94c8773 hyperledger/fabric-peer "peer node start -..." About a minute ago Up About a minute 0.0.0.0:10051->7051/tcp, 0.0.0.0:10053->7053/tcp peer3

3561a99e35e6 hyperledger/fabric-peer "peer node start -..." About a minute ago Up About a minute 0.0.0.0:9051->7051/tcp, 0.0.0.0:9053->7053/tcp peer2

0baad3047d92 hyperledger/fabric-peer "peer node start -..." About a minute ago Up About a minute 0.0.0.0:8051->7051/tcp, 0.0.0.0:8053->7053/tcp peer1

1216896b7b4f hyperledger/fabric-peer "peer node start -..." About a minute ago Up About a minute 0.0.0.0:7051->7051/tcp, 0.0.0.0:7053->7053/tcp peer0

155ff8747b4d hyperledger/fabric-orderer "orderer" About a minute ago Up About a minute 0.0.0.0:7050->7050/tcp orderer

背后发生了什么?¶

在CLI容器中执行了脚本script.sh。该脚本用默认的mychannel执行createChannel命令,这个命令用到了之前configtxgen工具生成的channel.tx。

createChannel执行后会生成一个创世区块mychannel.block并保存到当前目录。

对4个peer分别执行joinChannel命令,通过初始区块mychannel.block加入channel。至此,有一个channel包含4个peer和2个organization。

PEER0和PEER1属于Org0,PEER2和PEER3属于Org1。这些关系的定义都在configtx.yaml中

Chaincode chaincode_example02被install到PEER0和PEER2

然后Chaincode在PEER2上instantiate。实例化是指启动容器和初始化与Chaincode相关的键值对,本例中的初始值是[“a”,”100” “b”,”200”]。实例化的结果是一个名为dev-peer2-mycc-1.0的容器启动,注意,这个容器仅是针对PEER2。(译注:尤其注意这里仅仅是启动了一个container)

实例化时还会带有背书策略参数,本例中背书策略为`-P “OR (‘Org0MSP.member’,’Org1MSP.member’)”,意思是任何交易必须由绑定到Org0或者Org1的peer背书。

对于“a”的query请求发送到PEER0。在之前Chaincode被install到PEER0了,所以就可以启动一个名为dev-peer0-mycc-1.0的新容器,然后返回查询结果。由于没有write操作发生,所以“a”的值依然是“100”。

从“a“转移”10“给”b”的invoke请求发送到PEER0

Chaincode install到PEER3

对“a”的query请求发送到PEER3。这启动了第三个名为dev-peer3-mycc-1.0的容器,并返回查询结果90,正确的反映了之前的交易。

这表明了什么?¶

Chaincode必须被install到一个peer上才能成功的对这个peer的ledger执行read/write操作。此外,只有当在peer上针对chaincode执行read/write操作时,这个peer上才会启动该chaincode 容器。(比如,查询“a”的值)交易导致容器启动。channel中的所有peer(包括那些没有install chaincode的peer,就像上例中的PEER3)都会维护一个准确的ledger,ledger包含存储了不可变的、有序的交易记录的block,还有维护current state的statedb。在peer上install chaincode之后就可以直接使用该peer上的chaincode了(就像上例中的PEER3),因为之前已经instantiate过了 (译注:即同一channel中的chaincode只需一次instantiate)。

查看交易¶

查看CLI容器的log:

docker logs -f cli

输出:

2017-02-28 04:31:20.841 UTC [logging] InitFromViper -> DEBU 001 Setting default logging level to DEBUG for command 'chaincode'

2017-02-28 04:31:20.842 UTC [msp] GetLocalMSP -> DEBU 002 Returning existing local MSP

2017-02-28 04:31:20.842 UTC [msp] GetDefaultSigningIdentity -> DEBU 003 Obtaining default signing identity

2017-02-28 04:31:20.843 UTC [msp] Sign -> DEBU 004 Sign: plaintext: 0A8F050A59080322096D796368616E6E...6D7963631A0A0A0571756572790A0161

2017-02-28 04:31:20.843 UTC [msp] Sign -> DEBU 005 Sign: digest: 52F1A41B7B0B08CF3FC94D9D7E916AC4C01C54399E71BC81D551B97F5619AB54

Query Result: 90

2017-02-28 04:31:30.425 UTC [main] main -> INFO 006 Exiting.....

===================== Query on chaincode on PEER3 on channel 'mychannel' is successful =====================

===================== All GOOD, End-2-End execution completed =====================

你也可以实时查看日志,需要打开两个终端。

首先,停止运行着的docker容器:

docker rm -f $(docker ps -aq)

在第一个终端启动docker-compose脚本:

# add the appropriate CHANNEL_NAME parm

CHANNEL_NAME= docker-compose up -d

在第二个终端查看log:

docker logs -f cli

这将实时输出通过script.sh执行的交易信息。

查看chaincode日志¶

对每个chaincode容器单独查看log,输出:

$ docker logs dev-peer2-mycc-1.0

04:30:45.947 [BCCSP_FACTORY] DEBU : Initialize BCCSP [SW]

ex02 Init

Aval = 100, Bval = 200

$ docker logs dev-peer0-mycc-1.0

04:31:10.569 [BCCSP_FACTORY] DEBU : Initialize BCCSP [SW]

ex02 Invoke

Query Response:{"Name":"a","Amount":"100"}

ex02 Invoke

Aval = 90, Bval = 210

$ docker logs dev-peer3-mycc-1.0

04:31:30.420 [BCCSP_FACTORY] DEBU : Initialize BCCSP [SW]

ex02 Invoke

Query Response:{"Name":"a","Amount":"90"}

手动执行交易¶

停止所有容器:

docker rm -f $(docker ps -aq)

然后,执行docker images命令查看chaincode镜像,会有类似以下内容:

REPOSITORY TAG IMAGE ID CREATED SIZE

dev-peer3-mycc-1.0 latest 13f6c8b042c6 5 minutes ago 176 MB

dev-peer0-mycc-1.0 latest e27456b2bd92 5 minutes ago 176 MB

dev-peer2-mycc-1.0 latest 111098a7c98c 5 minutes ago 176 MB

删除这些镜像:

docker rmi

比如:

docker rmi -f 13f e27 111

确保之前生成的配置内容还在,如果删除了就再执行脚本:

./generateCfgTrx.sh

或者使用脚本中的命令手动生成。

修改docker-compose文件¶

打开docker-compose文件注释掉执行script.sh脚本的命令,如下:

working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer

# command: /bin/bash -c './scripts/script.sh ${CHANNEL_NAME}'

保存文件,重启网络:

# 在e2e_cli目录下执行,设置正确的CHANNEL_NAME

CHANNEL_NAME= docker-compose up -d

命令语法¶

参照script.sh脚本中的create和join命令。下面的命令只是针对PEER0的,当对orderer和peer执行命令时,需要修改下面给出的四个环境变量的值。

# 对PEER0所用的环境变量

CORE_PEER_MSPCONFIGPATH=$GOPATH/src/github.com/hyperledger/fabric/peer/crypto/peer/peer0/localMspConfig

CORE_PEER_ADDRESS=peer0:7051

CORE_PEER_LOCALMSPID="Org0MSP"

CORE_PEER_TLS_ROOTCERT_FILE=$GOPATH/src/github.com/hyperledger/fabric/peer/crypto/peer/ peer0/localMspConfig/cacerts/peerOrg0.pem

每个peer的环境变量的值都在docker-compose文件中

Create channel¶

进去cli容器:

docker exec -it cli bash

执行成功输出:

root@0d78bb69300d:/opt/gopath/src/github.com/hyperledger/fabric/peer#

用-c指定channel name,-f指定channel configuration transaction(此例中是channel.tx),当然也可以使用不同的名称安装 configuration transaction。

# channel.tx 和 orderer.block 在 cli 容器的 crypto/orderer 目录下

peer channel create -o orderer0:7050 -c mychannel -f crypto/orderer/channel.tx --tls $CORE_PEER_TLS_ENABLED --cafile $GOPATH/src/github.com/hyperledger/fabric/peer/crypto/orderer/localMspConfig/cacerts/ordererOrg0.pem

由于此例的peer channel create命令是针对orderer的,所以需要修改之前的环境变量,因此上边的命令应该是:

CORE_PEER_MSPCONFIGPATH=$GOPATH/src/github.com/hyperledger/fabric/peer/crypto/orderer/localMspConfig CORE_PEER_LOCALMSPID="OrdererMSP" peer channel create -o orderer0:7050 -c mychannel -f crypto/orderer/channel.tx --tls $CORE_PEER_TLS_ENABLED --cafile $GOPATH/src/github.com/hyperledger/fabric/peer/crypto/orderer/localMspConfig/cacerts/ordererOrg0.pem

注意:下面的其他命令依然在CLI容器中执行,而且要记住命令里每个peer对应的环境变量

Join channel¶

将指定的peer加入到channel:

# 默认只将 PEER0 加入

peer channel join -b mychannel.block

完整的命令应该是:

CORE_PEER_MSPCONFIGPATH=$GOPATH/src/github.com/hyperledger/fabric/peer/crypto/peer/peer0/localMspConfig CORE_PEER_ADDRESS=peer0:7051 CORE_PEER_LOCALMSPID="Org0MSP" CORE_PEER_TLS_ROOTCERT_FILE=$GOPATH/src/github.com/hyperledger/fabric/peer/crypto/peer/peer0/localMspConfig/cacerts/peerOrg0.pem peer channel join -b mychannel.block

修改这四个环境变量将其他的peer加入到channel中

Install chaincode¶

将示例chaincode代码安装到四个对等节点中的一个:

# 在命令前面要加上peer对应的四个环境变量

peer chaincode install -n mycc -v 1.0 -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02

Instantiate chaincode¶

在一个peer上实例化chaincode,这将对该peer启动一个chaincode容器,并为该chaincode设置背书策略。此例中定义的策略是有Org0或Org1中的一个peer背书即可。命令如下:

# 在命令前面要加上peer对应的四个环境变量

# 用 -C 参数设置正确的channel名,默认是 mychannel

peer chaincode instantiate -o orderer0:7050 --tls $CORE_PEER_TLS_ENABLED --cafile $GOPATH/src/github.com/hyperledger/fabric/peer/crypto/orderer/localMspConfig/cacerts/ordererOrg0.pem -C mychannel -n mycc -v 1.0 -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02 -c '{"Args":["init","a", "100", "b","200"]}' -P "OR ('Org0MSP.member','Org1MSP.member')"

Invoke chaincode¶

# 在命令前面要加上peer对应的四个环境变量

peer chaincode invoke -o orderer0:7050 --tls $CORE_PEER_TLS_ENABLED --cafile $GOPATH/src/github.com/hyperledger/fabric/peer/crypto/orderer/localMspConfig/cacerts/ordererOrg0.pem -C mychannel -n mycc -c '{"Args":["invoke","a","b","10"]}'

Query chaincode¶

# 在命令前面要加上peer对应的四个环境变量

peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}'

执行结果:

Query Result: 90

手动构建镜像¶

构建peer和orderer镜像:

# 在fabric目录下执行,如果不能顺利生成镜像,则使用vagrant环境

make peer-docker orderer-docker

执行docker images命令输出:

vagrant@hyperledger-devenv:v0.3.0-4eec836:/opt/gopath/src/github.com/hyperledger/fabric$ docker images

REPOSITORY TAG IMAGE ID CREATED SIZE

hyperledger/fabric-orderer latest 264e45897bfb 10 minutes ago 180 MB

hyperledger/fabric-orderer x86_64-0.7.0-snapshot-a0d032b 264e45897bfb 10 minutes ago 180 MB

hyperledger/fabric-peer latest b3d44cff07c6 10 minutes ago 184 MB

hyperledger/fabric-peer x86_64-0.7.0-snapshot-a0d032b b3d44cff07c6 10 minutes ago 184 MB

hyperledger/fabric-javaenv latest 6e2a2adb998a 10 minutes ago 1.42 GB

hyperledger/fabric-javaenv x86_64-0.7.0-snapshot-a0d032b 6e2a2adb998a 10 minutes ago 1.42 GB

hyperledger/fabric-ccenv latest 0ce0e7dc043f 12 minutes ago 1.29 GB

hyperledger/fabric-ccenv x86_64-0.7.0-snapshot-a0d032b 0ce0e7dc043f 12 minutes ago 1.29 GB

hyperledger/fabric-baseimage x86_64-0.3.0 f4751a503f02 4 weeks ago 1.27 GB

hyperledger/fabric-baseos x86_64-0.3.0 c3a4cf3b3350 4 weeks ago 161 MB

使用本地二进制文件¶

进去vagrant环境:

cd $GOPATH/src/github.com/hyperledger/fabric/devenv

# 第一次启动VM用 vagrant up

vagrant ssh

在fabric目录下编译peer和orderer:

make clean

make native

生成ccenv镜像:

make peer-docker

然后打开两个终端都进入vagrant,至此有三个终端都在vagrant里。

前首先清空ledger文件夹/var/hyperledger/(每次运行后,为避免错误或重复,都要清空):

rm -rf /var/hyperledger/*

终端1¶

使用configtxgen工具创建orderer创世区块:

configtxgen -profile SampleSingleMSPSolo -outputBlock orderer.block

终端2¶

用刚生成的创世区块启动orderer:

ORDERER_GENERAL_GENESISMETHOD=file ORDERER_GENERAL_GENESISFILE=./orderer.block orderer

终端1¶

创建 channel configuration transaction:

configtxgen -profile SampleSingleMSPSolo -outputCreateChannelTx channel.tx -channelID

执行成功会在当前目录生成channel.tx

终端3¶

以chainless模式启动peer:

peer node start --peer-defaultchain=false

Create channel¶

以channel.tx为参数创建channel:

peer channel create -o 127.0.0.1:7050 -c mychannel -f channel.tx

执行后在当前目录生成一个channel的创世区块mychannel.block

Join channel¶

通过channel的创世区块mychannel.block加入channel:

peer channel join -b mychannel.block

Install chaincode¶

在peer上安装chaincode:

peer chaincode install -o 127.0.0.1:7050 -n mycc -v 1.0 -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02

执行成功后查看文件可以看到mycc.1.0:

ls /var/hyperledger/production/chaincodes

Instantiate chaincode¶

实例化chaincode:

peer chaincode instantiate -o 127.0.0.1:7050 -C mychannel -n mycc -v 1.0 -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02 -c '{"Args":["init","a", "100", "b","200"]}'

docker ps查看运行中的容器,如果chaincode启动成功,则显示:

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

bd9c6bda7560 dev-jdoe-mycc-1.0 "chaincode -peer.a..." 5 seconds ago Up 5 seconds dev-jdoe-mycc-1.0

Invoke chaincode¶

调用chaincode从“a”转移“10”给“b“:

peer chaincode invoke -o 127.0.0.1:7050 -C mychannel -n mycc -c '{"Args":["invoke","a","b","10"]}'

Query chaincode¶

查询”a“的值:

# 返回值应是 90

peer chaincode query -o 127.0.0.1:7050 -C mychannel -n mycc -c '{"Args":["query","a"]}'

运行完成后不要忘记清空ledger文件夹/var/hyperledger/:

rm -rf /var/hyperledger/*

使用CouchDB¶

可以将stateDB默认的goleveldb替换成CouchDB。对于CouchDB,chaincode各功能依然可用,但将chaincode数据以JSON方式存储的话就可使用CouchDB的复杂查询的功能。

为了使用CouchDB,除了最前面的”前提“一节的操作外,还需要下边两步启动CouchDB容器并将之与peer容器关联:

构建CouchDB镜像:

# make sure you are in the fabric directory

make couchdb

编辑fabric/examples/e2e_cli/docker-compose.yaml和docker-compose.yam,将所有与CouchDB有关的内容取消注释。这样chaincode_example02就可以才CouchDB下运行了。

注意:如果将CouchDB容器的端口映射的主机,请一定要注意安全。在开发环境中将端口映射出来可以通过CouchDB的web界面可视化操作数据。生产环境中一般不会做端口映射,以限制CouchDB的外部访问。

可以用chaincode_example02在CouchDB下执行上边的chaincode操作,但是为了使用CouchDB的复杂查询功能,chaincode数据一定要以JSON格式存储(例如fabric/examples/chaincode/go/marbles02)。

使用手动执行交易这一节中的步骤install、instantiate、invoke和query marbles02,执行完Join channel这步后使用下边的命令操作marbles02:

在PEER0上安装并实例化chaincode

peer chaincode install -o orderer0:7050 -n marbles -v 1.0 -p github.com/hyperledger/fabric/examples/chaincode/go/marbles02

peer chaincode instantiate -o orderer0:7050 --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/orderer/localMspConfig/cacerts/ordererOrg0.pem -C mychannel -n marbles -v 1.0 -p github.com/hyperledger/fabric/examples/chaincode/go/marbles02 -c '{"Args":["init"]}' -P "OR ('Org0MSP.member','Org1MSP.member')"

创建一些marble并移动它们

peer chaincode invoke -o orderer0:7050 --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/orderer/localMspConfig/cacerts/ordererOrg0.pem -C mychannel -n marbles -c '{"Args":["initMarble","marble1","blue","35","tom"]}'

peer chaincode invoke -o orderer0:7050 --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/orderer/localMspConfig/cacerts/ordererOrg0.pem -C mychannel -n marbles -c '{"Args":["initMarble","marble2","red","50","tom"]}'

peer chaincode invoke -o orderer0:7050 --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/orderer/localMspConfig/cacerts/ordererOrg0.pem -C mychannel -n marbles -c '{"Args":["initMarble","marble3","blue","70","tom"]}'

peer chaincode invoke -o orderer0:7050 --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/orderer/localMspConfig/cacerts/ordererOrg0.pem -C mychannel -n marbles -c '{"Args":["transferMarble","marble2","jerry"]}'

peer chaincode invoke -o orderer0:7050 --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/orderer/localMspConfig/cacerts/ordererOrg0.pem -C mychannel -n marbles -c '{"Args":["transferMarblesBasedOnColor","blue","jerry"]}'

peer chaincode invoke -o orderer0:7050 --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/orderer/localMspConfig/cacerts/ordererOrg0.pem -C mychannel -n marbles -c '{"Args":["delete","marble1"]}'

如果做了CouchDB容器的端口映射,可以通过web界面查看数据,可以看到名为mychannel的数据库及其文档

如果使用的是vagrant环境

http://localhost:15984/_utils

* 如果不是vagrant环境,使用CouchDB容器指定的端口

http://localhost:5984/_utils

可有规律的查询chaincode(例如,读取marble2)

peer chaincode query -C mychannel -n marbles -c ‘{“Args”:[“readMarble”,”marble2”]}’

可以看到marble2的详细信息:

Query Result: {"color":"red","docType":"marble","name":"marble2","owner":"jerry","size":50}

获取marble1的历史:

peer chaincode query -C mychannel -n marbles -c '{"Args":["getHistoryForMarble","marble1"]}'

可以看到操作过marble1的交易:

Query Result: [{"TxId":"1c3d3caf124c89f91a4c0f353723ac736c58155325f02890adebaa15e16e6464", "Value":{"docType":"marble","name":"marble1","color":"blue","size":35,"owner":"tom"}},{"TxId":"755d55c281889eaeebf405586f9e25d71d36eb3d35420af833a20a2f53a3eefd", "Value":{"docType":"marble","name":"marble1","color":"blue","size":35,"owner":"jerry"}},{"TxId":"819451032d813dde6247f85e56a89262555e04f14788ee33e28b232eef36d98f", "Value":}]

还可以执行复杂查询,比如查询jerry所拥有的marble:

peer chaincode query -C mychannel -n marbles -c '{"Args":["queryMarblesByOwner","jerry"]}'

查询结果为jerry所拥有的2个marble的信息:

Query Result: [{"Key":"marble2", "Record":{"color":"red","docType":"marble","name":"marble2","owner":"jerry","size":50}},{"Key":"marble3", "Record":{"color":"blue","docType":"marble","name":"marble3","owner":"jerry","size":70}}]

通过owner字段等于jerry查询:

peer chaincode query -C mychannel -n marbles -c '{"Args":["queryMarbles","{\"selector\":{\"owner\":\"jerry\"}}"]}'

查询结果如下:

Query Result: [{"Key":"marble2", "Record":{"color":"red","docType":"marble","name":"marble2","owner":"jerry","size":50}},{"Key":"marble3", "Record":{"color":"blue","docType":"marble","name":"marble3","owner":"jerry","size":70}}]

数据持久化¶

如果需要对peer或CouchDB容器的数据持久化,一种选择是将容器的相关目录挂在到docker主机。例如,将下面两行内容放到docker-compose.yaml文件中的对应peer处:

volumes:

- /var/hyperledger/peer0:/var/hyperledger/production

将下面两行放到对应的CouchDB处:

volumes:

- /var/hyperledger/couchdb0:/opt/couchdb/data

故障排出¶

每次运行后要清理文件

如果出现docker错误,则删除镜像,从头再操作一遍

make clean

make peer-docker orderer-docker

如果出现下面的错误

Error: Error endorsing chaincode: rpc error: code = 2 desc = Error installing chaincode code mycc:1.0(chaincode /var/hyperledger/production/chaincodes/mycc.1.0 exits)

chaincode镜像(如dev-peer0-mycc-1.0或dev-peer1-mycc-1.0)可能是以前运行过的。删除它们然后重试。

docker rmi -f $(docker images | grep peer[0-9]-peer[0-9] | awk '{print $3}')

使用down选项清理网络

./network_setup.sh down

Next Previous

Next

Previous

Hyperledger国际化工作组(yls@chainnova.com)

Built with MkDocs using a theme provided by Read the Docs.

GitHub

« Previous

Next »

Learn – Hyperledger Foundation

Learn – Hyperledger Foundation

Introducing new project Hyperledger Web3j  > Find out more 

About

About

About Us

Members

TOC

Governing Board

Speakers Bureau

Staff

Charter

Code of Conduct

FAQ

Logos & Guidelines

Hyperledger Store

Featured

White Paper

An Overview of Hyperledger Foundation

New Brand Study

Get the latest insights

Projects

Projects

Projects Overview

Aries

Besu

Cacti

Fabric

Firefly

Indy

Iroha

All Projects

Project Matrix

Labs

Contribute to coding

/dev/weekly newsletter

Featured

Workshop

Register now for the Web3j workshop

Upcoming Workshop

Register now for the ZK Proofs & Programming Workshop

Participate

Participate

Get started →

Attend an event

Find a meetup near you

Find a regional chapter

Join a Special Interest Group

Look for a job

Additional Resources

Wiki

Discord

Mailing Lists

Github Repos

Linux Foundation ID

Member Portal

Use

Use

Training and Certification

Workshops & Tutorials

Vendor Directory

Hyperledger Certified Service Providers

Training Partners

Featured

New Certification

Demonstrate your understanding of the fundamentals of blockchain tech with the new Hyperledger Fabric certification

FREE COURSE

Introduction to Hyperledger Self-Sovereign Identity Blockchain Solutions (LFS172x)

Learn

Learn

Case Studies

Use Case Tracker

Webinars

White Papers

Research

DLT Landscape

Featured

Training & Certifications

Discover technical training courses and professional certifications to get up-to-speed on blockchain and DLT technologies.

Case Study

Circulor Readies Market for New Regulations by Adding Battery Passport to Hyperledger Fabric-Powered traceability Platform

Blog & News

Blog & News

Blog

Announcements

Newsletters

Videos

Featured

Anniversary Webinar

Insights from the Governing Board

New Project

Introducing Hyperledger Web3j

Join

Learn

Learn more about blockchain technology, Hyperledger Foundation and its projects

 

 

 

Hyperledger Foundation is a global collaboration, hosted by The Linux Foundation, and includes leaders in finance, banking, Internet of Things, supply chains, manufacturing and Technology. Explore various resources to learn more.

Webinars

Register for upcoming Hyperledger webinars or watch them on-demand.

Videos

Explore how-to videos and community spotlights on Hyperledger topics.

Training & Certification

Discover and enroll for training and certification courses on Hyperledger technologies.

Tutorials

Find resources for self-taught learning about the Hyperledger projects.

Open Source Resources

Contribute and work with open source community.

Case Studies

Browse various use cases powered by Hyperledger technologies.

White Papers

Read popular white papers created by the Hyperledger community.

Research

Read research and findings curated by the Hyperledger community.

Vendor Directory

Search for business blockchain products and services built by our members with Hyperledger code.

Use Case Tracker

Check out the cross-industry PoCs, pilots and production deployments in use today, built with Hyperledger frameworks and tools.

Academia

Education institutions will teach needed skills, research new uses and help shape the direction of enterprise blockchain.

Jobs

Search for Hyperledger an business blockchain job listings.

Wiki

Learn more about the technical community, development and contribute to Hyperledger projects.

Hyperledger Certified Service Providers

See which companies have deep experience helping enterprises successfully adopt and deploy Hyperledger technologies.

Contribute and Work with Open Source Community

Open Source is a big part of Hyperledger’s philosophy. We strongly believe that through open source, we can build sustainable and reliable ecosystems. But it can be confusing, if you’re not used to working in an open source community. Below relevant resources are listed to help guide you on your open source journey, depending on your experience level:

Level

Summary

Resources

Beginner

Getting Started in Hyperledger Open Source Community

Why get involved

How to get involved

How to become a community leader

Time Commitment: 10min video

Watch Now

Beginner

Working with Upstream Open Source Projects

Time Commitment: 16min video

How to Work in Open Source

Video by Ibrahim Haddad, Ph.D.Executive Director, LF AI Foundation

Watch Now

Beginner & Intermediate

Recruiting Open Source Developers

Time Commitment: Review 5 things

Read Now

Beginner & Intermediate

Getting Involved With Hyperledger

View the Presentation

Advanced

Open Source Guides Reading List

Read Now

All Levels

Building Leadership in an Open Source Community

This guide explains how organizations can build leadership and influence within the open source projects they’re involved in and on which they are commercially dependent.

Review Now

 

Sign up for Hyperledger Horizon & /dev/weekly newsletters 

By signing up, you acknowledge that your information is subject to The Linux Foundation's Privacy Policy

 

About

Projects

Participate

Blog & News

Contact Us

Join

Copyright © 2024 The Linux Foundation®. All rights reserved. Hyperledger Foundation, Hyperledger, and the other Hyperledger Foundation trademarks are trademarks of The Linux Foundation. For a list of Hyperledger Foundation trademarks, please see our Trademark Usage page. Linux is a registered trademark of Linus Torvalds. Privacy Policy and Terms of Use.

Hyperledger - Hyperledger - Hyperledger Foundation

Hyperledger - Hyperledger - Hyperledger Foundation

Log in

Skip to sidebar

Skip to main content

Linked ApplicationsLoading…

Spaces

Projects

Groups

Labs

Events

Community

Hit enter to search

Help

Online Help

Keyboard Shortcuts

Feed Builder

What’s new

Available Gadgets

About Confluence

Log in

HyperledgerSpace shortcutsCalendar Technical Oversight CommitteeSecurity/dev/weekly NewsletterMarketing HyperledgerPage tree

Browse pagesConfigureSpace tools

Attachments (40)

Page History

Page Information

Resolved comments

View in Hierarchy

View Source

Export to PDF

Export to Word

Pages

Jira links

Hyperledger

Created by Ry Jones, last modified by David Boswell on Feb 23, 2024

   The Hyperledger Foundation is an open source collaborative effort created to advance cross-industry blockchain technologies. It is a global collaboration, hosted by The Linux Foundation, including leaders in finance, banking, IoT, supply chain, manufacturing and technology.  To learn more, check out the About Hyperledger page.  You can also find out more about Hyperledger's projects, labs, Working Groups, Special Interest Groups and other community activities at the links below.

Getting StartedEveryone is welcome to get involved.  Not sure where to start?Watch the Getting Involved with Hyperledger videoVisit the Frequently Asked Questions page.Get a free Linux Foundation ID to access our tools.

 Trending Community Activity

Recent Issues

755 Comparisons should support constants

754 Overflow checking in constant arithmetic

2056 Create a iroha procedural macro for impl FromStr for AssetValueType and other C like enums

2053 Unit test the private_blockchain permissions validators

2047 Add non_zero numeric types where acceptable

See more >>>

Recent Pull Requests

6692 Use external custom error prone dependency

99 Bump github.com/golang/protobuf from 1.5.3 to 1.5.4

6688 [build] - Update gradle build to invoke int test compile task on assemble task

6687 eth_call with blobs - added more spec tests

29 Jupyter upgrades for exchange and support functions

See more >>>

Recent Releases

0.12.0rc2 0.12.0rc2

0.62.0 Release 0.62.0

0.2.1 0.2.1

0.2.1-binary 0.2.1-binary

24.2.0-RC4 24.2.0-RC4

See more >>>

Graduated Projects

These Hyperledger projects have successfully exited the incubation phase (see the Project Lifecycle document for more details about Graduated Projects).  All of these projects are open, so feel free to get involved with anything that looks interesting.  You can also add all Project calls to your calendar to find out about upcoming meetings. Hyperledger Aries provides a shared, reusable, interoperable tool kit designed for initiatives and solutions focused on creating, transmitting and storing verifiable digital credentials. It is infrastructure for blockchain-rooted, peer-to-peer interactions. This project consumes the cryptographic support provided by Hyperledger Ursa, to provide secure secret management and decentralized key management functionality. Hyperledger Besu is an Ethereum client designed to be enterprise-friendly for both public and private permissioned network use cases, with an extractable EVM implementation. It can also be run on test networks such as Sepolia and Görli. Hyperledger Besu includes several consensus algorithms including Proof of Stake, Proof of Work, and Proof of Authority (IBFT 2.0, QBFT, and Clique). Its comprehensive permissioning schemes are designed specifically for use in a consortium environment.Hyperledger Cacti is a blockchain integration tool designed to allow users to securely integrate different blockchains. Hyperledger Fabric is intended as a foundation for developing applications or solutions with a modular architecture. Hyperledger Fabric allows components, such as consensus and membership services, to be plug-and-play. Its modular and versatile design satisfies a broad range of industry use cases. It offers a unique approach to consensus that enables performance at scale while preserving privacy.Hyperledger Firefly is a multiparty system for enterprise data flows, powered by blockchain. It solves all of the layers of complexity that sit between the low level blockchain and high level business processes and user interfaces. FireFly enables developers to build blockchain apps for enterprise radically faster by allowing them to focus on business logic instead of infrastructure. Hyperledger Indy provides tools, libraries, and reusable components for providing digital identities rooted on blockchains or other distributed ledgers so that they are interoperable across administrative domains, applications, and any other silo. Indy is interoperable with other blockchains or can be used standalone powering the decentralization of identity. Hyperledger Iroha is designed to be simple and easy to incorporate into infrastructural or IoT projects requiring distributed ledger technology. Hyperledger Iroha features a simple construction, modular, domain-driven C++ design, emphasis on client application development and a new, crash fault tolerant consensus algorithm, called YAC.

Special Interest Groups

Special Interest Groups (SIGs) are industry specific groups of community members working together to help drive adoption of Hyperledger.  All of these groups are open, so feel free to get involved with anything that looks interesting.  You can also add all Special Interest Group calls to your calendar to find out about upcoming meetings. Learn more about Special Interest Groups.

Climate Action and Accounting SIGFinancial Markets SIGHealthcare SIGIdentity SIG

Media and Entertainment SIGPublic Sector SIGSupply Chain and Trade Finance SIGTelecom SIG

Regional Communities

Hyperledger is a global community and people contribute from all over the world. In some places community members have organized regional activities for those who share a common geography and/or language. Check out the information below to see how to connect with an existing regional community or learn how to create a new regional chapter.

Hyperledger Africa ChapterHyperledger Brazil ChapterTechnical Working Group ChinaHyperledger India Chapter

Hyperledger Italian ChapterHyperledger Japan ChapterHyperledger Latinoamerica Chapter

Task Forces

Task Forces are short-term groups created by the Technical Oversight Committee to focus on specific deliverables.  All Task Forces are open to anyone who is interested in getting involved, so feel free to check out the following groups and join the discussions on Discord and in Task Force calls.  Learn more about Task Forces.

Incubation Projects

These Hyperledger projects are in the incubation phase (see the Project Lifecycle document for more details about Incubation Projects).  All of these projects are open, so feel free to get involved with anything that looks interesting.  You can also add all Project calls to your calendar to find out about upcoming meetings.Hyperledger AnonCreds – short for “Anonymous Credentials”- is the most commonly used Verifiable Credential (VC) format in the world. Ledger agnostic and with a formal open specification, AnonCreds is a VC format that adds important privacy-protecting ZKP (zero-knowledge proof) capabilities to the core VC assurances.Hyperledger Bevel is an accelerator/tool that helps developers rapidly set up and deploy secure, scalable and production-ready DLT network(s) that also allows new organizations to be easily on-boarded on the network. Bevel accelerates DLT network deployment and lets developers focus on building blockchain applications without having to waste precious time standing up the environment or worrying whether the network will scale and meet production requirements. Bevel facilitates a safe and secure way of deploying and operating different DLT platforms. Hyperledger Caliper is a blockchain benchmark tool, it allows users to measure the performance of a blockchain implementation with a set of predefined use cases. Hyperledger Caliper will produce reports containing a number of performance indicators to serve as a reference when using the following blockchain solutions: Hyperledger Besu, Hyperledger Burrow, Ethereum, Hyperledger Fabric, FISCO BCOS, Hyperledger Iroha, and Hyperledger Sawtooth. Hyperledger Cello aims to serve as the operational dashboard for Blockchain, which reduces the effort required for creating, managing and using blockchains. Besides, it can also be used to facilitate creating Blockchain as a Service. Cello provides an operational console for managing blockchain’s efficiently and running on top of various infrastructures, e.g., baremetal, virtual machine, and various container platforms.Hyperledger Solang is a Solidity compiler written in rust which uses llvm as the compiler backend. Solang can compile Solidity for Solana and Substrate.Hyperledger Web3j is a highly modular, reactive, type safe Java and Android library for working with Smart Contracts and integrating with clients (nodes) on the Ethereum network.Note: Hyperledger Avalon, Hyperledger Burrow, Hyperledger Composer, Hyperledger Explorer, Hyperledger Grid, Hyperledger Quilt, Hyperledger Sawtooth, Hyperledger Transact and Hyperledger Ursa have been moved to Archived status.  The code for the projects is still available.

Hyperledger Labs

Hyperledger Labs provides a space (i.e., GitHub repos) where work can easily be started without the creation of a project.  Labs are a good place to experiment and to start to build a community around an idea.  Several Hyperledger projects initially started out as a lab.  Anyone is welcome to start a new lab and you're also welcome to get involved in any of the existing labs.  The following labs have also set up regular community calls where you can dial-in to learn more, ask questions and collaborate with others.BDLS ConsensusBDLS is an innovative BFT consensus algorithm that features safety and liveness by presenting a mathematically proven secure BFT protocol that is resilient in open networks such as the Internet.Blockchain ExplorerExplorer is a simple, powerful, easy-to-use, open-source utility to browse activity on the underlying blockchain network.CardeaCardea is a complete ecosystem for the exchange of privacy-preserving digital credentialsOpen Enterprise AgentThe Enterprise Cloud Agent is a W3C/Aries standards-based cloud agent written in Scala that provides self-sovereign identity services to build products and solutions based on it.OrionOrion is a key-value/document database with certain blockchain properties suchPrivate Data ObjectsPrivate Data Objects (PDO) enables sharing of data and coordinating action amongst mutually distrusting parties.

No labels

Overview

Content Tools

Activity

Powered by a free Atlassian Confluence Open Source Project License granted to The Linux Foundation. Evaluate Confluence today.

Powered by Atlassian Confluence 7.19.17

Printed by Atlassian Confluence 7.19.17

Report a bug

Atlassian News

Atlassian

{"serverDuration": 154, "requestCorrelationId": "e1b13dfc93c7c9aa"}

About Us | Hyperledger

About Us | Hyperledger

Introducing new project Hyperledger Web3j  > Find out more 

About

About

About Us

Members

TOC

Governing Board

Speakers Bureau

Staff

Charter

Code of Conduct

FAQ

Logos & Guidelines

Hyperledger Store

Featured

White Paper

An Overview of Hyperledger Foundation

New Brand Study

Get the latest insights

Projects

Projects

Projects Overview

Aries

Besu

Cacti

Fabric

Firefly

Indy

Iroha

All Projects

Project Matrix

Labs

Contribute to coding

/dev/weekly newsletter

Featured

Workshop

Register now for the Web3j workshop

Upcoming Workshop

Register now for the ZK Proofs & Programming Workshop

Participate

Participate

Get started →

Attend an event

Find a meetup near you

Find a regional chapter

Join a Special Interest Group

Look for a job

Additional Resources

Wiki

Discord

Mailing Lists

Github Repos

Linux Foundation ID

Member Portal

Use

Use

Training and Certification

Workshops & Tutorials

Vendor Directory

Hyperledger Certified Service Providers

Training Partners

Featured

New Certification

Demonstrate your understanding of the fundamentals of blockchain tech with the new Hyperledger Fabric certification

FREE COURSE

Introduction to Hyperledger Self-Sovereign Identity Blockchain Solutions (LFS172x)

Learn

Learn

Case Studies

Use Case Tracker

Webinars

White Papers

Research

DLT Landscape

Featured

Training & Certifications

Discover technical training courses and professional certifications to get up-to-speed on blockchain and DLT technologies.

Case Study

Circulor Readies Market for New Regulations by Adding Battery Passport to Hyperledger Fabric-Powered traceability Platform

Blog & News

Blog & News

Blog

Announcements

Newsletters

Videos

Featured

Anniversary Webinar

Insights from the Governing Board

New Project

Introducing Hyperledger Web3j

Join

+Open source

+Open development

+Open governance

= the future of decentralized tech

 

A part of the Linux Foundation

By embracing the open-source principles established by the Linux Foundation, Hyperledger Foundation promotes interoperability and standardization, paving the way for the widespread adoption of secure and scalable blockchain and digital trust solutions across industries and sectors.

Read the charter

Useful Links

Read the Hyperledger Foundation

White Paper

Read the latest

Hyperledger Brand Study

Read the Hyperledger Foundation

Community code of conduct

Explore the New

Hyperledger DLT Landscape

Community Statistics

 

Hyplerledger Foundation Timeline

Learn about Membership

About

Projects

Participate

Blog & News

Contact Us

Join

Copyright © 2024 The Linux Foundation®. All rights reserved. Hyperledger Foundation, Hyperledger, and the other Hyperledger Foundation trademarks are trademarks of The Linux Foundation. For a list of Hyperledger Foundation trademarks, please see our Trademark Usage page. Linux is a registered trademark of Linus Torvalds. Privacy Policy and Terms of Use.