hyperledger fabric 测试(三) 1.13 加入新的组织

Mac Pro下部署Hyperledger Fabric 1.4.4 主要参考网址: https://www.jianshu.com/p/cd05e966a6a8 https://hyperledgercn.github.io/hyperledgerDocs/getting_started/ https://www.cnblogs.com/zongmin/p/11635686.html#autoid-0-3-1 https://www.jianshu.com... 阅读详情

搭建好的环境已经可以正常运行多组织多节点的fabric,在已经正常运行的通道中加入新的组织,步骤如下:

1.如果要手动执行,首先在docker-compose-org3.yaml中增加org3,同时在cli和org3中设置手动执行变量CORE_LOGGING_LEVEL为DEBUG,隐藏原来设置。增加的org3为:

version: '2'

 

volumes:

  peer0.org3.example.com:

  peer1.org3.example.com:

 

networks:

  byfn:

 

services:

 

  peer0.org3.example.com:

    container_name: peer0.org3.example.com

    extends:

      file: base/peer-base.yaml

      service: peer-base

    environment:

      - CORE_PEER_ID=peer0.org3.example.com

      - CORE_PEER_ADDRESS=peer0.org3.example.com:7051

      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org3.example.com:7051

      - CORE_PEER_LOCALMSPID=Org3MSP

    volumes:

        - /var/run/:/host/var/run/

        - ./org3-artifacts/crypto-config/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/msp:/etc/hyperledger/fabric/msp

        - ./org3-artifacts/crypto-config/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls:/etc/hyperledger/fabric/tls

        - peer0.org3.example.com:/var/hyperledger/production

    ports:

      - 11051:7051

      - 11053:7053

    networks:

      - byfn

 

  peer1.org3.example.com:

    container_name: peer1.org3.example.com

    extends:

      file: base/peer-base.yaml

      service: peer-base

    environment:

      - CORE_PEER_ID=peer1.org3.example.com

      - CORE_PEER_ADDRESS=peer1.org3.example.com:7051

      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org3.example.com:7051

      - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org3.example.com:7051

      - CORE_PEER_LOCALMSPID=Org3MSP

    volumes:

        - /var/run/:/host/var/run/

        - ./org3-artifacts/crypto-config/peerOrganizations/org3.example.com/peers/peer1.org3.example.com/msp:/etc/hyperledger/fabric/msp

        - ./org3-artifacts/crypto-config/peerOrganizations/org3.example.com/peers/peer1.org3.example.com/tls:/etc/hyperledger/fabric/tls

        - peer1.org3.example.com:/var/hyperledger/production

    ports:

      - 12051:7051

      - 12053:7053

    networks:

      - byfn

 

 

  Org3cli:

    container_name: Org3cli

    image: hyperledger/fabric-tools:$IMAGE_TAG

    tty: true

    stdin_open: true

    environment:

      - GOPATH=/opt/gopath

      - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock

      #- CORE_LOGGING_LEVEL=INFO

      - CORE_LOGGING_LEVEL=DEBUG

      - CORE_PEER_ID=Org3cli

      - CORE_PEER_ADDRESS=peer0.org3.example.com:7051

      - CORE_PEER_LOCALMSPID=Org3MSP

      - CORE_PEER_TLS_ENABLED=true

      - CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/server.crt

      - CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/server.key

      - CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/ca.crt

      - CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org3.example.com/users/Admin@org3.example.com/msp

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

    command: /bin/bash

    volumes:

        - /var/run/:/host/var/run/

        - ./../chaincode/:/opt/gopath/src/github.com/chaincode

        - ./org3-artifacts/crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/

        - ./crypto-config/peerOrganizations/org1.example.com:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com

        - ./crypto-config/peerOrganizations/org2.example.com:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com

        - ./scripts:/opt/gopath/src/github.com/hyperledger/fabric/peer/scripts/

    depends_on:

      - peer0.org3.example.com

      - peer1.org3.example.com

    networks:

      - byfn

2.新建文件configtx.yaml和 org3-crypto.yaml,前一个规定了org3的锚节点和msp等信息,后一个规定了基本结构生成org3的密匙证书等。

configtx.yaml文件

---

Organizations:

    - &Org3

        # DefaultOrg defines the organization which is used in the sampleconfig

        # of the fabric.git development environment

        Name: Org3MSP

 

        # ID to load the MSP definition as

        ID: Org3MSP

 

        MSPDir: crypto-config/peerOrganizations/org3.example.com/msp

 

        AnchorPeers:

            # AnchorPeers defines the location of peers which can be used

            # for cross org gossip communication.  Note, this value is only

            # encoded in the genesis block in the Application section context

            - Host: peer0.org3.example.com

              Port: 7051

