npm install -g composer-cli@0.19
npm install -g composer-rest-server@0.19
npm install -g generator-hyperledger-composer@0.19
npm install -g yo
npm install -g composer-playground@0.19
mkdir ~/fabric-dev-servers && cd ~/fabric-dev-servers
curl -O https://raw.githubusercontent.com/hyperledger/composer-tools/master/packages/fabric-dev-servers/fabric-dev-servers.tar.gz
tar -xvf fabric-dev-servers.tar.gz
cd ~/fabric-dev-servers
export FABRIC_VERSION=hlfv11
./downloadFabric.sh
./teardownAllDocker.sh
export FABRIC_VERSION=hlfv11
./createPeerAdminCard.sh
./startFabric.sh
This will require first obtaining a .bna file or generating it manually from the source files, and placing it in the fabric-dev-servers
directory.
In the directory containing the script file (.js), models file (.cto), access control file (.acl), and query file (.qry), run the following command:
composer archive create -t dir -n .
This is the current ford-network.bna which is deployed here: http://a77e7f48.ngrok.io/
curl -L -o ford-network.bna "https://drive.google.com/a/berkeley.edu/uc?authuser=1&id=1tkcHLH2Q3p3NKtyZIo6JbDESRdlq9Mf3&export=download"
Make sure to change the name and version of the .bna file when using a different .bna file
composer network install --card PeerAdmin@hlfv1 --archiveFile ford-network.bna
composer network start --networkName ford-network --networkVersion 0.2.6-deploy.34 --networkAdmin admin --networkAdminEnrollSecret adminpw --card PeerAdmin@hlfv1 --file networkadmin.card
composer card import --file networkadmin.card
screen
composer-rest-server -c admin@ford-network -n never -u true -w true -p 3000
This REST API will require authentication. Many different authentication strategies can be chosen from. We will be using GitHub authentication:
screen
Now export COMPOSER_PROVIDERS by copying all of the following into your terminal. ClientID and ClientSecret can be retrieived by creating a new GitHub application at https://github.com/settings/applications/new and filling in the appropriate API endpoints:
export COMPOSER_PROVIDERS='{ "github": { "provider": "github", "module": "passport-github", "clientID": "59f4e6cd81bda833d4a8", "clientSecret": "8d5af72513cdf9b1ea21a0630409d56b899d7dce", "authPath": "/auth/github", "callbackURL": "/auth/github/callback", "successRedirect": "/", "failureRedirect": "/" } }'
composer-rest-server -c admin@ford-network -n never -a true -m true -u true -w true -p 3001
screen
composer-playground