如何仅安装Hyperledger Fabric的二进制文件?

时间:2019-04-24 14:47:56

标签: installation hyperledger-fabric binaries

我想安装/下载HLF二进制文件,而没有图像和结构样本。我该怎么办?

这是我到目前为止尝试过的:

  1. 我已经按照https://hyperledger-fabric.readthedocs.io/en/release-1.4/install.html上的说明进行操作,但这也将安装图像(不需要)。
  2. 我已经查看了hlf存储库,但是/ bin /目录不存在,对'contigtxgen'和其他文件的名称搜索除了在回购协议中的其他脚本中使用以外没有其他结果
  3. 在Google上搜索到有关仅安装hlf的二进制文件的任何内容,但均未获得肯定结果

所需的结果将是cli命令,通过它我可以禁止安装映像或类似的命令。

2 个答案:

答案 0 :(得分:1)

我也正在设置没有docker映像的结构。 link对我有很大帮助。尽管未显示如何在主机上设置订购者和节点。

以下是我在主机上运行定购程序和对等设备时所遵循的配置和步骤(确保已安装Hyperledger Fabric的所有先决条件):-

首先克隆结构存储库并运行make。

git clone https://github.com/hyperledger/fabric.git

//cd into fabric folder and run
make release

以上内容将在release文件夹中为您的主机生成二进制文件。

fabric
 |
  -- release
    |
     -- linux-amd64
       |
        -- bin

将此bin文件夹复制到新文件夹mynetwork中,并创建以下配置文件。

mynetwork
 |
  -- bin
  -- crypto-config.yaml
  -- configtx.yaml
  -- order.yaml
  -- core.yaml

以下是我正在使用的配置。

crypto-config.yaml

OrdererOrgs:
  - Name: Orderer
    Domain: example.com
    Specs:
      - Hostname: orderer
        SANS:
          - "localhost"
          - "127.0.0.1"

PeerOrgs:
  - Name: Org1
    Domain: org1.example.com
    EnableNodeOUs: true
    Template:
      Count: 1
      SANS:
        - "localhost"
        - "127.0.0.1"
    Users:
      Count: 1

接下来打开终端(我们称其为terminal-1),并将其cd放入mynetwork文件夹,然后运行加密货币以生成资产和密钥。

./bin/cryptogen generate --config=./crypto-config.yaml

以上内容将在mynetwork中创建crypto-config文件夹,其中包含所有网络资产,在本例中为ordererOrganization和peerOrganization。

mynetwork
 |
  -- crypto-config
   |
    -- ordererOrganizations
    -- peerOrganizations

接下来,您需要创建configtx.yaml

Organizations:
  - &OrdererOrg
    Name: OrdererOrg
    ID: OrdererMSP
    MSPDir: crypto-config/ordererOrganizations/example.com/msp

    Policies:
      Readers:
        Type: Signature
        Rule: "OR('OrdererMSP.member')"
      Writers:
        Type: Signature
        Rule: "OR('OrdererMSP.member')"
      Admins:
        Type: Signature
        Rule: "OR('OrdererMSP.admin')"

  - &Org1
    Name: Org1MSP
    ID: Org1MSP
    MSPDir: crypto-config/peerOrganizations/org1.example.com/msp

    Policies:
      Readers:
        Type: Signature
        Rule: "OR('Org1MSP.admin', 'Org1MSP.peer', 'Org1MSP.client')"
      Writers:
        Type: Signature
        Rule: "OR('Org1MSP.admin', 'Org1MSP.client')"
      Admins:
        Type: Signature
        Rule: "OR('Org1MSP.admin')"

    AnchorPeers:
      - Host: 127.0.0.1
        Port: 7051


Capabilities:
  Channel: &ChannelCapabilities
    V1_3: true

  Orderer: &OrdererCapabilities
    V1_1: true

  Application: &ApplicationCapabilities
    V1_3: true

    V1_2: false

    V1_1: false


Application: &ApplicationDefaults
  Organizations:

  Policies:
    Readers:
      Type: ImplicitMeta
      Rule: "ANY Readers"
    Writers:
      Type: ImplicitMeta
      Rule: "ANY Writers"
    Admins:
      Type: ImplicitMeta
      Rule: "MAJORITY Admins"

  Capabilities:
    <<: *ApplicationCapabilities