org3-crypto.yaml文件

PeerOrgs:

  # ---------------------------------------------------------------------------

  # Org3

  # ---------------------------------------------------------------------------

  - Name: Org3

    Domain: org3.example.com

    EnableNodeOUs: true

    Template:

      Count: 2

    Users:

      Count: 1

3.生成密匙和证书等材料命令:../../bin/cryptogen generate --config=./org3-crypto.yaml

 创建json文件,包含策略连接信息命令:export FABRIC_CFG_PATH=$PWD && ../../bin/configtxgen -printOrg Org3MSP > ../channel-artifacts/org3.json

拷贝排序Org的MSP材料到Org3的 crypto-config 目录下:cd ../ && cp -r crypto-config/ordererOrganizations org3-artifacts/crypto-config/

进入cli环境,默认org1为管理员环境:docker exec -it cli bash

安装解析json文件的jq:apt update && apt install -y jq

设置根证书和通道名称的环境变量:export ORDERER_CA=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem  && export CHANNEL_NAME=mychannel

检查环境变量准确性:echo $ORDERER_CA && echo $CHANNEL_NAME

以二进制protobuf格式拉取最新的通道配置文件:peer channel fetch config config_block.pb -o orderer.example.com:7050 -c $CHANNEL_NAME --tls --cafile $ORDERER_CA

去除无关数据,将二进制文件转化为可读可修改的json文件:configtxlator proto_decode --input config_block.pb --type common.Block | jq .data.data[0].payload.data.config > config.json

4.生成包括org3的json文件:jq -s '.[0] * {"channel_group":{"groups":{"Application":{"groups": {"Org3MSP":.[1]}}}}}' config.json ./channel-artifacts/org3.json > modified_config.json

生成原有的二进制通道配置文件:configtxlator proto_encode --input config.json --type common.Config --output config.pb

生成包含org3的通道配置文件:configtxlator proto_encode --input modified_config.json --type common.Config --output modified_config.pb

计算两个pb文件的差异,得出更新的pb配置文件:configtxlator compute_update --channel_id $CHANNEL_NAME --original config.pb --updated modified_config.pb --output org3_update.pb

将pb更新文件转化为json文件:configtxlator proto_decode --input org3_update.pb --type common.ConfigUpdate | jq . > org3_update.json

使用信封消息来包装文件,即添加元数据的删除的数据:echo '{"payload":{"header":{"channel_header":{"channel_id":"mychannel", "type":2}},"data":{"config_update":'$(cat org3_update.json)'}}}' | jq . > org3_update_in_envelope.json

最后转化为完整的pb格式文件:configtxlator proto_encode --input org3_update_in_envelope.json --type common.Envelope --output org3_update_in_envelope.pb

5.使用org1管理员身份进行签名:peer channel signconfigtx -f org3_update_in_envelope.pb  //默认环境变量为org1,使用的配置策略为and,所以需要两者签名。

更改环境变量到org2:export  CORE_PEER_LOCALMSPID="Org2MSP"

export CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt

export CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp

export  CORE_PEER_ADDRESS=peer0.org2.example.com:7051

使用org2进行签名并提交:peer channel update -f org3_update_in_envelope.pb -c $CHANNEL_NAME -o orderer.example.com:7050 --tls --cafile $ORDERER_CA

查看 peer0.org1.example.com 的日志:docker logs -f peer0.org1.example.com

6.生成org3 cli和org3 peer节点容器:docker-compose -f docker-compose-org3.yaml up -d

启动cli 容器,进入默认的org3 peer0节点容器:docker exec -it Org3cli bash

设置名称和通道排序服务根证书的环境变量:export ORDERER_CA=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem && export CHANNEL_NAME=mychannel

检查环境变量的设置:echo  $ORDERER_CA && echo $CHANNEL_NAME

检索0号区块,检查是否将org3成功加入通道:peer channel fetch 0 mychannel.block -o orderer.example.com:7050 -c $CHANNEL_NAME --tls --cafile $ORDERER_CA

指定0号区块为初始区块:peer channel join -b mychannel.block

设置节点2的环境变量:export CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org3.example.com/peers/peer1.org3.example.com/tls/ca.crt && export CORE_PEER_ADDRESS=peer1.org3.example.com:7051

节点2加入0号区块:peer channel join -b mychannel.block

Org3 peer1安装链码:peer chaincode install -n mycc -v 2.0 -p github.com/chaincode/chaincode_example02/go/

