This project is part of a tutorial on Hyperledger Fabric showing how to use Hyperledger fabric to build a clone of google drive.
Hyperledger Fabric basic commands
sudo apt install -y git curl
#install nvm (node version manager)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
source ~/.bashrc
#install lts version of node
nvm install --lts
nvm use --lts
nvm alias default --lts
To install docker on your ubuntu machine, follow the steps from the tutorials given below:
By default, the docker command can only be run the root user or by a user in the docker group, which is automatically created during Docker's installation process. If you attempt to run the docker
command without prefixing it with sudo
or without being in the docker group, you'll get an output like this:
docker: Cannot connect to the Docker daemon. Is the docker daemon running on this host?. See 'docker run --help'.
If you want to avoid typing sudo whenever you run the docker command, add your username to the docker group:
sudo usermod -aG docker ${USER}
su - ${USER}
Confirm that your user is now added to the docker group by typing:
id -nG
If everything went well, you'll see docker in the output
To install docker compose on your ubuntu machine, follow the steps from the tutorials given below:
cd $HOME
curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/master/scripts/bootstrap.sh | bash -s
echo export PATH=\$PATH:\$HOME/fabric-samples/bin | tee -a ~/.bashrc
echo export FABRIC_CFG_PATH=$HOME/fabric-samples/config | tee -a ~/.bashrc
source ~/.bashrc
cd $HOME/fabric-samples
git clone https://github.com/Tanmoytkd/T-Drive t-drive
cd $HOME/fabric-samples/t-drive/chaincode-javascript
npm install
cd $HOME/fabric-samples/t-drive/api-javascript
npm install
cd $HOME/fabric-samples/test-network
# Start Test Network
./network.sh down && ./network.sh createChannel -ca -c mychannel -s couchdb
# Deleting the existing wallet from previous test network
rm -rf $HOME/fabric-samples/t-drive/api-javascript/wallet
# Install Chaincode
./network.sh deployCC -ccn tdrive -ccp $HOME/fabric-samples/t-drive/chaincode-javascript/ -ccl javascript
cd $HOME/fabric-samples/t-drive/api-javascript
npm install
node app.js
You can test the API with the REST CLIENT vs code extension. The tests are written in the file api_test.rest.
You can view the current state at http://localhost:5984/_utils/.
Username: admin
Password: adminpw
cd $HOME/fabric-samples/test-network
./network.sh down