国产亚洲精品福利在线无卡一,国产精久久一区二区三区,亚洲精品无码国模,精品久久久久久无码专区不卡

當前位置: 首頁 > news >正文

如何制作一個優(yōu)秀網(wǎng)站建設如何進行網(wǎng)絡推廣和宣傳

如何制作一個優(yōu)秀網(wǎng)站建設,如何進行網(wǎng)絡推廣和宣傳,不得建設基層政府網(wǎng)站,申報教學成果獎網(wǎng)站建設解決了官方示例指令需要科學上網(wǎng)才能運行的問題(通過手動下載二進制文件和拉取官方fabric-samples)。具體的將bootstrap.sh腳本解讀了一遍 具體可以參照我的博客 fabric中bootstrap.sh到底幫助我們干了什么?(curl -sSL https://bi…

解決了官方示例指令需要科學上網(wǎng)才能運行的問題(通過手動下載二進制文件和拉取官方fabric-samples)。具體的將bootstrap.sh腳本解讀了一遍 具體可以參照我的博客 fabric中bootstrap.sh到底幫助我們干了什么?(curl -sSL https://bit.ly/2ysbOFE | bash -s執(zhí)行不成功,如何手動執(zhí)行相相關(guān)操作?)_sh bootstrap.sh_小小小小關(guān)同學的博客-CSDN博客

前期的準備工作不再記錄 也就是安裝go docker docker-compose等操作

鏈碼部署與調(diào)用等操作基于完成克隆fabric-samples倉庫、拉取二進制文件、下載需要的鏡像這些操作之后

這個腳本可以快速幫助我們搭建起自己的fabric網(wǎng)絡 是一個單機多節(jié)點的示例。對于腳本的具體實現(xiàn)在搭建完多級部署后再看會有不一樣的體會,將一些指令通過腳本的方式封裝執(zhí)行節(jié)省了使用者的操作,類似于一個fabric嘗鮮。筆記中還有對basic鏈碼的標注,看懂鏈碼學會調(diào)用!


1.查看test-network腳本的使用說明

./network.sh -h  

可以看出我們可以通過他給出的這些指令來完成對應的功能,也可以用過一些參數(shù)也自定義通道名稱。

2.啟動測試網(wǎng)絡

./network.sh up

啟動后創(chuàng)建了四個結(jié)點: cli ;兩個peer結(jié)點 一個排序結(jié)點。

3.創(chuàng)建通道

?

./network.sh createChannel  (可以帶上 -c 通道名稱  來指定)我使用的是默認名稱mychannel

?執(zhí)行成功后

4.在通道上安裝一個鏈碼

?在我們安裝鏈碼之前最好去鏈碼所在的目錄去查看一下鏈碼所需要的依賴包是否成功導入:

可以先進入到鏈碼所在的目錄看一看:../asset-transfer-basic/chaincode-go 就是這個目錄下。

?cd ../asset-transfer-basic/chaincode-go

這里已經(jīng)有了vendor 之前遇見過沒有的情況 也就是要自己手動拉取一下(go mod vendor)

然后回到test-network執(zhí)行部署鏈碼命令

./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-go -ccl go

成功后:

?注意:

如果沒有vendor的話可與參考下面的方法,有的話直接跳過就可以(有的時候沒有的話也先執(zhí)行一些啟動連鏈碼的那條指令 可能會幫助拉取vendor)

執(zhí)行前注意使用 go env 查看go環(huán)境 確認配置好了gomoudle ,然后在chaincode-go目錄下輸入

go mod vendor 即可 然后再次查看就能看到vendor

回到測試網(wǎng)絡.sh文件所在的目錄下 重新啟動鏈碼即可

?

5 與網(wǎng)絡交互

到現(xiàn)在我們的basic鏈碼已經(jīng)成功安裝了,現(xiàn)在我們可以對basic鏈碼的功能來一個測試了:

  • 使用以下命令將這些二進制文件添加到您的CLI路徑:
export PATH=${PWD}/../bin:$PATH
  • 您還需要將fabric-samples代碼庫中的FABRIC_CFG_PATH設置為指向其中的core.yaml文件:
export FABRIC_CFG_PATH=$PWD/../config/
  • 現(xiàn)在,您可以設置環(huán)境變量,以允許您作為Org1操作peer CLI:
export CORE_PEER_TLS_ENABLED=true export CORE_PEER_LOCALMSPID="Org1MSP" export CORE_PEER_TLS_ROOTCERT_FILE=${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt export CORE_PEER_MSPCONFIGPATH=${PWD}/organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp export CORE_PEER_ADDRESS=localhost:7051
  • 運行以下命令用一些資產(chǎn)來初始化賬本:
peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile ${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C mychannel -n basic --peerAddresses localhost:7051 --tlsRootCertFiles ${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt --peerAddresses localhost:9051 --tlsRootCertFiles ${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt -c '{"function":"InitLedger","Args":[]}'

這是初始化賬本的源碼實現(xiàn),就是講結(jié)構(gòu)變量通過json.Marshal轉(zhuǎn)換成json 再通過PutState講資產(chǎn)存入世界狀態(tài)。

  • 現(xiàn)在你可以用你的 CLI 工具來查詢賬本。運行以下指令來獲取添加到通道賬本的資產(chǎn)列表(在運行指令之前可以先看看鏈碼中對于這個函數(shù)的實現(xiàn)到底是怎樣的):

可以看到這個想要調(diào)用這這個函數(shù) 只需要一個傳入一個交易上下文接口就可以了,但是在使用中這個應該是fabric內(nèi)部自己傳入的并不需要我們來傳入,所以對于這個函數(shù)我們并不需要傳入任何參數(shù),直接給出函數(shù)名即可。

peer chaincode query -C gdwchannel -n basic -c '{"Args":["GetAllAssets"]}'

  • basic中還給出了一些其他函數(shù),我們可以看看具體怎么實現(xiàn)的 然后來調(diào)用它
  • 添加資產(chǎn)

命令:(下面命令一次性輸入)

peer chaincode invoke -o localhost:7050 \--ordererTLSHostnameOverride orderer.example.com \--tls --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem" \-C mychannel \-n basic \--peerAddresses localhost:7051 \--tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" \--peerAddresses localhost:9051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt" \-c '{"function":"CreateAsset","Args":["asset7","pink","20","HEUN","888"]}'

  • 刪除資產(chǎn)

peer chaincode invoke -o localhost:7050 \--ordererTLSHostnameOverride orderer.example.com \--tls --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem" \-C mychannel \-n basic \--peerAddresses localhost:7051 \--tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" \--peerAddresses localhost:9051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt" \-c '{"function":"DeleteAsset","Args":["asset1"]}'

  • 更新資產(chǎn)(修改資產(chǎn))

peer chaincode invoke -o localhost:7050 \--ordererTLSHostnameOverride orderer.example.com \--tls --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem" \-C mychannel \-n basic \--peerAddresses localhost:7051 \--tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" \--peerAddresses localhost:9051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt" \-c '{"function":"UpdateAsset","Args":["asset7","RED","20","gdw","888"]}'

  • 轉(zhuǎn)移資產(chǎn)

peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile ${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C mychannel -n basic --peerAddresses localhost:7051 --tlsRootCertFiles ${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt --peerAddresses localhost:9051 --tlsRootCertFiles ${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt -c '{"function":"TransferAsset","Args":["asset6","Christopher"]}'

  • 切換身份

之前都是使用組織1來驗證代碼的增刪改查操作,現(xiàn)在我們可以再開一個終端,用組織2來驗證功能,只需要變更環(huán)境變量即可!

export CORE_PEER_TLS_ENABLED=true export CORE_PEER_LOCALMSPID="Org2MSP" export CORE_PEER_TLS_ROOTCERT_FILE=${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt export CORE_PEER_MSPCONFIGPATH=${PWD}/organizations/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp export CORE_PEER_ADDRESS=localhost:9051

然后就可以在 peer0.org2.example.com上來調(diào)用一些智能合約,比如來查詢我們自定義的資產(chǎn)7看看是否能在組織二上查詢到

peer chaincode query -C mychannel -n basic -c '{"Args":["ReadAsset","asset7"]}'

完成后想要關(guān)閉測試網(wǎng)絡的話可以執(zhí)行:

./network.sh down

http://aloenet.com.cn/news/28370.html

相關(guān)文章:

  • 有一個專門做lol同人的網(wǎng)站百度客戶端手機版
  • 有沒有做家具特賣的網(wǎng)站疫情最新動態(tài)
  • 貴陽哪里做網(wǎng)站營銷企業(yè)
  • 加工平臺快抖霸屏樂云seo
  • 難道做網(wǎng)站的工資都不高嗎百度銷售推廣
  • 南寧網(wǎng)站建設代理婚戀網(wǎng)站排名前十名
  • 東坑鎮(zhèn)仿做網(wǎng)站baidu百度
  • 網(wǎng)站做404好處直播:英格蘭vs法國
  • 商丘市網(wǎng)站建設公司合肥網(wǎng)站優(yōu)化軟件
  • 求職簡歷模板電子版免費seo怎么做優(yōu)化計劃
  • 黃埔區(qū)做網(wǎng)站英文外鏈seo兼職
  • 中學生制作網(wǎng)站怎么做百度廣告買下的訂單在哪里找
  • 中國十大建筑設計事務所北京自動seo
  • 做公眾號關(guān)注網(wǎng)站整站關(guān)鍵詞快速排名
  • 畢業(yè)設計做網(wǎng)站怎么答辯千牛怎么做免費推廣引流
  • 發(fā)布網(wǎng)站建設信息百度網(wǎng)站推廣價格
  • 項目營銷策劃方案360優(yōu)化大師官方下載
  • dede可以做視頻網(wǎng)站百度關(guān)鍵詞指數(shù)排行
  • 羅源網(wǎng)站建設seo搜索引擎優(yōu)化技術(shù)教程
  • iis7 無法添加網(wǎng)站網(wǎng)站優(yōu)化聯(lián)系
  • 云南城市建設職業(yè)學院網(wǎng)站軟文推廣渠道
  • 移動端的網(wǎng)站怎么做今日全國最新疫情通報
  • 幾分鐘弄清楚php做網(wǎng)站手機系統(tǒng)優(yōu)化
  • 昆明網(wǎng)絡營銷網(wǎng)站怎么提高seo關(guān)鍵詞排名
  • 寶豐網(wǎng)站建設長春網(wǎng)站建設
  • 淘寶客網(wǎng)站虛擬主機盤多多百度網(wǎng)盤搜索引擎
  • 如何管理好一個網(wǎng)站怎樣才能注冊自己的網(wǎng)站
  • web網(wǎng)站雙語切換怎么做在線seo短視頻
  • 有關(guān)網(wǎng)站建設的公眾號2022最好的百度seo
  • 怎么做網(wǎng)站的步驟網(wǎng)站制作的要點和步驟詳解