zoukankan      html  css  js  c++  java
  • 超级账本环境搭建fabric

    :go
    tar -C /usr/local -xzf go1.9.2.linux-amd64.tar.gz

    vi ~/.profile

    export PATH=$PATH:/usr/local/go/bin
    export GOROOT=/usr/local/go
    export GOPATH=$HOME/go
    export PATH=$PATH:$HOME/go/bin

    . ~/.profile


    cd ~
    mkdir go


    :docker
    wget -qO- https://get.docker.com/ --no-check-certificate | sh

     (http://mirrors.aliyun.com/docker-engine/apt/repo/pool/main/d/docker-engine/)阿里的下载目录 dpkg -i p.deb

    sudo usermod -aG docker fabric

    sudo mkdir -p /etc/docker
    sudo tee /etc/docker/daemon.json <<-'EOF'
    {
    "registry-mirrors": ["https://obou6wyb.mirror.aliyuncs.com"]
    }
    EOF
    sudo systemctl daemon-reload
    sudo systemctl restart docker

    sudo apt-get install python-pip

    curl -L -k https://get.daocloud.io/docker/compose/releases/download/1.12.0/docker-compose-`uname -s`-`uname -m` > ~/docker-compose
    sudo mv ~/docker-compose /usr/local/bin/docker-compose
    chmod +x /usr/local/bin/docker-compose

    :fabric
    mkdir -p ~/go/src/github.com/hyperledger
    cd ~/go/src/github.com/hyperledger
    git clone https://github.com/hyperledger/fabric.git

    cd ~/go/src/github.com/hyperledger/fabric
    git checkout v1.0.0

    cd ~/go/src/github.com/hyperledger/fabric/examples/e2e_cli/
    source download-dockerimages.sh -c x86_64-1.0.0 -f x86_64-1.0.0
    docker images

    ./network_setup.sh up


    docker exec -it cli bash
    peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}'
    peer chaincode invoke -o orderer.example.com:7050 --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C mychannel -n mycc -c '{"Args":["invoke","a","b","20"]}'

    cd ~/go/src/github.com/hyperledger/fabric/examples/e2e_cli

    ./network_setup.sh down

    query 
    CORE_PEER_LOCALMSPID=Org1MSP 
    CORE_PEER_MSPCONFIGPATH=~/go/src/github.com/hyperledger/fabric/examples/e2e_cli/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp 
    CORE_PEER_TLS_ROOTCERT_FILE=~/go/src/github.com/hyperledger/fabric/examples/e2e_cli/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt 
    CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock CORE_PEER_TLS_ENABLED=true 
    CORE_PEER_TLS_KEY_FILE=~/go/src/github.com/hyperledger/fabric/examples/e2e_cli/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key 
    CORE_PEER_TLS_CERT_FILE=~/go/src/github.com/hyperledger/fabric/examples/e2e_cli/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt 
    CORE_LOGGING_LEVEL=DEBUG 
    CORE_PEER_ADDRESS=peer0.org1.example.com:7051 
    ./peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}'
    

      

    invoke
    CORE_PEER_LOCALMSPID=Org1MSP 
    CORE_PEER_MSPCONFIGPATH=~/go/src/github.com/hyperledger/fabric/examples/e2e_cli/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp 
    CORE_PEER_TLS_ROOTCERT_FILE=~/go/src/github.com/hyperledger/fabric/examples/e2e_cli/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt 
    CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock CORE_PEER_TLS_ENABLED=true 
    CORE_PEER_TLS_KEY_FILE=~/go/src/github.com/hyperledger/fabric/examples/e2e_cli/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key 
    CORE_PEER_TLS_CERT_FILE=~/go/src/github.com/hyperledger/fabric/examples/e2e_cli/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt 
    CORE_LOGGING_LEVEL=DEBUG 
    CORE_PEER_ADDRESS=peer0.org1.example.com:7051 
    ./peer chaincode invoke -o orderer.example.com:7050 --tls true --cafile /root/go/src/github.com/hyperledger/fabric/examples/e2e_cli/crypto-config/ordererOrganizations/example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C mychannel -n mycc -c '{"Args":["invoke","a","b","20"]}'
    

     

    install 
    CORE_PEER_LOCALMSPID=Org1MSP 
    CORE_PEER_MSPCONFIGPATH=~/go/src/github.com/hyperledger/fabric/examples/e2e_cli/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp 
    CORE_PEER_TLS_ROOTCERT_FILE=~/go/src/github.com/hyperledger/fabric/examples/e2e_cli/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt 
    CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock CORE_PEER_TLS_ENABLED=true 
    CORE_PEER_TLS_KEY_FILE=~/go/src/github.com/hyperledger/fabric/examples/e2e_cli/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key 
    CORE_PEER_TLS_CERT_FILE=~/go/src/github.com/hyperledger/fabric/examples/e2e_cli/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt 
    CORE_LOGGING_LEVEL=DEBUG 
    CORE_PEER_ADDRESS=peer0.org1.example.com:7051 
    ./peer chaincode install -n mycc -v 0 -p github.com/hyperledger/fabric/examples/e2e_cli/examples/chaincode/go/chaincode_example02
    

      

    安装
    peer chaincode install -n c002 -v 1.0 -p github.com/chaincode_example02/go
    peer chaincode instantiate -C mychannel -n c002  -v 1.0 -c '{"Args":["init","a","100","b","200"]}'
    peer chaincode query -C mychannel -n c002 -c '{"Args":["query","a"]}'
    peer chaincode invoke -C mychannel -n c002 -c '{"Args":["invoke","a","b","10"]}'

    升级
    peer chaincode install -n c002 -v 2.0 -p github.com/chaincode_example02/gov1
    peer chaincode upgrade -C mychannel -n c002 -p github.com/chaincode_example02/go -v 2.0 -c '{"Args":["init","a","1000","b","2000"]}'
    peer chaincode query -C mychannel -n c002 -c '{"Args":["query","a"]}'

  • 相关阅读:
    Selenium 2自动化测试实战
    Python学习笔记整理(python 3)
    Python编程中出现ImportError: bad magic number in 'numpy': b'x03xf3 '
    收集的一些表单常用的正则表达式。
    转载的一篇博客,感觉不错,自我感觉很到位,来自 http://www.cnblogs.com/laizhihui/p/5810965.html
    闲来无写的,就是中间有一条小细线,求大神指点。
    自己总结的有关PHP一些基本知识和一些常见的js问题
    不经意间看到的东西,感觉不错(转载)。
    无束缚版贪吃蛇(就问你爽不爽)
    小图局部放大效果(图片的话就自己找一个吧,记得是一张图片用两次,不是两张图片,而且你的图片不一定与我一样,需改一下放大的尺寸)
  • 原文地址:https://www.cnblogs.com/ahuo/p/8960999.html
Copyright © 2011-2022 走看看