Orderer: &OrdererDefaults
  OrdererType: solo
  Addresses:
    - orderer:7050
  BatchTimeout: 2s
  BatchSize:
    MaxMessageCount: 10
    AbsoluteMaxBytes: 99 MB
    PreferredMaxBytes: 512 KB

  Organizations:

  Policies:
    Readers:
      Type: ImplicitMeta
      Rule: "ANY Readers"
    Writers:
      Type: ImplicitMeta
      Rule: "ANY Writers"
    Admins: 
      Type: ImplicitMeta
      Rule: "MAJORITY Admins"
    BlockValidation:
      Type: ImplicitMeta
      Rule: "ANY Writers"

Channel: &ChannelDefaults

  Policies:
    Readers:
      Type: ImplicitMeta
      Rule: "ANY Readers"
    Writers:
      Type: ImplicitMeta
      Rule: "ANY Writers"
    Admins:
      Type: ImplicitMeta
      Rule: "MAJORITY Admins"

  Capabilities:
    <<: *ChannelCapabilities


Profiles:

  OneOrgOrdererGenesis:
    <<: *ChannelDefaults
    Orderer:
      <<: *OrdererDefaults
      Organizations:
        - *OrdererOrg
      Capabilities:
        <<: *OrdererCapabilities
    Consortiums:
      SampleConsortium:
        Organizations:
          - *Org1

  OneOrgChannel:
    Consortium: SampleConsortium
    <<: *ChannelDefaults
    Application:
      <<: *ApplicationDefaults
      Organizations:
        - *Org1
      Capabilities:
        <<: *ApplicationCapabilities

然后在终端1上依次运行以下几个命令

export FABRIC_CFG_PATH=$PWD
mkdir channel-artifacts
./bin/configtxgen -profile OneOrgOrdererGenesis -channelID myfn-sys-channel -outputBlock ./channel-artifacts/genesis.block
export CHANNEL_NAME=mychannel
./bin/configtxgen -profile OneOrgChannel -outputCreateChannelTx ./channel-artifacts/channel.tx -channelID $CHANNEL_NAME
./bin/configtxgen -profile OneOrgChannel -outputAnchorPeersUpdate ./channel-artifacts/Org1MSPanchors.tx -channelID $CHANNEL_NAME -asOrg Org1MSP

接下来创建orderer.yaml,并根据您的主机和文件夹位置更改证书路径。

General:
  LedgerType: file
  ListenAddress: 127.0.0.1
  ListenPort: 7050

  TLS:
    Enabled: true
    PrivateKey: /home/fabric-release/mynetwork/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.key
    Certificate: /home/fabric-release/mynetwork/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt
    RootCAs:
      - /home/fabric-release/mynetwork/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/ca.crt
    ClientAuthRequired: false

  Keepalive:
    ServerMinInterval: 60s
    ServerInterval: 7200s
    ServerTimeout: 20s

  GenesisMethod: file

  GenesisProfile: OneOrgOrdererGenesis

  GenesisFile: channel-artifacts/genesis.block

  LocalMSPDIR: /home/fabric-release/mynetwork/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp

  LocalMSPID: OrdererMSP

  Authentication:
    TimeWindow: 15m

FileLedger:
  Location: /home/fabric-release/data/orderer
  Prefix: hyperledger-fabric-ordererledger

Operations:
  ListenAddress: 127.0.0.1:8443
  TLS:
    Enabled: true
    Certificate: /home/fabric-release/mynetwork/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt
    PrivateKey: /home/fabric-release/mynetwork/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.key
    ClientAuthRequired: false
    ClientRootCAs: 
      - crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt

在终端1上启动订购器

./bin/orderer

接下来打开另一个终端(Terminal-2),然后转到mynetwork文件夹。创建core.yaml(同样,您需要更改证书和密钥路径)。

