0

I would like to install/download the HLF binaries, without the images and fabric-samples. How do I do that?

This is what I've tried so far:

  1. I've followed the instruction on https://hyperledger-fabric.readthedocs.io/en/release-1.4/install.html, but that also installs the images (which is unwanted).
  2. I've looked into the hlf repository, but the /bin/ directory is absent there and a name-search for 'contigtxgen' and others yielded no results other than it being used inside other scripts in the repo
  3. googled for any mention of binary-only install of hlf, without positive results

Desired result would be a cli command with which I can suppress the installing of images, or something similar.

Ludo
  • 109
  • 3
  • 11

2 Answers2

5

I am also in the process of setting up fabric without docker images. This link has helped me a lot. Although it does not show how to set up orderer and node on host machine.

Following is my configuration and steps that I followed to run orderer and peer on host machine(make sure you have installed all the prerequisites for hyperledger fabric):-

First clone the fabric repository and run make.

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

//cd into fabric folder and run
make release

The above will generate binaries in release folder for your host machine.

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

Copy this bin folder and into new folder mynetwork and create the following configuration files.

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

Following are the configurations that I am using.

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

Next open terminal(lets call it terminal-1) and cd into mynetwork folder and run the cryptogen to generate the assets and keys.

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

The above will create crypto-config folder in mynetwork containing all the network assets, in this case for ordererOrganization and peerOrganization.

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

Next you need to create 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

Then on terminal-1 run the following few commands in sequence

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

Next create orderer.yaml, and change the certificate paths according to your host and folder location.

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

Start the orderer on terminal-1

./bin/orderer

Next open another terminal(Terminal-2) and go to mynetwork folder. Create core.yaml(similarly you'll need to change the certificate and key path's).

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

Start the peer node on terminal-2

./bin/peer node start

Next open another terminal(Terminal-3) and go to mynetwork folder. Run the following commands in sequence.

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

Create channel

/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 

Join the channel

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

If you made it this far, your network is up and you can start installing chaincodes. I am still in the processes of experimenting chaincodes. However, I Hope this helps.

Yeou
  • 622
  • 1
  • 7
  • 21
1

If you download this script (and set execute permission):

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

Then run the script with -h you will see the options to suppress download of Binaries or Docker Images.

R Thatcher
  • 5,550
  • 1
  • 7
  • 15
  • 3
    Thanks for the suggestion, I found out it can also be done directly from the curl command with the -d and -s flags:```curl https://raw.githubusercontent.com/hyperledger/fabric/master/scripts/bootstrap.sh | bash -s -- 1.4.0 1.4.0 -d -s``` – Ludo Apr 26 '19 at 06:11
  • @LdePudo this command works for me, thanks you – normeno Jan 17 '21 at 14:50
  • This file not available now. – Vijay Jan 02 '23 at 06:18