Org3 peer0安装链码需要修改环境变量:export CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/ca.crt && export CORE_PEER_ADDRESS=peer0.org3.example.com:7051

Org3 peer0安装链码:peer chaincode install -n mycc -v 2.0 -p github.com/chaincode/chaincode_example02/go/

进入org2环境:export CORE_PEER_LOCALMSPID="Org2MSP"

export CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt

export CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp

export CORE_PEER_ADDRESS=peer0.org2.example.com:7051

Org2安装链码:peer chaincode install -n mycc -v 2.0 -p github.com/chaincode/chaincode_example02/go/

Org1环境变量:

export CORE_PEER_LOCALMSPID="Org1MSP"

export CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt

export CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp

export CORE_PEER_ADDRESS=peer0.org1.example.com:7051

Org1安装链码:peer chaincode install -n mycc -v 2.0 -p github.com/chaincode/chaincode_example02/go/

将org3加入策略:peer chaincode upgrade -o orderer.example.com:7050 --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA -C $CHANNEL_NAME -n mycc -v 2.0 -c '{"Args":["init","a","90","b","210"]}' -P "OR ('Org1MSP.peer','Org2MSP.peer','Org3MSP.peer')"

7.Org3环境变量:export CORE_PEER_LOCALMSPID="Org3MSP"

export CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/ca.crt

export CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org3.example.com/users/Admin@org3.example.com/msp

export CORE_PEER_ADDRESS=peer0.org3.example.com:7051

查询a的值:peer chaincode query -C $CHANNEL_NAME -n mycc -c '{"Args":["query","a"]}'

从a转移10到b:peer chaincode invoke -o orderer.example.com:7050  --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA -C $CHANNEL_NAME -n mycc -c '{"Args":["invoke","a","b","10"]}'

查询a的值:peer chaincode query -C $CHANNEL_NAME -n mycc -c '{"Args":["query","a"]}'

遇到的错误:没有找见org3 msp文件:将/home/ubuntu/go/src/github.com/hyperledger/fabric/scripts/fabric-samples/first-network/crypto-config/peerOrganizations/org3.example.com 文件复制 /crypto/peerorg/下

遇见环境变量步骤错误等原因,将链码版本更新在安装。

Hyperledger Fabric/Fabric-samples 安装及使用(Mac) 1.清单 brew Git cUrl docker docker-compose GoLang 2.开始安装 2.1 Git mac自带git,也可自行安装:brew install git 2.2 curl brew install curl 2.3 docker brew install docker 2.4 docker-compose 无需操作,docker安装完成后,也含有了docker-compose 以上安装细节也可自行百度,网上都有^.^ 2.5 GoLang 1& 阅读详情

相关推荐

Hyperledger Fabric1.1 网络启动与链码调用

环境:macOS High Sierra(Version 10.13.3) 参考:Hyperledger Fabric Samples Fabric官方提供了一个示例项目fabric-samples,本文通过运行该项目来展示fabric的搭建与链码的安装调用。 1. 克隆项目 克隆hyperledger提供的fabric-samples项目 git clone https://g...

ミ安之偌素 3224

(十)Fabric2.0-动态添加组织

