To check the docker and docker-compose versions:
docker --version
docker-compose --versionTo install docker and docker-compose:
sudo apt install docker
sudo apt install docker-composeBefore running any git clone commands, run the following commands:
git config --global core.autocrlf false
git config --global core.longpaths true
If curl is not installed:
sudo apt install curl
The command below demonstrates how to download Fabric v1.4.12:
curl -sSL http://bit.ly/2ysbOFE | bash -s -- 1.4.12 1.4.9 0.4.22
Go to first-network folder and run:
./byfn.sh generate
And to up the network:
./byfn.sh up
This next section requires you to be in the first-network subdirectory within your local clone of the fabric samples repo.
./byfn.sh down
Then:
docker rm -f $(docker ps -aq)
docker rmi -f $(docker images | grep fabcar | awk '{print $3}')
This next section required to be in the fabcar subdirectory within your local clone of the fabric-samples repo.
./startFabric.sh javascript
The following instructions require you to be in the fabcar/javascript subdirectory within your local clone of the fabric-samples repo.
npm install
Let's take a look at what's inside with ls command:
enrollAdmin.js node_modules package.json registerUser.js
invoke.js package-lock.json query.js wallet
To enrol user admin:
node enrollAdmin.js
To enrol a new user - user1:
node registerUser.js
Querying the ledger:
node query.js
The output should look like this:
Wallet path: .fabric-samples/fabcar/javascript/wallet
Transaction has been evaluated, result is:
[{"Key":"CAR0", "Record":{"colour":"blue","make":"Toyota","model":"Prius","owner":"Tomoko"}},
{"Key":"CAR1", "Record":{"colour":"red","make":"Ford","model":"Mustang","owner":"Brad"}},
{"Key":"CAR2", "Record":{"colour":"green","make":"Hyundai","model":"Tucson","owner":"Jin Soo"}},
{"Key":"CAR3", "Record":{"colour":"yellow","make":"Volkswagen","model":"Passat","owner":"Max"}},
{"Key":"CAR4", "Record":{"colour":"black","make":"Tesla","model":"S","owner":"Adriana"}},
{"Key":"CAR5", "Record":{"colour":"purple","make":"Peugeot","model":"205","owner":"Michel"}},
{"Key":"CAR6", "Record":{"colour":"white","make":"Chery","model":"S22L","owner":"Aarav"}},
{"Key":"CAR7", "Record":{"colour":"violet","make":"Fiat","model":"Punto","owner":"Pari"}},
{"Key":"CAR8", "Record":{"colour":"indigo","make":"Tata","model":"Nano","owner":"Valeria"}},
{"Key":"CAR9", "Record":{"colour":"brown","make":"Holden","model":"Barina","owner":"Shotaro"}}]
