107-全過程部署fabc
晚上20點13分開始的
我真的快要崩潰了
apt update
安裝git
apt install git
安裝docker
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
建立個資料夾吧
mkdir howger
安裝fabric映象
touch bootstrap.sh
vi bootstrap.sh
https://github.com/hyperledger/fabric/blob/master/scripts/bootstrap.sh
chmod 777 bootstrap.sh
./bootstrap
安裝docker-compose
curl -L https://github.com/docker/compose/releases/download/1.27.4/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
回滾版本到1.4
git checkout bc72f3e3a681eeca12dc4858d07e938244da825f
建立配置
../bin/cryptogen generate --config=./crypto-config.yaml
建立創世區塊
export FABRIC_CFG_PATH=$PWD
../bin/configtxgen -profile TwoOrgsOrdererGenesis -channelID byfn-sys-channel -outputBlock ./channel-artifacts/genesis.block
建立channel配置
export CHANNEL_NAME=mychannel && ../bin/configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./channel-artifacts/channel.tx -channelID $CHANNEL_NAME
設定錨節點
../bin/configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org1MSPanchors.tx -channelID $CHANNEL_NAME -asOrg Org1MSP
../bin/configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org2MSPanchors.tx -channelID $CHANNEL_NAME -asOrg Org2MSP
啟動網路
docker-compose -f docker-compose-cli.yaml up -d
進入cli容器
docker exec -it cli bash
切換到Org1
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
CORE_PEER_LOCALMSPID="Org1MSP"
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
設定channel名字
export CHANNEL_NAME=mychannel
建立channel
peer channel create -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/channel.tx --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
加入channel
peer channel join -b mychannel.block
Org2 加入channel
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp CORE_PEER_ADDRESS=peer0.org2.example.com:9051 CORE_PEER_LOCALMSPID="Org2MSP" 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 peer channel join -b mychannel.block
更新錨節點
peer channel update -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/Org1MSPanchors.tx --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp CORE_PEER_ADDRESS=peer0.org2.example.com:9051 CORE_PEER_LOCALMSPID="Org2MSP" 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 peer channel update -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/Org2MSPanchors.tx --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
安裝鏈碼
安裝fabcar鏈碼
peer chaincode install -n mycc -v 1.0 -l node -p /opt/gopath/src/github.com/chaincode/fabcar/javascript
切換Org2
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp
CORE_PEER_ADDRESS=peer0.org2.example.com:9051
CORE_PEER_LOCALMSPID="Org2MSP"
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
Org2安裝鏈碼
peer chaincode install -n mycc -v 1.0 -l node -p /opt/gopath/src/github.com/chaincode/fabcar/javascript
例項化鏈碼
這個要好久好久,我差不多等了5分鐘
peer chaincode instantiate -o orderer.example.com:7050 --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C $CHANNEL_NAME -n mycc -l node -v 1.0 -c '{"Args":["initLedger"]}' -P "AND ('Org1MSP.peer','Org2MSP.peer')"
查詢一下
peer chaincode query -C $CHANNEL_NAME -n mycc -c '{"Args":["queryAllCars"]}'
相關文章
- gigapath部署以及微調全過程
- LLM本地部署全過程記錄
- 在青雲上部署oracle rac全過程Oracle
- 阿里雲伺服器部署web專案全過程阿里伺服器Web
- Hydro OJ搭建全過程
- zabbix server & proxy部署操作過程Server
- MapReduce 執行全過程解析
- 頁面載入全過程
- 記錄一次Django部署到寶塔Linux皮膚的全過程DjangoLinux
- Tars | Win10下Docker部署TarsJava(SpringBoot)全過程及踩坑記錄Win10DockerJavaSpring Boot
- 記憶體訪問全過程記憶體
- 伺服器部署過程(node相關)伺服器
- Ubuntu 16.04 安裝 MySQL 8.0 全過程UbuntuMySql
- Linux TCP/IP協議棧全過程LinuxTCP協議
- 【Elasticsearch學習】文件搜尋全過程Elasticsearch
- redhat 5.4下安裝MYSQL全過程RedhatMySql
- 理解 Android 程式啟動之全過程Android
- innobackupex命令備份全過程圖解圖解
- VS2010自定義模版全過程
- 記錄NLTK安裝使用全過程--pythonPython
- zabbix5.0監控安全配置全過程
- Linux 核心處理中斷全過程解析Linux
- vue-cli 3.0 使用全過程講解Vue
- vue-cli3.0使用全過程講解Vue
- 前端自動化部署伺服器, 告別繁瑣部署過程前端伺服器
- Windows平臺Nginx部署https網站的過程WindowsNginxHTTP網站
- Ubuntu_amd64容器化部署chromedriver的過程UbuntuChrome
- unsloth微調llama3實戰全過程
- 一張圖看懂Dubbo服務引用全過程
- Python Matplotlib繪製條形圖的全過程Python
- 功能較全的oracle傳送郵件過程Oracle
- 從寫博到出書:過程全記錄
- 安卓平臺Flutter啟動過程全解析安卓Flutter
- 記一次前端面試的全過程前端面試
- QWen2-72B-Instruct模型安裝部署過程Struct模型
- Linux部署Django (Nginx + uwsgi + Python3 + Django)的過程LinuxDjangoNginxPython
- 理論+實驗 詳解Oracle安裝部署過程Oracle
- 一套基礎自動化部署搭建過程