Fabric2.0动态添加组织是很多朋友比较关注,我们从上一章更新通道配置的思路来看,动态添加组织实践上也是通过修改区块配置来实现, 接下来的操作基于first-network已部署好的网络。 1. 新增org3证书配置 对于fabric网络来说,要新增一个组织,首先是从证书开始,因为证书就是fabric里面的身份。 编辑证书配置org3-crypto.yaml (first-network/or...

富强说 4869

Hyperledger Fabric(二)- First Network

First Network是Fabric提供的一个示例,主要用来学习Fabric的环境配置与执行步骤。 试验时操作系统为macOS 10.13.2 / ubuntu 16.04。CentOS 7在执行时遇到了一个问题。试验以ubuntu为例。

MyIgnorance的博客 4555

hyperledger/fabric-区块链快速入门教程+错误解决——良好用户体验

hyperledger/fabric-区块链快速入门 目录 操作系统 软件安装 源码获取 hyperledger 环境配置 镜像获取 入门测试 fabric-samples releas-1.0 开始测试 releas-1.0 master(2.2.0) 智能合约 fabric 相关错误与解决方案 fabric-samples测试出错

jack_zj123的博客 3106

Hyperledger Fabric-sdk-java

Hyperledger Fabric-sdk-java

l_ricardo的博客 3053

Hyperledger Fabric2.3 环境搭建及Fabric 测试网络使用

1、安装ubuntu20 Download Ubuntu Desktop | Download | Ubuntu 2、下载 安装环境 3、下载fabric2.3.0文件 https://github.com/hyperledger/fabric/tree/v2.3.0

大伟的博客 1万+

超级账本 hyperledger fabric v2.x 安装与搭建一个测试网络

超级账本 hyperledger fabric v2.x 安装与搭建一个测试网络

每一个不曾起舞的日子,都是对生命的辜负 3699

【5G演进】4G到5G演进之网络架构与协议栈

4G到5G演进之网络架构与协议栈

Learning makes me happy (0^◇^0) 5529

搭建Hyperledger Fabric环境 的详细步骤,超级详细

本教程是跟着 某硅谷 三年前的视频一点点实现的。但是,跟着教程走,会出现很多视频里面没有出现过的问题,本文着重讲解搭建过程碰到的问题及解决方案!!1、 安装docker (见我之前的教程)2、安装docker-compose3、安装Golang 4. 安装node.js5、安装Git最好先更新apt-get,否则可能会下载版本很旧的git,这是个好习惯,在下载任何包的时候,最好都更新一下工具下面的截图是我学习的教程里面的截图, 但是在我操作的过程中会总有些镜像拉取不下来! 原因:因为官方的sh文件存在版

目前专注区块链相关技术的学习与分享 1万+

深入浅出PWM:用示波器带你理解占空比与滤波效果

本文通过示波器实测,深入浅出地解析了PWM(脉宽调制)的核心原理。从占空比与平均电压的关系入手,详细演示了RC及有源滤波器如何将数字方波“翻译”为平滑模拟电压,并探讨了PWM-DAC的精度、响应速度等关键设计考量,为硬件调试与电路设计提供了实用的实践指导。

weixin_29292431的博客 344

ffmpeg在windows的安装、合并、切片、.m4s、.m3u8处理

自己处理视频,我用的工具是 ffmpeg,因为涉及到.m3u8格式和.m4s格式的一些操作。ffmpeg的介绍我就不多说了,这里是它的官网地址: https://ffmpeg.org/ ,这里是文档: https://ffmpeg.org/documentation.html (看的头大,没咋看下去)...

一只爱吃糖的小羊 2689

万字解析——区块链hyperledger fabric2.2部署实战教程

本文为官方文档解析,包含了network测试网络和两个实战示例。

专攻毕设大企鹅的博客 3万+

高通平台power_supply 框架下添加第三方充电IC的驱动方法

1.power_supply电源框架介绍: power supply framework在kernel/drivers/power/下。内核抽象出来power supply子系统为驱动提供了统一的框架。 功能包括: 1.抽象PSY设备的共性,向用户空间提供统一的API; 2.为底层PSY驱动的编写,提供简单、统一的方式,同时封装并实现公共逻辑。 power supply class位于d...

Change 1万+

Ubuntu环境下搭建hyperledger fabric测试网络详细教程

Ubuntu环境下搭建hyperledger fabric超级无敌详细教程 一、搭建前提条件 1.1 如果尚未安装最新版本的git,请安装它 $ sudo apt-get install git 1.2 如果尚未安装最新版本的curl,请安装它 $ sudo apt-get install curl 1.3 如果尚未安装最新版本的Docker,请安装它 1.3.1 如果安装了docker旧版本,卸载旧版本docker(可选) $ sudo apt-get remove docker docker-en

qq_41831136的博客 8220

360加固DEX解密与ELF修复技术解析

本文深入解析360加固的DEX解密与ELF修复技术,详细介绍了其多层保护机制、Java层入口分析、Native层加载流程及反调试绕过技巧。通过RC4和zlib解密技术,结合Frida工具实现内存Dump和ELF文件修复,为逆向工程师提供实用解决方案。

weixin_29327525的博客 508

单细胞实战之亚细胞分群从T/NK至CD4+T细胞——从入门到进阶(中级篇1)

亚细胞分群从T/NK至CD4+T细胞

zfyyzhys的博客 6389

(一)HyperLedger Fabric 2.0-release编译镜像二进制文件+测试网络部署

1.环境准备 系统工具 版本 备注 CentOS 7 Docker 18.09.4 Docker-compose 1.32.2 参考:CentOS7安装Docker-compose推荐方案 GO 1.13.4 参考:CentOS7安装Go 2.下载源码 1.创建go工作目录 mkdir go mkdir go/src mkdir go/pkg mkdir go...

富强说 1万+

ZYNQ双核通信实战:手把手教你用OpenAMP搭建Linux+FreeRTOS开发环境(2018.3版)

本文详细介绍了如何在ZYNQ平台上使用OpenAMP框架实现双核通信,构建Linux与FreeRTOS协同开发环境。从开发环境配置、系统组件编译到OpenAMP框架应用,手把手指导开发者完成ZYNQ双核通信系统的搭建与调试,为异构计算开发提供实用解决方案。

weixin_33737134的博客 475

Hyperledger Fabric2中文文档-链码部署

翻译官方文档https://hyperledger-fabric.readthedocs.io/en/latest/deploy_chaincode.html#install-the-chaincode-package 向Channel中部署链码 终端用户通过调用智能合约与区块链分类账交互,Hyperledger Fabric的智能合约被称为链代码。想要验证或查询数据的组织需要在他们的peer中安装链代码。在加入channel的peer上安装链代码后,channel成员可以调用链代码并更改账本数据。

ling的专栏 5260

验证码破解2.0:Python+CV大模型搞定滑块/点选验证

核心创新:基于YOLOv8+SAM CV大模型的端到端验证码破解方案,无需人工设计特征,适配多种验证码类型;核心价值高成功率:滑块验证≥95%,点选验证≥90%,远超传统CV方案;低延迟:单验证码破解≤2秒,满足高并发采集需求;行为模拟:生成符合人类操作的轨迹,绕过行为检测;易扩展:统一架构支持新增验证码类型,仅需少量标注数据微调;技术要点采用YOLOv8实现快速目标检测,SAM实现像素级分割;生成物理规律的人类轨迹,模拟真实操作行为;

专注于Python爬虫开发,分享爬虫技巧、项目实战与反爬经验,使用Scrapy、BeautifulSoup等工具,解决数据抓取难题。 1261

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

【Hyperledger Fabric】学习笔记2——超级账本介绍

2. 超级账本介绍 2.1 超级账本简介 超级账本是推动区块链跨行业应用的开源项目的总称,组织成员可以发起新的区块链项目,加 入超级账本项目中,但需要遵循超级账本的生命周期。 超级账本的生命周期分为5个阶段,分别为Proposal(提案)、lncubation(孵化)、Active (活跃)、Deprecated(过时)、End of Life(结束)。 超级整本的整个生命周期的过程:成员发起新项目时,1)首先发起者撰写草案,草案内容包括 实现的目标、开发过程、代码维护等信

