Fabric 基础
创始人
2024-04-01 14:40:50

Hyperledger Fabric是一个企业级的分布式账本框架,用于开发解决方案和应用程序。它的模块化和多功能设计满足广泛的工业用例。它提供了一种独特的达成共识的方法,可以在保持隐私的同时实现大规模性能。
github
doc

一、安装

Prerequisites

Git client
Go version 1.14.x
Docker version 18.03 or later
(macOS) Xcode Command Line Tools
SoftHSM
jq

1.1 安装 SoftHSMv2

SoftHSMv2

cp /etc/softhsm2.conf $HOME/.config/softhsm2/softhsm2.conf
export SOFTHSM2_CONF=/root/.config/softhsm2/softhsm2.conf

在配置SoftHSM之后,可以使用以下命令初始化单元测试所需的令牌:

softhsm2-util --init-token --slot 0 --label "ForFabric" --so-pin 1234 --pin 98765432
export PKCS11_LIB="/usr/local/Cellar/softhsm/2.6.1/lib/softhsm/libsofthsm2.so"
export PKCS11_PIN=98765432
export PKCS11_LABEL="ForFabric"

1.2 Clone the Hyperledger Fabric source

首先导航到https://github.com/hyperledger/fabric,并使用右上角的fork按钮对fabric存储库进行分叉。在分叉之后,克隆存储库。

mkdir -p github.com/
cd github.com/
git clone https://github.com//fabric# 编译
make gotools# 验证
1、make basic-checks integration-test-prereqs>=== RUN   TestArugments
=== RUN   TestArugments/toofew
=== RUN   TestArugments/twomany
--- PASS: TestArugments (0.90s)--- PASS: TestArugments/toofew (0.01s)--- PASS: TestArugments/twomany (0.01s)
=== RUN   TestGoodPath
--- PASS: TestGoodPath (0.56s)
=== RUN   TestMissingConnection
--- PASS: TestMissingConnection (0.45s)
PASS
ok  	github.com/hyperledger/fabric/ccaas_builder/cmd/release	1.922s2、ginkgo -r ./integration/nwo>Ran 2 of 2 Specs in 120.185 seconds
SUCCESS! -- 2 Passed | 0 Failed | 0 Pending | 0 Skipped
PASSGinkgo ran 1 suite in 2m9.866682768s
Test Suite Passed

1.3 安装Samples, Binaries, and Docker Images

1、手动创建脚本,安装Samples, Docker
https://github.com/hyperledger/fabric/blob/main/scripts/bootstrap.sh文件复制下来修改binaries=false,表示不用此脚本安装binaries

chmod u+x bootstrap.sh
./bootstrap.sh

2、安装Binaries

wget https://github.com/hyperledger/fabric/releases/download/v2.2.9/hyperledger-fabric-linux-amd64-2.2.9.tar.gz
wget https://github.com/hyperledger/fabric-ca/releases/download/v1.5.5/hyperledger-fabric-ca-linux-amd64-1.5.5.tar.gz
tar -xvzf 压缩包名 -C 目的地 #解压到fabric-samples里

检验是否安装成功

cd test-network # 进入fabric-samples/test-network目录
./network.sh up # 检验网络
./network.sh down # 关闭网络
cd ../fabcar
./startFabric.sh

相关内容

热门资讯

经营效益延续增长 浦发银行资产... 来源:环球网 1月13日,浦发银行发布2025年度业绩快报。2025年,浦发银行做深做实金融“五篇大...
拒腐蚀防“围猎” ——评专题片... “要树立正确权力观,一旦理想信念动摇,很可能就会成为被‘围猎’的对象”“通过片中的案例可以看到,防范...
或危及生命!反复胸痛,别大意!... 本文转自【央视财经】;国家卫生健康委1月13日召开2026年首场新闻发布会,介绍时令节气与健康有关内...
广钢气体股价涨5.14%,宝盈... 1月14日,广钢气体涨5.14%,截至发稿,报20.46元/股,成交3.26亿元,换手率2.37%,...
科华数据股价涨5.07%,富国... 1月14日,科华数据涨5.07%,截至发稿,报64.65元/股,成交13.37亿元,换手率4.67%...