Deploying sample app in development mode (no TLS, 1 Org, Peer running in dev mode, CouchDB, and solo orderer)
To deploy the fabric network, in the network
directory run:
./start.sh
In smartcontracts/contract
run
npm install
To install the smart contract in smartcontracts/contract
, in the smartcontracts
directory run:
./deploy.sh
At the end something like the following should appear:
===========================
RUN:
===========================
CORE_CHAINCODE_ID_NAME=fabcar_1:3e4857d57fc322fd8eba0b1d4e21a03446f74f895dfa2228a874c8331f1dea72 CORE_PEER_TLS_ENABLED=false node ./contract/index.js --peer.address 127.0.0.1:7052
Run that command so that the smart contract in the smartcontracts/contract
runs in development mode. Logs should appear in that terminal.
Then to initialize the smart contract in the smartcontracts
directory run:
./initChaincode.sh
To run the application that connects to fabric in apps/application
run:
npm install
node ./enrollAdmin.js
node ./registerUser.js
node ./query.js
node ./invoke.js
Then to start express web server on port:3000
use:
npm start
The Swagger documentation will be in /api-docs
Fauxton (to view CouchDB) will be in port:5984/_utils/
To stop the fabric network in network
run (in some cases it might require sudo):
./stop.sh
Like deploying in dev mode except the scripts receive a flag -n 1
or -n 2
indicating the number of organizations in the network.
In network
:
./start.sh -n 2
In smartcontracts
:
./deploy.sh -n 2
./logs.sh
In apps/application
:
npm install
node ./enrollAdmin.js
node ./registerUser.js
node ./query.js
node ./invoke.js
npm start
In network
:
./stop.sh -n 2
- Hyperledger Fabric v2.0
- Hyperledger Fabric Samples
- Fabric SDK Node
- Fabric Chaincode node
- Swagger
- Fauxton
This project was based on the Fabric Samples, specifically the test-network and the chaincode/fabcar/javascript examples of the FAB-17498 commit. It uses Fabric SDK Node 2.0.0-beta.2, which is not stable.