zqq_2016的博客 2万+

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

在Kubernetes上部署Hyperledger Fabric

Hyperledger Fabric是一个开源区块链框架实现,是Linux基金会托管的Hyperledger项目之一。 它是用于分布式分类帐解决方案的平台。 本文旨在通过使用Kubernetes简化Fabric操作。 由于以下原因,此工具是理想的: 使用Kubernetes可以轻松实现高可用性(HA)。 Fabric内置在容器映像中,Kubernetes在编排,缩放和管理容器中很...

cuml0912的博客 1583

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

RU DOS版、EFI版32bit/64bit BIOS常用工具

DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。

Java工具20-Java构建区块链应用:探索Hyperledger Fabric

本文介绍了基于Java开发Hyperledger Fabric区块链应用的完整指南。主要内容包括:区块链技术概述,重点讲解Hyperledger Fabric的模块化架构和联盟链特性;Fabric核心组件解析,涵盖Peer节点、排序服务和智能合约开发;详细的环境搭建步骤,从Docker部署到Java SDK配置;智能合约(Chaincode)开发方法,包括接口实现和生命周期管理;以及Java客户端应用开发实践。文章还提供了供应链溯源系统这一实战项目案例,展示了从架构设计到部署运维的全过程。通过本文,开发者可

千淘万漉虽辛苦,吹尽狂沙始到金 2万+

Hyperledger Fabric fabric-java-sdk 测试环境集成

版权声明:博客中的文章版权归博主所有,未经授权,禁止转载,转载请注明出处 安装环境 安装JDK 下载网址: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html 下载 jdk-8u151-macosx-x64.dmg 安装到电脑 安装 maven 下载网址...

lengxue789的专栏 3001

Hyperledger Fabric v1.0 部署指南

安装 Dockerdocker版本最好是1.13或者更高版本。$ curl -fsSL https://get.docker.com/ | sh安装docker后修改docker配置文件。docerk 1.11或者更高版本,以systemd方式管理docker,默认没有创建配置文件,需要自己创建/etc/systemd/system/docker.service.d/docker.conf$ sud

daqii的博客 1435
上一篇: hyperledger fabric 测试(二)1.12 手动配置fabric网络
下一篇: hyperledger fabric 测试(四)1.14 fabric网络迭代
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值