In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you how to deploy the Fabric blockchain Windows development environment, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's learn about it!
Byfn.win is the Windows version of Hyperledger Fabric's famous byfn.sh script, which is used to help developers quickly build Hyperledger Fabric chain code and application development environment in Windows environment. Official download address: http://sc.hubwiz.com/codebag/byfn-win/.
1. Overview of the development package
The main features of Byfn.win are as follows:
Using the natively built windows version of the Fabric program, no need to install the virtual machine / Linux subsystem / Docker
Reset the BYFN network with one button and start the BYFN network with one button, which saves developers a lot of time and energy.
Support TLS secure transport settings, support solo consensus and etcdraft consensus
Support chain code and application development kits in various languages provided by Hyperledger fabric official and third parties
Decompression ready-to-use, green software
Byfn.win is developed with Golang, and the current version is 1.0.0. For a list of main documents, please see the official website description: http://sc.hubwiz.com/codebag/byfn-win/
2. Byfn.win usage instructions 2. 1 generate BYFN network basic materials
Use the resume subcommand of byfn.exe to generate or reset the basic data that the BYFN network depends on:
Note:
Each time the reset command is executed, the existing blockchain data and cryptographic data are cleared.
The output log of the node is in the first-network/logs directory
2.2 start the BYFN network
Use the up subcommand of byfn.exe to start the BYFN network:
The options for the up subcommand are as follows:
-- tls: enable tls. Default: false.
-- full /-f: whether to start all nodes. Default: false. Start only one node.
-- orderer /-o: select the sorter implementation. Default: solo. Optional: solo or etcdraft.
By default, byfn.win disables TLS and starts only one sort node and one peer node, that is:
Orderer.example.com
Peer0.org1.example.com
You can use the above options to toggle startup settings, such as enabling tls, etcdraft sorting, and starting all peer nodes:
2.3 access to the Peer node management console
Use the admin subcommand of byfn.exe to enter the administrative console of the peer node:
The options for the admin subcommand are as follows:
-- peer /-p: sets the node number. Default: 0
-- org /-o: set the organization number. Default: 1.
By default, you can enter the management console of peer0.org1.example.com, and you can use the above options to enter the console of different peer nodes, such as the management console of peer1.org2.example.com:
Byfn admin-p 1-o 2
Note:
When the network has TLS enabled, you also need to enable tls when entering the management terminal, for example:
Byfn admin-tls
The peer command requires additional tls-related parameters, such as:
> peer channel list-tls-cafile=%ORDERER_CA%
The corresponding path has been set in the environment variable ORDERER_CA, which can be used directly.
2.4 perform end-to-end testing
After entering the administrative console, you can call e2e.cmd for basic testing:
E2e.cmd mainly performs the following tasks:
Start the preset chain code chaincode_example02
Create a channel mychannel
Add peer0.org1.example.com to mychannel
Install chain code mycc:0 in peer0.org1.example.com
Activate chain code mycc:0 in channel mychannle
Query the status of chain code mycc:0
Submit a transaction to modify the status of the chain code mycc:0
Query the status of chain code mycc:0 again
Close chain code chaincode_example02
2.5 use the fabric preset command in the administrative console
E2e.cmd is a standard windows batch file, and each command can be executed separately in the administrative console.
For example, the following three commands are used to query the channel joined by the currently managed node, the chain code installed by the current node, and the chain code activated by the specified channel:
3. Use byfn.win to test the chain code developed by yourself
First start the network with the up subcommand:
Byfn up
Then start the chain code application, such as starting the preset nodejs chain code:
Cd chaincode_example02/nodenpm installnode index.js-peer.address=peer0.org1.examplecom:7052-peer.id.name=myccjs:0
Now when you enter the management terminal, you can install, activate, query or trade the chain code.
Install chain code:
> peer chaincode install-n myccjs-v 0-l node-p..\ chaincode_example02\ node
Activate the chain code:
> peer chaincode instantiate-n myccjs-c "{\" Args\ ": [\" init\ ",\" tom\ ",\" 1000\ ",\" mary\ ":\" 2000\ "]}"-C mychannel-o orderer.example.com
Query chain code status:
> peer chaincode query-n myccjs-c "{\" Args\ ": [\" invoke\ ",\" tom\ "]}"-C mychannel
Submit chain code transaction:
> peer chaincode invoke-n myccjs-c "{\" Args\ ": [\" invoke\ ",\" tom\ ",\" mary\ ",\" 100\ "]}"-C mychannel-o orderer.example.com
Note:
Before activating the chain code, you need to start the chain code first
The chain code can be modified or rerun at any time without reactivation
4. Use byfn.win to develop applications
The connection profile for org1 is automatically generated when the notify subcommand is executed:
Connection-org1.json
Connection-org1.yaml
The official SDK provided by Hyperledger Fabric can directly use the above connection profile, and you can choose json or yaml format according to your own needs.
The above is all the contents of the article "how to deploy the Fabric blockchain Windows development environment with one click". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.