0️⃣  Prerequisites

We assume that you have Git, cURL and Docker installed on your computer

  1. Clone the repository: Diegoescalonaro/fabcar-sample

    git clone <https://github.com/Diegoescalonaro/fabcar-sample.git>
    
  2. Execute script to download the Fabric Container images and also download the **Fabric binarie**s

    cd fabcar-sample
    ./install-fabric.sh docker binary
    

1️⃣  Run & stop the Hyperledger Fabric test network

We assume that Docker is running on your computer

  1. Run the fabric network and create a channel with name: mychannel

    We choose the peer state database: couchdb.

    cd ./test-network 
    ./network.sh up createChannel -c mychannel -s couchdb -ca
    

    Once the network is up, you can access CouchDB via this endpoint: http://localhost:5984/_utils/

    User: admin Password: adminpw

<aside> ⛔ Hey! You know you can stop the network with this command. But don’t use it right now!!!!

</aside>

./network.sh down

2️⃣  Prepare chaincode on test network

  1. Access to Fabric CLI container

    docker ps
    docker exec -ti cli bash
    
  2. Download the chaincode repository into the CLI

    <aside> ⚠️ IMPORTANT: You have ✌🏽  two possible options

    </aside>

    🐢  🐢  Option 1. Copy / Import the chaincode from your local filesystem to docker container. You should open a new terminal 🤓

    docker cp /Users/der/Documents/Git/fabcar-sample cli:/opt/gopath/src/github.com/hyperledger
    

    🚀  ⭐  Option 2. Download the chaincode repository from GitHub to docker container

    cd /opt/gopath/src/github.com/hyperledger
    git clone <https://github.com/Diegoescalonaro/fabcar-sample>
    
  3. Install chaincode dependencies

    apk update
    apk add npm
    cd /opt/gopath/src/github.com/hyperledger/fabcar-sample/chaincode/fabcar/javascript/
    npm install
    

ℹ️ INFORMATION: Environment variables to target a specific peer

These are the environment variables that you will use in the following sections to target a specific peer to install, commit or approve the chaincode

<aside> ⚠️ IMPORTANT: Export the variables from the path: /opt/gopath/src/github.com/hyperledger/fabric/peer

</aside>

To export the variables succesfully you only have to execute the following command when needed:

cd /opt/gopath/src/github.com/hyperledger/fabric/peer

Peer0 org1