FreeChat
Open main menu
ChatGPT知识
搜索
搜索
关闭
Previous
Previous
Next
Next
Fabric 入门部署步骤
sockstack
/
156
/
2023-11-15 00:49:44
<p><span style="color: red; font-size: 18px">ChatGPT 可用网址,仅供交流学习使用,如对您有所帮助,请收藏并推荐给需要的朋友。</span><br><a href="https://ckai.xyz/?sockstack§ion=detail" target="__blank">https://ckai.xyz</a><br><br></p> <article class="_2rhmJa"><h2>准备环境</h2> <ul> <li>安装 docker</li> <li>安装 docker-compose</li> <li>安装 go</li> <li>下载 Hyperledger Fabric 的二进制文件和docker镜像 <code>curl -sSL https://goo.gl/6wtTN5 | bash -s 1.1.0</code> </li> </ul> <h2>创建项目目录</h2> <p>mkdir -p fabric_test/test01</p> <h2>生成认证文件</h2> <p>新建文件 <strong>crypto-config.yaml</strong></p> <div class="_2Uzcx_"> <button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewbox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers language-css"><code class=" language-css"><span class="token property">OrdererOrgs</span><span class="token punctuation">:</span> - <span class="token property">Name</span><span class="token punctuation">:</span> Orderer <span class="token property">Domain</span><span class="token punctuation">:</span> acme.com <span class="token property">Specs</span><span class="token punctuation">:</span> - <span class="token property">Hostname</span><span class="token punctuation">:</span> orderer <span class="token property">PeerOrgs</span><span class="token punctuation">:</span> - <span class="token property">Name</span><span class="token punctuation">:</span> Org1 <span class="token property">Domain</span><span class="token punctuation">:</span> org1.acme.com <span class="token property">Template</span><span class="token punctuation">:</span> <span class="token property">Count</span><span class="token punctuation">:</span> 1 <span class="token property">Users</span><span class="token punctuation">:</span> <span class="token property">Count</span><span class="token punctuation">:</span> 1 - <span class="token property">Name</span><span class="token punctuation">:</span> Org2 <span class="token property">Domain</span><span class="token punctuation">:</span> org2.acme.com <span class="token property">Template</span><span class="token punctuation">:</span> <span class="token property">Count</span><span class="token punctuation">:</span> 1 <span class="token property">Users</span><span class="token punctuation">:</span> <span class="token property">Count</span><span class="token punctuation">:</span> 1 - <span class="token property">Name</span><span class="token punctuation">:</span> Org3 <span class="token property">Domain</span><span class="token punctuation">:</span> org3.acme.com <span class="token property">Template</span><span class="token punctuation">:</span> <span class="token property">Count</span><span class="token punctuation">:</span> 1 <span class="token property">Users</span><span class="token punctuation">:</span> <span class="token property">Count</span><span class="token punctuation">:</span> 1 <span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre> </div> <p>生成认证文件命令</p> <div class="_2Uzcx_"> <button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewbox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers language-undefined"><code class=" language-undefined">cryptogen generate --config=./crypto-config.yaml <span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre> </div> <h2>生成创始块</h2> <p>新建文件 <strong>configtx.yaml</strong></p> <div class="_2Uzcx_"> <button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewbox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers language-undefined"><code class=" language-undefined">--- Profiles: ThreeOrgsOrdererGenesis: Orderer: <<: *OrdererDefaults Organizations: - *OrdererOrg Consortiums: SampleConsortium: Organizations: - *Org1 - *Org2 - *Org3 ThreeOrgsChannel: Consortium: SampleConsortium Application: <<: *ApplicationDefaults Organizations: - *Org1 - *Org2 - *Org3 Organizations: - &OrdererOrg Name: OrdererOrg ID: OrdererMSP MSPDir: crypto-config/ordererOrganizations/acme.com/msp - &Org1 Name: Org1MSP ID: Org1MSP MSPDir: crypto-config/peerOrganizations/org1.acme.com/msp AnchorPeers: - Host: peer0.org1.acme.com Port: 7051 - &Org2 Name: Org2MSP ID: Org2MSP MSPDir: crypto-config/peerOrganizations/org2.acme.com/msp AnchorPeers: - Host: peer0.org2.acme.com Port: 7051 - &Org3 Name: Org3MSP ID: Org3MSP MSPDir: crypto-config/peerOrganizations/org3.acme.com/msp AnchorPeers: - Host: peer0.org3.acme.com Port: 7051 Orderer: &OrdererDefaults OrdererType: solo Addresses: - orderer.acme.com:7050 BatchTimeout: 2s BatchSize: MaxMessageCount: 10 AbsoluteMaxBytes: 99 MB PreferredMaxBytes: 512 KB Kafka: Brokers: - 127.0.0.1:9092 Organizations: Application: &ApplicationDefaults Organizations: <span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre> </div> <p>执行命令</p> <div class="_2Uzcx_"> <button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewbox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers language-bash"><code class=" language-bash">export FABRIC_CFG_PATH=$PWD mkdir channel-artifacts configtxgen -profile ThreeOrgsOrdererGenesis -outputBlock ./channel-artifacts/genesis.block export CHANNEL_NAME=mychannel configtxgen -profile ThreeOrgsChannel -outputCreateChannelTx ./channel-artifacts/channel.tx -channelID $CHANNEL_NAME configtxgen -profile ThreeOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org1MSPanchors.tx -channelID $CHANNEL_NAME -asOrg Org1MSP configtxgen -profile ThreeOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org2MSPanchors.tx -channelID $CHANNEL_NAME -asOrg Org2MSP configtxgen -profile ThreeOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org3MSPanchors.tx -channelID $CHANNEL_NAME -asOrg Org3MSP <span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre> </div> <h2>配置 docker-compose</h2> <p>新建文件 <code>.env</code></p> <div class="_2Uzcx_"> <button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewbox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers language-undefined"><code class=" language-undefined">COMPOSE_PROJECT_NAME=mytest01 <span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre> </div> <p>创建 <strong>base</strong> 目录</p> <div class="_2Uzcx_"> <button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewbox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers language-csharp"><code class=" language-csharp">mkdir <span class="token keyword">base</span> <span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre> </div> <p>base 目录下新建 2 个文件:peer-base.yaml 和 docker-compose-base.yaml</p> <p>peer-base.yaml</p> <div class="_2Uzcx_"> <button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewbox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers language-bash"><code class=" language-bash">version: '2' services: peer-base: image: hyperledger/fabric-peer environment: - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock # the following setting starts chaincode containers on the same # bridge network as the peers # https://docs.docker.com/compose/networking/ # ---CHANGED--- - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_basic #- CORE_LOGGING_LEVEL=ERROR - CORE_LOGGING_LEVEL=DEBUG - CORE_PEER_TLS_ENABLED=true - CORE_PEER_GOSSIP_USELEADERELECTION=true - CORE_PEER_GOSSIP_ORGLEADER=false - CORE_PEER_PROFILE_ENABLED=true - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/server.crt - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer command: peer node start <span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre> </div> <p>docker-compose-base.yaml</p> <div class="_2Uzcx_"> <button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewbox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers language-php"><code class=" language-php">version<span class="token punctuation">:</span> <span class="token single-quoted-string string">'2'</span> services<span class="token punctuation">:</span> <span class="token shell-comment comment"># ---CHANGED--- The orderer name is taken from the name generated by the "cryptogen" certs – it indicates the orderer orgs one and only orderer</span> orderer<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token punctuation">:</span> <span class="token shell-comment comment"># ---CHANGED--- The container name is a copy of the orderer name</span> container_name<span class="token punctuation">:</span> orderer<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com image<span class="token punctuation">:</span> hyperledger<span class="token operator">/</span>fabric<span class="token operator">-</span>orderer environment<span class="token punctuation">:</span> <span class="token operator">-</span> <span class="token constant">ORDERER_GENERAL_LOGLEVEL</span><span class="token operator">=</span>debug <span class="token operator">-</span> <span class="token constant">ORDERER_GENERAL_LISTENADDRESS</span><span class="token operator">=</span><span class="token number">0.0</span><span class="token number">.0</span><span class="token number">.0</span> <span class="token operator">-</span> <span class="token constant">ORDERER_GENERAL_GENESISMETHOD</span><span class="token operator">=</span>file <span class="token operator">-</span> <span class="token constant">ORDERER_GENERAL_GENESISFILE</span><span class="token operator">=</span><span class="token operator">/</span><span class="token keyword">var</span><span class="token operator">/</span>hyperledger<span class="token operator">/</span>orderer<span class="token operator">/</span>orderer<span class="token punctuation">.</span>genesis<span class="token punctuation">.</span>block <span class="token operator">-</span> <span class="token constant">ORDERER_GENERAL_LOCALMSPID</span><span class="token operator">=</span>OrdererMSP <span class="token operator">-</span> <span class="token constant">ORDERER_GENERAL_LOCALMSPDIR</span><span class="token operator">=</span><span class="token operator">/</span><span class="token keyword">var</span><span class="token operator">/</span>hyperledger<span class="token operator">/</span>orderer<span class="token operator">/</span>msp <span class="token shell-comment comment"># enabled TLS</span> <span class="token operator">-</span> <span class="token constant">ORDERER_GENERAL_TLS_ENABLED</span><span class="token operator">=</span><span class="token boolean constant">true</span> <span class="token operator">-</span> <span class="token constant">ORDERER_GENERAL_TLS_PRIVATEKEY</span><span class="token operator">=</span><span class="token operator">/</span><span class="token keyword">var</span><span class="token operator">/</span>hyperledger<span class="token operator">/</span>orderer<span class="token operator">/</span>tls<span class="token operator">/</span>server<span class="token punctuation">.</span>key <span class="token operator">-</span> <span class="token constant">ORDERER_GENERAL_TLS_CERTIFICATE</span><span class="token operator">=</span><span class="token operator">/</span><span class="token keyword">var</span><span class="token operator">/</span>hyperledger<span class="token operator">/</span>orderer<span class="token operator">/</span>tls<span class="token operator">/</span>server<span class="token punctuation">.</span>crt <span class="token operator">-</span> <span class="token constant">ORDERER_GENERAL_TLS_ROOTCAS</span><span class="token operator">=</span><span class="token punctuation">[</span><span class="token operator">/</span><span class="token keyword">var</span><span class="token operator">/</span>hyperledger<span class="token operator">/</span>orderer<span class="token operator">/</span>tls<span class="token operator">/</span>ca<span class="token punctuation">.</span>crt<span class="token punctuation">]</span> working_dir<span class="token punctuation">:</span> <span class="token operator">/</span>opt<span class="token operator">/</span>gopath<span class="token operator">/</span>src<span class="token operator">/</span>github<span class="token punctuation">.</span>com<span class="token operator">/</span>hyperledger<span class="token operator">/</span>fabric command<span class="token punctuation">:</span> orderer volumes<span class="token punctuation">:</span> <span class="token operator">-</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token operator">/</span>channel<span class="token operator">-</span>artifacts<span class="token operator">/</span>genesis<span class="token punctuation">.</span>block<span class="token punctuation">:</span><span class="token operator">/</span><span class="token keyword">var</span><span class="token operator">/</span>hyperledger<span class="token operator">/</span>orderer<span class="token operator">/</span>orderer<span class="token punctuation">.</span>genesis<span class="token punctuation">.</span>block <span class="token shell-comment comment"># ---CHANGED--- the path is different to reflect our company's domain</span> <span class="token operator">-</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token operator">/</span>crypto<span class="token operator">-</span>config<span class="token operator">/</span>ordererOrganizations<span class="token operator">/</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>orderers<span class="token operator">/</span>orderer<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>msp<span class="token punctuation">:</span><span class="token operator">/</span><span class="token keyword">var</span><span class="token operator">/</span>hyperledger<span class="token operator">/</span>orderer<span class="token operator">/</span>msp <span class="token shell-comment comment"># ---CHANGED--- the path is different to reflect our company's domain</span> <span class="token operator">-</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token operator">/</span>crypto<span class="token operator">-</span>config<span class="token operator">/</span>ordererOrganizations<span class="token operator">/</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>orderers<span class="token operator">/</span>orderer<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>tls<span class="token operator">/</span><span class="token punctuation">:</span><span class="token operator">/</span><span class="token keyword">var</span><span class="token operator">/</span>hyperledger<span class="token operator">/</span>orderer<span class="token operator">/</span>tls ports<span class="token punctuation">:</span> <span class="token operator">-</span> <span class="token number">7050</span><span class="token punctuation">:</span><span class="token number">7050</span> <span class="token shell-comment comment"># ---CHANGED--- The peer name is taken from the name generated by the "cryptogen" certs – it indicates the peer org 1 and one peer "peer0"</span> peer0<span class="token punctuation">.</span>org1<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token punctuation">:</span> <span class="token shell-comment comment"># ---CHANGED--- Container name – same as the peer name</span> container_name<span class="token punctuation">:</span> peer0<span class="token punctuation">.</span>org1<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com <span class="token keyword">extends</span><span class="token punctuation">:</span> file<span class="token punctuation">:</span> peer<span class="token operator">-</span>base<span class="token punctuation">.</span>yaml service<span class="token punctuation">:</span> peer<span class="token operator">-</span>base environment<span class="token punctuation">:</span> <span class="token shell-comment comment"># ---CHANGED--- changed to reflect peer name, org name and our company's domain</span> <span class="token operator">-</span> <span class="token constant">CORE_PEER_ID</span><span class="token operator">=</span>peer0<span class="token punctuation">.</span>org1<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com <span class="token shell-comment comment"># ---CHANGED--- changed to reflect peer name, org name and our company's domain</span> <span class="token operator">-</span> <span class="token constant">CORE_PEER_ADDRESS</span><span class="token operator">=</span>peer0<span class="token punctuation">.</span>org1<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token punctuation">:</span><span class="token number">7051</span> <span class="token shell-comment comment"># ---CHANGED--- changed to reflect peer name, org name and our company's domain</span> <span class="token operator">-</span> <span class="token constant">CORE_PEER_GOSSIP_EXTERNALENDPOINT</span><span class="token operator">=</span>peer0<span class="token punctuation">.</span>org1<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token punctuation">:</span><span class="token number">7051</span> <span class="token shell-comment comment"># ---CHANGED--- changed to reflect peer name, org name and our company's domain</span> <span class="token operator">-</span> <span class="token constant">CORE_PEER_GOSSIP_BOOTSTRAP</span><span class="token operator">=</span>peer0<span class="token punctuation">.</span>org1<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token punctuation">:</span><span class="token number">7051</span> <span class="token operator">-</span> <span class="token constant">CORE_PEER_LOCALMSPID</span><span class="token operator">=</span>Org1MSP volumes<span class="token punctuation">:</span> <span class="token operator">-</span> <span class="token operator">/</span><span class="token keyword">var</span><span class="token operator">/</span>run<span class="token operator">/</span><span class="token punctuation">:</span><span class="token operator">/</span>host<span class="token operator">/</span><span class="token keyword">var</span><span class="token operator">/</span>run<span class="token operator">/</span> <span class="token shell-comment comment"># ---CHANGED--- changed to reflect peer name, org name and our company's domain</span> <span class="token operator">-</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token operator">/</span>crypto<span class="token operator">-</span>config<span class="token operator">/</span>peerOrganizations<span class="token operator">/</span>org1<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>peers<span class="token operator">/</span>peer0<span class="token punctuation">.</span>org1<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>msp<span class="token punctuation">:</span><span class="token operator">/</span>etc<span class="token operator">/</span>hyperledger<span class="token operator">/</span>fabric<span class="token operator">/</span>msp <span class="token shell-comment comment"># ---CHANGED--- changed to reflect peer name, org name and our company's domain</span> <span class="token operator">-</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token operator">/</span>crypto<span class="token operator">-</span>config<span class="token operator">/</span>peerOrganizations<span class="token operator">/</span>org1<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>peers<span class="token operator">/</span>peer0<span class="token punctuation">.</span>org1<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>tls<span class="token punctuation">:</span><span class="token operator">/</span>etc<span class="token operator">/</span>hyperledger<span class="token operator">/</span>fabric<span class="token operator">/</span>tls ports<span class="token punctuation">:</span> <span class="token operator">-</span> <span class="token number">7051</span><span class="token punctuation">:</span><span class="token number">7051</span> <span class="token operator">-</span> <span class="token number">7053</span><span class="token punctuation">:</span><span class="token number">7053</span> <span class="token shell-comment comment"># ---CHANGED--- The peer name is taken from the name generated by the "cryptogen" certs – it indicates the peer org 2 and one peer "peer0"</span> peer0<span class="token punctuation">.</span>org2<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token punctuation">:</span> <span class="token shell-comment comment"># ---CHANGED--- Container name – same as the peer name</span> container_name<span class="token punctuation">:</span> peer0<span class="token punctuation">.</span>org2<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com <span class="token keyword">extends</span><span class="token punctuation">:</span> file<span class="token punctuation">:</span> peer<span class="token operator">-</span>base<span class="token punctuation">.</span>yaml service<span class="token punctuation">:</span> peer<span class="token operator">-</span>base environment<span class="token punctuation">:</span> <span class="token shell-comment comment"># ---CHANGED--- changed to reflect peer name, org name and our company's domain</span> <span class="token operator">-</span> <span class="token constant">CORE_PEER_ID</span><span class="token operator">=</span>peer0<span class="token punctuation">.</span>org2<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com <span class="token shell-comment comment"># ---CHANGED--- changed to reflect peer name, org name and our company's domain</span> <span class="token operator">-</span> <span class="token constant">CORE_PEER_ADDRESS</span><span class="token operator">=</span>peer0<span class="token punctuation">.</span>org2<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token punctuation">:</span><span class="token number">7051</span> <span class="token shell-comment comment"># ---CHANGED--- changed to reflect peer name, org name and our company's domain</span> <span class="token operator">-</span> <span class="token constant">CORE_PEER_GOSSIP_EXTERNALENDPOINT</span><span class="token operator">=</span>peer0<span class="token punctuation">.</span>org2<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token punctuation">:</span><span class="token number">7051</span> <span class="token shell-comment comment"># ---CHANGED--- changed to reflect peer name, org name and our company's domain</span> <span class="token operator">-</span> <span class="token constant">CORE_PEER_GOSSIP_BOOTSTRAP</span><span class="token operator">=</span>peer0<span class="token punctuation">.</span>org2<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token punctuation">:</span><span class="token number">7051</span> <span class="token shell-comment comment"># ---CHANGED--- ensure that the MSP ID is correctly set of Org2</span> <span class="token operator">-</span> <span class="token constant">CORE_PEER_LOCALMSPID</span><span class="token operator">=</span>Org2MSP volumes<span class="token punctuation">:</span> <span class="token operator">-</span> <span class="token operator">/</span><span class="token keyword">var</span><span class="token operator">/</span>run<span class="token operator">/</span><span class="token punctuation">:</span><span class="token operator">/</span>host<span class="token operator">/</span><span class="token keyword">var</span><span class="token operator">/</span>run<span class="token operator">/</span> <span class="token shell-comment comment"># ---CHANGED--- changed to reflect peer name, org name and our company's domain</span> <span class="token operator">-</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token operator">/</span>crypto<span class="token operator">-</span>config<span class="token operator">/</span>peerOrganizations<span class="token operator">/</span>org2<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>peers<span class="token operator">/</span>peer0<span class="token punctuation">.</span>org2<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>msp<span class="token punctuation">:</span><span class="token operator">/</span>etc<span class="token operator">/</span>hyperledger<span class="token operator">/</span>fabric<span class="token operator">/</span>msp <span class="token shell-comment comment"># ---CHANGED--- changed to reflect peer name, org name and our company's domain</span> <span class="token operator">-</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token operator">/</span>crypto<span class="token operator">-</span>config<span class="token operator">/</span>peerOrganizations<span class="token operator">/</span>org2<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>peers<span class="token operator">/</span>peer0<span class="token punctuation">.</span>org2<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>tls<span class="token punctuation">:</span><span class="token operator">/</span>etc<span class="token operator">/</span>hyperledger<span class="token operator">/</span>fabric<span class="token operator">/</span>tls ports<span class="token punctuation">:</span> <span class="token operator">-</span> <span class="token number">8051</span><span class="token punctuation">:</span><span class="token number">7051</span> <span class="token operator">-</span> <span class="token number">8053</span><span class="token punctuation">:</span><span class="token number">7053</span> <span class="token shell-comment comment"># ---CHANGED--- The peer name is taken from the name generated by the "cryptogen" certs – it indicates the peer org 3 and one peer "peer0"</span> peer0<span class="token punctuation">.</span>org3<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token punctuation">:</span> <span class="token shell-comment comment"># ---CHANGED--- Container name – same as the peer name</span> container_name<span class="token punctuation">:</span> peer0<span class="token punctuation">.</span>org3<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com <span class="token keyword">extends</span><span class="token punctuation">:</span> file<span class="token punctuation">:</span> peer<span class="token operator">-</span>base<span class="token punctuation">.</span>yaml service<span class="token punctuation">:</span> peer<span class="token operator">-</span>base environment<span class="token punctuation">:</span> <span class="token shell-comment comment"># ---CHANGED--- changed to reflect peer name, org name and our company's domain</span> <span class="token operator">-</span> <span class="token constant">CORE_PEER_ID</span><span class="token operator">=</span>peer0<span class="token punctuation">.</span>org3<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com <span class="token shell-comment comment"># ---CHANGED--- changed to reflect peer name, org name and our company's domain</span> <span class="token operator">-</span> <span class="token constant">CORE_PEER_ADDRESS</span><span class="token operator">=</span>peer0<span class="token punctuation">.</span>org3<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token punctuation">:</span><span class="token number">7051</span> <span class="token shell-comment comment"># ---CHANGED--- changed to reflect peer name, org name and our company's domain</span> <span class="token operator">-</span> <span class="token constant">CORE_PEER_GOSSIP_EXTERNALENDPOINT</span><span class="token operator">=</span>peer0<span class="token punctuation">.</span>org3<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token punctuation">:</span><span class="token number">7051</span> <span class="token shell-comment comment"># ---CHANGED--- changed to reflect peer name, org name and our company's domain</span> <span class="token operator">-</span> <span class="token constant">CORE_PEER_GOSSIP_BOOTSTRAP</span><span class="token operator">=</span>peer0<span class="token punctuation">.</span>org3<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token punctuation">:</span><span class="token number">7051</span> <span class="token shell-comment comment"># ---CHANGED--- ensure that the MSP ID is correctly set of Org3</span> <span class="token operator">-</span> <span class="token constant">CORE_PEER_LOCALMSPID</span><span class="token operator">=</span>Org3MSP volumes<span class="token punctuation">:</span> <span class="token operator">-</span> <span class="token operator">/</span><span class="token keyword">var</span><span class="token operator">/</span>run<span class="token operator">/</span><span class="token punctuation">:</span><span class="token operator">/</span>host<span class="token operator">/</span><span class="token keyword">var</span><span class="token operator">/</span>run<span class="token operator">/</span> <span class="token shell-comment comment"># ---CHANGED--- changed to reflect peer name, org name and our company's domain</span> <span class="token operator">-</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token operator">/</span>crypto<span class="token operator">-</span>config<span class="token operator">/</span>peerOrganizations<span class="token operator">/</span>org3<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>peers<span class="token operator">/</span>peer0<span class="token punctuation">.</span>org3<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>msp<span class="token punctuation">:</span><span class="token operator">/</span>etc<span class="token operator">/</span>hyperledger<span class="token operator">/</span>fabric<span class="token operator">/</span>msp <span class="token shell-comment comment"># ---CHANGED--- changed to reflect peer name, org name and our company's domain</span> <span class="token operator">-</span> <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token operator">/</span>crypto<span class="token operator">-</span>config<span class="token operator">/</span>peerOrganizations<span class="token operator">/</span>org3<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>peers<span class="token operator">/</span>peer0<span class="token punctuation">.</span>org3<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>tls<span class="token punctuation">:</span><span class="token operator">/</span>etc<span class="token operator">/</span>hyperledger<span class="token operator">/</span>fabric<span class="token operator">/</span>tls ports<span class="token punctuation">:</span> <span class="token operator">-</span> <span class="token number">9051</span><span class="token punctuation">:</span><span class="token number">7051</span> <span class="token operator">-</span> <span class="token number">9053</span><span class="token punctuation">:</span><span class="token number">7053</span> <span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre> </div> <p>项目根目录下新建文件 docker-compose-cli.yaml</p> <div class="_2Uzcx_"> <button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewbox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers language-php"><code class=" language-php">version<span class="token punctuation">:</span> <span class="token single-quoted-string string">'2'</span> <span class="token shell-comment comment"># ---CHANGED--- our network is called "basic"</span> networks<span class="token punctuation">:</span> basic<span class="token punctuation">:</span> services<span class="token punctuation">:</span> <span class="token shell-comment comment"># ---CHANGED--- The orderer name is taken from the name generated by the "cryptogen" certs – it indicates the orderer orgs one and only orderer</span> orderer<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token punctuation">:</span> <span class="token keyword">extends</span><span class="token punctuation">:</span> file<span class="token punctuation">:</span> base<span class="token operator">/</span>docker<span class="token operator">-</span>compose<span class="token operator">-</span>base<span class="token punctuation">.</span>yaml <span class="token shell-comment comment"># ---CHANGED--- refers to orderer name</span> service<span class="token punctuation">:</span> orderer<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com <span class="token shell-comment comment"># ---CHANGED--- The container name is a copy of the orderer name</span> container_name<span class="token punctuation">:</span> orderer<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com networks<span class="token punctuation">:</span> <span class="token operator">-</span> basic <span class="token shell-comment comment"># ---CHANGED--- The peer name is taken from the name generated by the "cryptogen" certs – it indicates the peer org 1 and one peer "peer0"</span> peer0<span class="token punctuation">.</span>org1<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token punctuation">:</span> <span class="token shell-comment comment"># ---CHANGED--- Container name – same as the peer name</span> container_name<span class="token punctuation">:</span> peer0<span class="token punctuation">.</span>org1<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com <span class="token keyword">extends</span><span class="token punctuation">:</span> file<span class="token punctuation">:</span> base<span class="token operator">/</span>docker<span class="token operator">-</span>compose<span class="token operator">-</span>base<span class="token punctuation">.</span>yaml <span class="token shell-comment comment"># ---CHANGED--- Refers to peer name</span> service<span class="token punctuation">:</span> peer0<span class="token punctuation">.</span>org1<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com networks<span class="token punctuation">:</span> <span class="token shell-comment comment"># ---CHANGED--- our network is called "basic"</span> <span class="token operator">-</span> basic <span class="token shell-comment comment"># ---CHANGED--- The peer name is taken from the name generated by the "cryptogen" certs – it indicates the peer org 2 and one peer "peer0"</span> peer0<span class="token punctuation">.</span>org2<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token punctuation">:</span> <span class="token shell-comment comment"># ---CHANGED--- Container name – same as the peer name</span> container_name<span class="token punctuation">:</span> peer0<span class="token punctuation">.</span>org2<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com <span class="token keyword">extends</span><span class="token punctuation">:</span> file<span class="token punctuation">:</span> base<span class="token operator">/</span>docker<span class="token operator">-</span>compose<span class="token operator">-</span>base<span class="token punctuation">.</span>yaml <span class="token shell-comment comment"># ---CHANGED--- Refers to peer name</span> service<span class="token punctuation">:</span> peer0<span class="token punctuation">.</span>org2<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com networks<span class="token punctuation">:</span> <span class="token shell-comment comment"># ---CHANGED--- our network is called "basic"</span> <span class="token operator">-</span> basic <span class="token shell-comment comment"># ---CHANGED--- The peer name is taken from the name generated by the "cryptogen" certs – it indicates the peer org 3 and one peer "peer0"</span> peer0<span class="token punctuation">.</span>org3<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token punctuation">:</span> <span class="token shell-comment comment"># ---CHANGED--- Container name – same as the peer name</span> container_name<span class="token punctuation">:</span> peer0<span class="token punctuation">.</span>org3<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com <span class="token keyword">extends</span><span class="token punctuation">:</span> file<span class="token punctuation">:</span> base<span class="token operator">/</span>docker<span class="token operator">-</span>compose<span class="token operator">-</span>base<span class="token punctuation">.</span>yaml <span class="token shell-comment comment"># ---CHANGED--- Refers to peer name</span> service<span class="token punctuation">:</span> peer0<span class="token punctuation">.</span>org3<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com networks<span class="token punctuation">:</span> <span class="token shell-comment comment"># ---CHANGED--- our network is called "basic"</span> <span class="token operator">-</span> basic cli<span class="token punctuation">:</span> container_name<span class="token punctuation">:</span> cli image<span class="token punctuation">:</span> hyperledger<span class="token operator">/</span>fabric<span class="token operator">-</span>tools tty<span class="token punctuation">:</span> <span class="token boolean constant">true</span> environment<span class="token punctuation">:</span> <span class="token operator">-</span> <span class="token constant">GOPATH</span><span class="token operator">=</span><span class="token operator">/</span>opt<span class="token operator">/</span>gopath <span class="token operator">-</span> <span class="token constant">CORE_VM_ENDPOINT</span><span class="token operator">=</span>unix<span class="token punctuation">:</span><span class="token comment">///host/var/run/docker.sock</span> <span class="token operator">-</span> <span class="token constant">CORE_LOGGING_LEVEL</span><span class="token operator">=</span><span class="token constant">DEBUG</span> <span class="token operator">-</span> <span class="token constant">CORE_PEER_ID</span><span class="token operator">=</span>cli <span class="token shell-comment comment"># ---CHANGED--- peer0 from Org1 is the default for this CLI container</span> <span class="token operator">-</span> <span class="token constant">CORE_PEER_ADDRESS</span><span class="token operator">=</span>peer0<span class="token punctuation">.</span>org1<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token punctuation">:</span><span class="token number">7051</span> <span class="token operator">-</span> <span class="token constant">CORE_PEER_LOCALMSPID</span><span class="token operator">=</span>Org1MSP <span class="token operator">-</span> <span class="token constant">CORE_PEER_TLS_ENABLED</span><span class="token operator">=</span><span class="token boolean constant">true</span> <span class="token shell-comment comment"># ---CHANGED--- changed to reflect peer0 name, org1 name and our company's domain</span> <span class="token operator">-</span> <span class="token constant">CORE_PEER_TLS_CERT_FILE</span><span class="token operator">=</span><span class="token operator">/</span>opt<span class="token operator">/</span>gopath<span class="token operator">/</span>src<span class="token operator">/</span>github<span class="token punctuation">.</span>com<span class="token operator">/</span>hyperledger<span class="token operator">/</span>fabric<span class="token operator">/</span>peer<span class="token operator">/</span>crypto<span class="token operator">/</span>peerOrganizations<span class="token operator">/</span>org1<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>peers<span class="token operator">/</span>peer0<span class="token punctuation">.</span>org1<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>tls<span class="token operator">/</span>server<span class="token punctuation">.</span>crt <span class="token shell-comment comment"># ---CHANGED--- changed to reflect peer0 name, org1 name and our company's domain</span> <span class="token operator">-</span> <span class="token constant">CORE_PEER_TLS_KEY_FILE</span><span class="token operator">=</span><span class="token operator">/</span>opt<span class="token operator">/</span>gopath<span class="token operator">/</span>src<span class="token operator">/</span>github<span class="token punctuation">.</span>com<span class="token operator">/</span>hyperledger<span class="token operator">/</span>fabric<span class="token operator">/</span>peer<span class="token operator">/</span>crypto<span class="token operator">/</span>peerOrganizations<span class="token operator">/</span>org1<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>peers<span class="token operator">/</span>peer0<span class="token punctuation">.</span>org1<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>tls<span class="token operator">/</span>server<span class="token punctuation">.</span>key <span class="token shell-comment comment"># ---CHANGED--- changed to reflect peer0 name, org1 name and our company's domain</span> <span class="token operator">-</span> <span class="token constant">CORE_PEER_TLS_ROOTCERT_FILE</span><span class="token operator">=</span><span class="token operator">/</span>opt<span class="token operator">/</span>gopath<span class="token operator">/</span>src<span class="token operator">/</span>github<span class="token punctuation">.</span>com<span class="token operator">/</span>hyperledger<span class="token operator">/</span>fabric<span class="token operator">/</span>peer<span class="token operator">/</span>crypto<span class="token operator">/</span>peerOrganizations<span class="token operator">/</span>org1<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>peers<span class="token operator">/</span>peer0<span class="token punctuation">.</span>org1<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>tls<span class="token operator">/</span>ca<span class="token punctuation">.</span>crt <span class="token shell-comment comment"># ---CHANGED--- changed to reflect peer0 name, org1 name and our company's domain</span> <span class="token operator">-</span> <span class="token constant">CORE_PEER_MSPCONFIGPATH</span><span class="token operator">=</span><span class="token operator">/</span>opt<span class="token operator">/</span>gopath<span class="token operator">/</span>src<span class="token operator">/</span>github<span class="token punctuation">.</span>com<span class="token operator">/</span>hyperledger<span class="token operator">/</span>fabric<span class="token operator">/</span>peer<span class="token operator">/</span>crypto<span class="token operator">/</span>peerOrganizations<span class="token operator">/</span>org1<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>users<span class="token operator">/</span>Admin@org1<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>msp working_dir<span class="token punctuation">:</span> <span class="token operator">/</span>opt<span class="token operator">/</span>gopath<span class="token operator">/</span>src<span class="token operator">/</span>github<span class="token punctuation">.</span>com<span class="token operator">/</span>hyperledger<span class="token operator">/</span>fabric<span class="token operator">/</span>peer <span class="token shell-comment comment"># ---CHANGED--- command needs to be connected out as we will be issuing commands explicitly, not using by any script</span> <span class="token shell-comment comment"># command: /bin/bash -c './scripts/script.sh ${CHANNEL_NAME}; sleep $TIMEOUT'</span> volumes<span class="token punctuation">:</span> <span class="token operator">-</span> <span class="token operator">/</span><span class="token keyword">var</span><span class="token operator">/</span>run<span class="token operator">/</span><span class="token punctuation">:</span><span class="token operator">/</span>host<span class="token operator">/</span><span class="token keyword">var</span><span class="token operator">/</span>run<span class="token operator">/</span> <span class="token shell-comment comment"># ---CHANGED--- chaincode path adjusted</span> <span class="token operator">-</span> <span class="token punctuation">.</span><span class="token operator">/</span>chaincode<span class="token operator">/</span><span class="token punctuation">:</span><span class="token operator">/</span>opt<span class="token operator">/</span>gopath<span class="token operator">/</span>src<span class="token operator">/</span>github<span class="token punctuation">.</span>com<span class="token operator">/</span>chaincode <span class="token operator">-</span> <span class="token punctuation">.</span><span class="token operator">/</span>crypto<span class="token operator">-</span>config<span class="token punctuation">:</span><span class="token operator">/</span>opt<span class="token operator">/</span>gopath<span class="token operator">/</span>src<span class="token operator">/</span>github<span class="token punctuation">.</span>com<span class="token operator">/</span>hyperledger<span class="token operator">/</span>fabric<span class="token operator">/</span>peer<span class="token operator">/</span>crypto<span class="token operator">/</span> <span class="token operator">-</span> <span class="token punctuation">.</span><span class="token operator">/</span>channel<span class="token operator">-</span>artifacts<span class="token punctuation">:</span><span class="token operator">/</span>opt<span class="token operator">/</span>gopath<span class="token operator">/</span>src<span class="token operator">/</span>github<span class="token punctuation">.</span>com<span class="token operator">/</span>hyperledger<span class="token operator">/</span>fabric<span class="token operator">/</span>peer<span class="token operator">/</span>channel<span class="token operator">-</span>artifacts depends_on<span class="token punctuation">:</span> <span class="token shell-comment comment"># ---CHANGED--- reference to our orderer</span> <span class="token operator">-</span> orderer<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com <span class="token shell-comment comment"># ---CHANGED--- reference to peer0 of Org1</span> <span class="token operator">-</span> peer0<span class="token punctuation">.</span>org1<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com <span class="token shell-comment comment"># ---CHANGED--- reference to peer0 of Org2</span> <span class="token operator">-</span> peer0<span class="token punctuation">.</span>org2<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com <span class="token shell-comment comment"># ---CHANGED--- reference to peer0 of Org3</span> <span class="token operator">-</span> peer0<span class="token punctuation">.</span>org3<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com networks<span class="token punctuation">:</span> <span class="token shell-comment comment"># ---CHANGED--- our network is called "basic"</span> <span class="token operator">-</span> basic <span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre> </div> <h2>启动容器</h2> <p>先清理现有容器</p> <div class="_2Uzcx_"> <button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewbox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers language-jsx"><code class=" language-jsx">docker stop <span class="token function">$</span><span class="token punctuation">(</span>docker ps <span class="token operator">-</span>a <span class="token operator">-</span>q<span class="token punctuation">)</span> docker rm <span class="token function">$</span><span class="token punctuation">(</span>docker ps <span class="token operator">-</span>a <span class="token operator">-</span>q<span class="token punctuation">)</span> <span aria-hidden="true" class="line-numbers-rows"><span></span><span></span></span></code></pre> </div> <p>启动命令</p> <div class="_2Uzcx_"> <button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewbox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers language-bash"><code class=" language-bash">CHANNEL_NAME=$CHANNEL_NAME docker-compose -f docker-compose-cli.yaml up -d <span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre> </div> <h2>进入 cli 容器</h2> <div class="_2Uzcx_"> <button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewbox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers language-bash"><code class=" language-bash">docker exec -it cli bash <span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre> </div> <h2>创建 channel</h2> <div class="_2Uzcx_"> <button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewbox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers language-bash"><code class=" language-bash">export CHANNEL_NAME=mychannel peer channel create -o orderer.acme.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/channel.tx --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/acme.com/orderers/orderer.acme.com/msp/tlscacerts/tlsca.acme.com-cert.pem <span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span></span></code></pre> </div> <h2>加入 channel</h2> <p>peer0 org1</p> <div class="_2Uzcx_"> <button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewbox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers language-csharp"><code class=" language-csharp">peer channel <span class="token keyword">join</span> <span class="token operator">-</span>b mychannel<span class="token punctuation">.</span>block <span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre> </div> <p>peer0 org2</p> <div class="_2Uzcx_"> <button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewbox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers language-ruby"><code class=" language-ruby"><span class="token constant">CORE_PEER_MSPCONFIGPATH</span><span class="token operator">=</span><span class="token operator">/</span>opt<span class="token operator">/</span>gopath<span class="token operator">/</span>src<span class="token operator">/</span>github<span class="token punctuation">.</span>com<span class="token operator">/</span>hyperledger<span class="token operator">/</span>fabric<span class="token operator">/</span>peer<span class="token operator">/</span>crypto<span class="token operator">/</span>peerOrganizations<span class="token operator">/</span>org2<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>users<span class="token operator">/</span><span class="token constant">Admin</span><span class="token variable">@org2</span><span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>msp <span class="token constant">CORE_PEER_ADDRESS</span><span class="token operator">=</span>peer0<span class="token punctuation">.</span>org2<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token punctuation">:</span><span class="token number">7051</span> <span class="token constant">CORE_PEER_LOCALMSPID</span><span class="token operator">=</span><span class="token string">"Org2MSP"</span> <span class="token constant">CORE_PEER_TLS_ROOTCERT_FILE</span><span class="token operator">=</span><span class="token operator">/</span>opt<span class="token operator">/</span>gopath<span class="token operator">/</span>src<span class="token operator">/</span>github<span class="token punctuation">.</span>com<span class="token operator">/</span>hyperledger<span class="token operator">/</span>fabric<span class="token operator">/</span>peer<span class="token operator">/</span>crypto<span class="token operator">/</span>peerOrganizations<span class="token operator">/</span>org2<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>peers<span class="token operator">/</span>peer0<span class="token punctuation">.</span>org2<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>tls<span class="token operator">/</span>ca<span class="token punctuation">.</span>crt peer channel join <span class="token operator">-</span>b mychannel<span class="token punctuation">.</span>block <span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre> </div> <p>peer0 org3</p> <div class="_2Uzcx_"> <button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewbox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers language-ruby"><code class=" language-ruby"><span class="token constant">CORE_PEER_MSPCONFIGPATH</span><span class="token operator">=</span><span class="token operator">/</span>opt<span class="token operator">/</span>gopath<span class="token operator">/</span>src<span class="token operator">/</span>github<span class="token punctuation">.</span>com<span class="token operator">/</span>hyperledger<span class="token operator">/</span>fabric<span class="token operator">/</span>peer<span class="token operator">/</span>crypto<span class="token operator">/</span>peerOrganizations<span class="token operator">/</span>org3<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>users<span class="token operator">/</span><span class="token constant">Admin</span><span class="token variable">@org3</span><span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>msp <span class="token constant">CORE_PEER_ADDRESS</span><span class="token operator">=</span>peer0<span class="token punctuation">.</span>org3<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token punctuation">:</span><span class="token number">7051</span> <span class="token constant">CORE_PEER_LOCALMSPID</span><span class="token operator">=</span><span class="token string">"Org3MSP"</span> <span class="token constant">CORE_PEER_TLS_ROOTCERT_FILE</span><span class="token operator">=</span><span class="token operator">/</span>opt<span class="token operator">/</span>gopath<span class="token operator">/</span>src<span class="token operator">/</span>github<span class="token punctuation">.</span>com<span class="token operator">/</span>hyperledger<span class="token operator">/</span>fabric<span class="token operator">/</span>peer<span class="token operator">/</span>crypto<span class="token operator">/</span>peerOrganizations<span class="token operator">/</span>org3<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>peers<span class="token operator">/</span>peer0<span class="token punctuation">.</span>org3<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>tls<span class="token operator">/</span>ca<span class="token punctuation">.</span>crt peer channel join <span class="token operator">-</span>b mychannel<span class="token punctuation">.</span>block <span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre> </div> <h2>更新锚节点</h2> <p>peer0 org1</p> <div class="_2Uzcx_"> <button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewbox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers language-bash"><code class=" language-bash">peer channel update -o orderer.acme.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/Org1MSPanchors.tx --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/acme.com/orderers/orderer.acme.com/msp/tlscacerts/tlsca.acme.com-cert.pem <span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre> </div> <p>peer0 org2</p> <div class="_2Uzcx_"> <button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewbox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers language-ruby"><code class=" language-ruby"><span class="token constant">CORE_PEER_MSPCONFIGPATH</span><span class="token operator">=</span><span class="token operator">/</span>opt<span class="token operator">/</span>gopath<span class="token operator">/</span>src<span class="token operator">/</span>github<span class="token punctuation">.</span>com<span class="token operator">/</span>hyperledger<span class="token operator">/</span>fabric<span class="token operator">/</span>peer<span class="token operator">/</span>crypto<span class="token operator">/</span>peerOrganizations<span class="token operator">/</span>org2<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>users<span class="token operator">/</span><span class="token constant">Admin</span><span class="token variable">@org2</span><span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>msp <span class="token constant">CORE_PEER_ADDRESS</span><span class="token operator">=</span>peer0<span class="token punctuation">.</span>org2<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token punctuation">:</span><span class="token number">7051</span> <span class="token constant">CORE_PEER_LOCALMSPID</span><span class="token operator">=</span><span class="token string">"Org2MSP"</span> <span class="token constant">CORE_PEER_TLS_ROOTCERT_FILE</span><span class="token operator">=</span><span class="token operator">/</span>opt<span class="token operator">/</span>gopath<span class="token operator">/</span>src<span class="token operator">/</span>github<span class="token punctuation">.</span>com<span class="token operator">/</span>hyperledger<span class="token operator">/</span>fabric<span class="token operator">/</span>peer<span class="token operator">/</span>crypto<span class="token operator">/</span>peerOrganizations<span class="token operator">/</span>org2<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>peers<span class="token operator">/</span>peer0<span class="token punctuation">.</span>org2<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>tls<span class="token operator">/</span>ca<span class="token punctuation">.</span>crt peer channel update <span class="token operator">-</span>o orderer<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token punctuation">:</span><span class="token number">7050</span> <span class="token operator">-</span>c <span class="token variable">$CHANNEL_NAME</span> <span class="token operator">-</span>f <span class="token punctuation">.</span><span class="token operator">/</span>channel<span class="token operator">-</span>artifacts<span class="token operator">/</span><span class="token constant">Org2MSPanchors</span><span class="token punctuation">.</span>tx <span class="token operator">--</span>tls <span class="token operator">--</span>cafile <span class="token operator">/</span>opt<span class="token operator">/</span>gopath<span class="token operator">/</span>src<span class="token operator">/</span>github<span class="token punctuation">.</span>com<span class="token operator">/</span>hyperledger<span class="token operator">/</span>fabric<span class="token operator">/</span>peer<span class="token operator">/</span>crypto<span class="token operator">/</span>ordererOrganizations<span class="token operator">/</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>orderers<span class="token operator">/</span>orderer<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>msp<span class="token operator">/</span>tlscacerts<span class="token operator">/</span>tlsca<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">-</span>cert<span class="token punctuation">.</span>pem <span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre> </div> <p>peer0 org3</p> <div class="_2Uzcx_"> <button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewbox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers language-ruby"><code class=" language-ruby"><span class="token constant">CORE_PEER_MSPCONFIGPATH</span><span class="token operator">=</span><span class="token operator">/</span>opt<span class="token operator">/</span>gopath<span class="token operator">/</span>src<span class="token operator">/</span>github<span class="token punctuation">.</span>com<span class="token operator">/</span>hyperledger<span class="token operator">/</span>fabric<span class="token operator">/</span>peer<span class="token operator">/</span>crypto<span class="token operator">/</span>peerOrganizations<span class="token operator">/</span>org3<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>users<span class="token operator">/</span><span class="token constant">Admin</span><span class="token variable">@org3</span><span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>msp <span class="token constant">CORE_PEER_ADDRESS</span><span class="token operator">=</span>peer0<span class="token punctuation">.</span>org3<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token punctuation">:</span><span class="token number">7051</span> <span class="token constant">CORE_PEER_LOCALMSPID</span><span class="token operator">=</span><span class="token string">"Org3MSP"</span> <span class="token constant">CORE_PEER_TLS_ROOTCERT_FILE</span><span class="token operator">=</span><span class="token operator">/</span>opt<span class="token operator">/</span>gopath<span class="token operator">/</span>src<span class="token operator">/</span>github<span class="token punctuation">.</span>com<span class="token operator">/</span>hyperledger<span class="token operator">/</span>fabric<span class="token operator">/</span>peer<span class="token operator">/</span>crypto<span class="token operator">/</span>peerOrganizations<span class="token operator">/</span>org3<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>peers<span class="token operator">/</span>peer0<span class="token punctuation">.</span>org3<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>tls<span class="token operator">/</span>ca<span class="token punctuation">.</span>crt peer channel update <span class="token operator">-</span>o orderer<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token punctuation">:</span><span class="token number">7050</span> <span class="token operator">-</span>c <span class="token variable">$CHANNEL_NAME</span> <span class="token operator">-</span>f <span class="token punctuation">.</span><span class="token operator">/</span>channel<span class="token operator">-</span>artifacts<span class="token operator">/</span><span class="token constant">Org3MSPanchors</span><span class="token punctuation">.</span>tx <span class="token operator">--</span>tls <span class="token operator">--</span>cafile <span class="token operator">/</span>opt<span class="token operator">/</span>gopath<span class="token operator">/</span>src<span class="token operator">/</span>github<span class="token punctuation">.</span>com<span class="token operator">/</span>hyperledger<span class="token operator">/</span>fabric<span class="token operator">/</span>peer<span class="token operator">/</span>crypto<span class="token operator">/</span>ordererOrganizations<span class="token operator">/</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>orderers<span class="token operator">/</span>orderer<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>msp<span class="token operator">/</span>tlscacerts<span class="token operator">/</span>tlsca<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">-</span>cert<span class="token punctuation">.</span>pem <span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre> </div> <h2>安装 chaincode</h2> <div class="_2Uzcx_"> <button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewbox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers language-ruby"><code class=" language-ruby">peer chaincode install <span class="token operator">-</span>n mycc <span class="token operator">-</span>v <span class="token number">1.0</span> <span class="token operator">-</span>p github<span class="token punctuation">.</span>com<span class="token operator">/</span>chaincode<span class="token operator">/</span>chaincode_example02<span class="token regex">/go/</span> <span class="token constant">CORE_PEER_MSPCONFIGPATH</span><span class="token operator">=</span><span class="token operator">/</span>opt<span class="token operator">/</span>gopath<span class="token operator">/</span>src<span class="token operator">/</span>github<span class="token punctuation">.</span>com<span class="token operator">/</span>hyperledger<span class="token operator">/</span>fabric<span class="token operator">/</span>peer<span class="token operator">/</span>crypto<span class="token operator">/</span>peerOrganizations<span class="token operator">/</span>org2<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>users<span class="token operator">/</span><span class="token constant">Admin</span><span class="token variable">@org2</span><span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>msp <span class="token constant">CORE_PEER_ADDRESS</span><span class="token operator">=</span>peer0<span class="token punctuation">.</span>org2<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token punctuation">:</span><span class="token number">7051</span> <span class="token constant">CORE_PEER_LOCALMSPID</span><span class="token operator">=</span><span class="token string">"Org2MSP"</span> <span class="token constant">CORE_PEER_TLS_ROOTCERT_FILE</span><span class="token operator">=</span><span class="token operator">/</span>opt<span class="token operator">/</span>gopath<span class="token operator">/</span>src<span class="token operator">/</span>github<span class="token punctuation">.</span>com<span class="token operator">/</span>hyperledger<span class="token operator">/</span>fabric<span class="token operator">/</span>peer<span class="token operator">/</span>crypto<span class="token operator">/</span>peerOrganizations<span class="token operator">/</span>org2<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>peers<span class="token operator">/</span>peer0<span class="token punctuation">.</span>org2<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>tls<span class="token operator">/</span>ca<span class="token punctuation">.</span>crt peer chaincode install <span class="token operator">-</span>n mycc <span class="token operator">-</span>v <span class="token number">1.0</span> <span class="token operator">-</span>p github<span class="token punctuation">.</span>com<span class="token operator">/</span>chaincode<span class="token operator">/</span>chaincode_example02<span class="token regex">/go/</span> <span class="token constant">CORE_PEER_MSPCONFIGPATH</span><span class="token operator">=</span><span class="token operator">/</span>opt<span class="token operator">/</span>gopath<span class="token operator">/</span>src<span class="token operator">/</span>github<span class="token punctuation">.</span>com<span class="token operator">/</span>hyperledger<span class="token operator">/</span>fabric<span class="token operator">/</span>peer<span class="token operator">/</span>crypto<span class="token operator">/</span>peerOrganizations<span class="token operator">/</span>org3<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>users<span class="token operator">/</span><span class="token constant">Admin</span><span class="token variable">@org3</span><span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>msp <span class="token constant">CORE_PEER_ADDRESS</span><span class="token operator">=</span>peer0<span class="token punctuation">.</span>org3<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token punctuation">:</span><span class="token number">7051</span> <span class="token constant">CORE_PEER_LOCALMSPID</span><span class="token operator">=</span><span class="token string">"Org3MSP"</span> <span class="token constant">CORE_PEER_TLS_ROOTCERT_FILE</span><span class="token operator">=</span><span class="token operator">/</span>opt<span class="token operator">/</span>gopath<span class="token operator">/</span>src<span class="token operator">/</span>github<span class="token punctuation">.</span>com<span class="token operator">/</span>hyperledger<span class="token operator">/</span>fabric<span class="token operator">/</span>peer<span class="token operator">/</span>crypto<span class="token operator">/</span>peerOrganizations<span class="token operator">/</span>org3<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>peers<span class="token operator">/</span>peer0<span class="token punctuation">.</span>org3<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>tls<span class="token operator">/</span>ca<span class="token punctuation">.</span>crt peer chaincode install <span class="token operator">-</span>n mycc <span class="token operator">-</span>v <span class="token number">1.0</span> <span class="token operator">-</span>p github<span class="token punctuation">.</span>com<span class="token operator">/</span>chaincode<span class="token operator">/</span>chaincode_example02<span class="token regex">/go/</span> <span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span></span></code></pre> </div> <h2>实例化 chaincode</h2> <div class="_2Uzcx_"> <button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewbox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers language-swift"><code class=" language-swift">peer chaincode instantiate <span class="token operator">-</span>o orderer<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token punctuation">:</span><span class="token number">7050</span> <span class="token operator">--</span>tls <span class="token operator">--</span>cafile <span class="token operator">/</span>opt<span class="token operator">/</span>gopath<span class="token operator">/</span>src<span class="token operator">/</span>github<span class="token punctuation">.</span>com<span class="token operator">/</span>hyperledger<span class="token operator">/</span>fabric<span class="token operator">/</span>peer<span class="token operator">/</span>crypto<span class="token operator">/</span>ordererOrganizations<span class="token operator">/</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>orderers<span class="token operator">/</span>orderer<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>msp<span class="token operator">/</span>tlscacerts<span class="token operator">/</span>tlsca<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">-</span>cert<span class="token punctuation">.</span>pem <span class="token operator">-</span>C $<span class="token constant">CHANNEL_NAME</span> <span class="token operator">-</span>n mycc <span class="token operator">-</span>v <span class="token number">1.0</span> <span class="token operator">-</span>c <span class="token string">'{"Args":["init","a", "100", "b","200"]}'</span> <span class="token operator">-</span>P <span class="token string">"OR ('Org1MSP.member','Org2MSP.member','Org3MSP.member')"</span> <span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre> </div> <h2>调用 chaincode</h2> <div class="_2Uzcx_"> <button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewbox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers language-swift"><code class=" language-swift">peer chaincode invoke <span class="token operator">-</span>o orderer<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token punctuation">:</span><span class="token number">7050</span> <span class="token operator">--</span>tls <span class="token operator">--</span>cafile <span class="token operator">/</span>opt<span class="token operator">/</span>gopath<span class="token operator">/</span>src<span class="token operator">/</span>github<span class="token punctuation">.</span>com<span class="token operator">/</span>hyperledger<span class="token operator">/</span>fabric<span class="token operator">/</span>peer<span class="token operator">/</span>crypto<span class="token operator">/</span>ordererOrganizations<span class="token operator">/</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>orderers<span class="token operator">/</span>orderer<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>msp<span class="token operator">/</span>tlscacerts<span class="token operator">/</span>tlsca<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">-</span>cert<span class="token punctuation">.</span>pem <span class="token operator">-</span>C $<span class="token constant">CHANNEL_NAME</span> <span class="token operator">-</span>n mycc <span class="token operator">-</span>c <span class="token string">'{"Args":["invoke","a","b","10"]}'</span> <span class="token constant">CORE_PEER_MSPCONFIGPATH</span><span class="token operator">=</span><span class="token operator">/</span>opt<span class="token operator">/</span>gopath<span class="token operator">/</span>src<span class="token operator">/</span>github<span class="token punctuation">.</span>com<span class="token operator">/</span>hyperledger<span class="token operator">/</span>fabric<span class="token operator">/</span>peer<span class="token operator">/</span>crypto<span class="token operator">/</span>peerOrganizations<span class="token operator">/</span>org2<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>users<span class="token operator">/</span><span class="token builtin">Admin@org2</span><span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>msp <span class="token constant">CORE_PEER_ADDRESS</span><span class="token operator">=</span>peer0<span class="token punctuation">.</span>org2<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token punctuation">:</span><span class="token number">7051</span> <span class="token constant">CORE_PEER_LOCALMSPID</span><span class="token operator">=</span><span class="token string">"Org2MSP"</span> <span class="token constant">CORE_PEER_TLS_ROOTCERT_FILE</span><span class="token operator">=</span><span class="token operator">/</span>opt<span class="token operator">/</span>gopath<span class="token operator">/</span>src<span class="token operator">/</span>github<span class="token punctuation">.</span>com<span class="token operator">/</span>hyperledger<span class="token operator">/</span>fabric<span class="token operator">/</span>peer<span class="token operator">/</span>crypto<span class="token operator">/</span>peerOrganizations<span class="token operator">/</span>org2<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>peers<span class="token operator">/</span>peer0<span class="token punctuation">.</span>org2<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>tls<span class="token operator">/</span>ca<span class="token punctuation">.</span>crt peer chaincode invoke <span class="token operator">-</span>o orderer<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token punctuation">:</span><span class="token number">7050</span> <span class="token operator">--</span>tls <span class="token operator">--</span>cafile <span class="token operator">/</span>opt<span class="token operator">/</span>gopath<span class="token operator">/</span>src<span class="token operator">/</span>github<span class="token punctuation">.</span>com<span class="token operator">/</span>hyperledger<span class="token operator">/</span>fabric<span class="token operator">/</span>peer<span class="token operator">/</span>crypto<span class="token operator">/</span>ordererOrganizations<span class="token operator">/</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>orderers<span class="token operator">/</span>orderer<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>msp<span class="token operator">/</span>tlscacerts<span class="token operator">/</span>tlsca<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">-</span>cert<span class="token punctuation">.</span>pem <span class="token operator">-</span>C $<span class="token constant">CHANNEL_NAME</span> <span class="token operator">-</span>n mycc <span class="token operator">-</span>c <span class="token string">'{"Args":["invoke","a","b","10"]}'</span> <span class="token constant">CORE_PEER_MSPCONFIGPATH</span><span class="token operator">=</span><span class="token operator">/</span>opt<span class="token operator">/</span>gopath<span class="token operator">/</span>src<span class="token operator">/</span>github<span class="token punctuation">.</span>com<span class="token operator">/</span>hyperledger<span class="token operator">/</span>fabric<span class="token operator">/</span>peer<span class="token operator">/</span>crypto<span class="token operator">/</span>peerOrganizations<span class="token operator">/</span>org3<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>users<span class="token operator">/</span><span class="token builtin">Admin@org3</span><span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>msp <span class="token constant">CORE_PEER_ADDRESS</span><span class="token operator">=</span>peer0<span class="token punctuation">.</span>org3<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token punctuation">:</span><span class="token number">7051</span> <span class="token constant">CORE_PEER_LOCALMSPID</span><span class="token operator">=</span><span class="token string">"Org3MSP"</span> <span class="token constant">CORE_PEER_TLS_ROOTCERT_FILE</span><span class="token operator">=</span><span class="token operator">/</span>opt<span class="token operator">/</span>gopath<span class="token operator">/</span>src<span class="token operator">/</span>github<span class="token punctuation">.</span>com<span class="token operator">/</span>hyperledger<span class="token operator">/</span>fabric<span class="token operator">/</span>peer<span class="token operator">/</span>crypto<span class="token operator">/</span>peerOrganizations<span class="token operator">/</span>org3<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>peers<span class="token operator">/</span>peer0<span class="token punctuation">.</span>org3<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>tls<span class="token operator">/</span>ca<span class="token punctuation">.</span>crt peer chaincode invoke <span class="token operator">-</span>o orderer<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token punctuation">:</span><span class="token number">7050</span> <span class="token operator">--</span>tls <span class="token operator">--</span>cafile <span class="token operator">/</span>opt<span class="token operator">/</span>gopath<span class="token operator">/</span>src<span class="token operator">/</span>github<span class="token punctuation">.</span>com<span class="token operator">/</span>hyperledger<span class="token operator">/</span>fabric<span class="token operator">/</span>peer<span class="token operator">/</span>crypto<span class="token operator">/</span>ordererOrganizations<span class="token operator">/</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>orderers<span class="token operator">/</span>orderer<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">/</span>msp<span class="token operator">/</span>tlscacerts<span class="token operator">/</span>tlsca<span class="token punctuation">.</span>acme<span class="token punctuation">.</span>com<span class="token operator">-</span>cert<span class="token punctuation">.</span>pem <span class="token operator">-</span>C $<span class="token constant">CHANNEL_NAME</span> <span class="token operator">-</span>n mycc <span class="token operator">-</span>c <span class="token string">'{"Args":["invoke","a","b","10"]}'</span> <span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span></span></code></pre> </div> <h2>查询结果</h2> <p>查询 a:</p> <div class="_2Uzcx_"> <button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewbox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers language-swift"><code class=" language-swift">peer chaincode query <span class="token operator">-</span>C $<span class="token constant">CHANNEL_NAME</span> <span class="token operator">-</span>n mycc <span class="token operator">-</span>c <span class="token string">'{"Args":["query","a"]}'</span> <span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre> </div> <p>查询 b:</p> <div class="_2Uzcx_"> <button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewbox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers language-swift"><code class=" language-swift">peer chaincode query <span class="token operator">-</span>C $<span class="token constant">CHANNEL_NAME</span> <span class="token operator">-</span>n mycc <span class="token operator">-</span>c <span class="token string">'{"Args":["query","b"]}'</span> <span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre> </div> </article>
Fabric 入门部署步骤
作者
sockstack
许可协议
CC BY 4.0
发布于
2023-11-15
修改于
2024-11-08
上一篇:软件:常用 Linux 软件汇总,值得收藏
下一篇:今年很火的AI绘画怎么玩