peer:
  id: peer1
  networkId: myfn

  listenAddress: 127.0.0.1:7051

  address: 127.0.0.1:7051

  addressAutoDetect: false

  gomaxprocs: -1

  keepalive:
    minInterval: 60s

    client:
      interval: 60s
      timeout: 20s

    deliveryClient:
      interval: 60s
      timeout: 20s
  gossip:
    bootstrap: 127.0.0.1:7051
    externalEndpoint: 127.0.0.1:7051
    useLeaderElection: true
    orgLeader: false
  tls:
    enabled: true
    clientAuthRequired: false
    cert:
      file: crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt

    key:
      file: crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key

    rootcert:
      file: crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt

    clientRootCAs:
      file:
        - crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt


  authentication:
    timewindow: 15m

  fileSystemPath: /home/fabric-release/data

  mspConfigPath: /home/fabric-release/mynetwork/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp

  localMspId: Org1MSP

  client: 
    connTimeout: 3s

  deliveryclient:
    reconnectTotalTimeThreshold: 3600s
    connTimeout: 3s

  profile:
    enabled: false
    listenAddress: 0.0.0.0:6060

  handlers:
    authFilters:
      - name: DefaultAuth
      - name: ExpirationCheck
    decorators:
      - name: DefaultDecorator
    endorsers:
      escc:
        name: DefaultEndorsement
        library:
    validators:
      vscc:
        name: DefaultValidation
        library:

  discovery:
    enabled: true
    authCacheEnabled: true
    authCacheMaxSize: 1000
    authCachePurgeRetentionRatio: 0.75
    orgMembersAllowedAccess: false

vm:
  endpoint: unix:///var/run/docker.sock
  docker:
    tls:
      enabled: false
      ca:
        file:
      cert:
        file:
      key:
        file:
    attachStdout: false
    hostConfig:
      NetworkMode: host
      Dns:
        # - 192.168.0.1
      LogConfig:
        Type: json-file
        Config:
          max-size: "50m"
          max-file: "5"
      Memory: 2147483648

chaincode:
  id: 
    path:
    name:

  builder: $(DOCKER_NS)/fabric-ccenv:latest

  pull: true

  java:
    runtime: $(DOCKER_NS)/fabric-javaenv:$(ARCH)-1.4.1
    #runtime: $(DOCKER_NS)/fabric-javaenv:$(ARCH)-$(PROJECT_VERSION)
  startuptimeout: 300s
  executetimeout: 30s
  mode: net
  keepalive: 0
  system:
    cscc: enable
    lscc: enable
    escc: enable
    vscc: enable
    qscc: enable
  logging:
    level:  info
    shim:   warning
    format: '%{color}%{time:2006-01-02 15:04:05.000 MST} [%{module}] %{shortfunc} -> %{level:.4s} %{id:03x}%{color:reset} %{message}'

ledger:
  blockchain:

  state:
    stateDatabase: goleveldb
    totalQueryLimit: 100000
    couchDBConfig:
      couchDBAddress: 127.0.0.1:5984
      username:
      password:
      maxRetries: 3
      maxRetriesOnStartup: 12
      requestTimeout: 35s
      internalQueryLimit: 1000
      maxBatchUpdateSize: 1000
      warmIndexesAfterNBlocks: 1
      createGlobalChangesDB: false

  history:
    enableHistoryDatabase: true

在终端2上启动对等节点

./bin/peer node start

接下来打开另一个终端(Terminal-3),然后转到mynetwork文件夹。依次运行以下命令。

export CORE_PEER_MSPCONFIGPATH=/home/fabric-release/mynetwork/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp
export CORE_PEER_ADDRESS=127.0.0.1:7051
export CORE_PEER_LOCALMSPID="Org1MSP"
export CORE_PEER_TLS_ROOTCERT_FILE=/home/fabric-release/mynetwork/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
export CHANNEL_NAME=mychannel

创建频道

/bin/peer channel create -o 127.0.0.1:7050 -c $CHANNEL_NAME -f ./channel-artifacts/channel.tx --tls --cafile /home/fabric-release/mynetwork/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem 

加入频道

./bin/peer channel join -b mychannel.block

如果到此为止,您的网络已经建立,您可以开始安装链码了。我仍在试验链码。但是,我希望这会有所帮助。

答案 1 :(得分:0)

如果下载此脚本(并设置执行权限):

https://raw.githubusercontent.com/hyperledger/fabric/master/scripts/bootstrap.sh

然后使用-h运行脚本,您将看到用于禁止下载Binaries或Docker映像的选项。