![Hyperledger Cookbook](https://wfqqreader-1252317822.image.myqcloud.com/cover/682/36698682/b_36698682.jpg)
上QQ阅读APP看书,第一时间看更新
How to do it...
To write your first application, follow these steps:
- Set up the development environment:
$ cd ~
cd fabric-samples/first-network
sudo docker ps
sudo ./byfn.sh down
sudo docker rm -f $(sudo docker ps -aq)
sudo docker network prune
cd ../fabcar && ls
You will notice that there are a few Node.js file present in fabcar folder such as enrollAdmin.js, invoke.js, query.js, registerUser.js, and package.json and all others packaged into one startFabric.sh file.
- Install the Fabric client:
$ sudo npm install -g npm@5.3.0
$ sudo npm update
You will notice from the following screenshot that the Fabric client 1.3.0 and Fabric CA client 1.30 packages are installed:
![](https://epubservercos.yuewen.com/21D760/19470379601494606/epubprivate/OEBPS/Images/c265ccf5-033e-4502-b3a3-ad1cf9f83c0c.png?sign=1738885370-sCL3MLnVIeF2H2GXonjyZXbz76bEmVYS-0-31159db0d0e42571c48789a07bdc7b1d)
- Execute the following command to launch the network:
$ sudo ./startFabric.sh node
- Open a new Terminal to stream the Docker logs:
$ sudo docker logs -f ca.example.com
This will open the Docker file, which will look similar to the following screenshot:
![](https://epubservercos.yuewen.com/21D760/19470379601494606/epubprivate/OEBPS/Images/e3616868-ff85-435e-9e2a-7b32cf3542ea.png?sign=1738885370-8HNvsyQnQLzAj770CTxbpH4odci2td69-0-0f764dae62e21613288a3d74e9594da6)
Next, we will use the Node.js script to run, query, and update the records on Fabric network.