In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-01 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 HyperLedgr and initialize the network, 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 go to know it!
List of prerequisites
The latest version of git
The latest version of curl
Any version of wget
Docker and docker-compose
Docker-version needs
Go environment settings
Node.js environment settings (including npm)
Python
Install sample, binary, and Docker images
Download the source file according to the script and store it in the bin folder. Finally, the script will download the latest Hyperledger Fabric Docker image from Docker Hub to the local Docker registry.
Before testing the correctness of the installation environment begins
Confirm the success of the installation example in Chapter 2
Start the test network
Cd fabric-samples/test-network
Enable. / network.sh-h to view the usage of the test network build script
1.Usage:2. Network.sh [Flags] 3. 4.-'up'-bring up fabric orderer and peer nodes. No channel is created5. -'up createChannel'-bring up fabric network with one channel6. -'createChannel'-create and join a channel after the network is created7. -'deployCC'-deploy the fabcar chaincode on the channel8. -'down'-clear the network with docker-compose down9. -'restart'-restart the network10.11. Flags:12.-ca-create Certificate Authorities to generate the crypto material13. -c-channel name to use (defaults to "mychannel") 14.-s-the database backend to use: goleveldb (default) or couchdb15. -r-CLI times out after certain number of attempts (defaults to 5) 16.-d-delay duration in seconds (defaults to 3) 17.-l-the programming language of the chaincode to deploy: go (default), javascript, or java18. -v-chaincode version. Must be a round number, 1, 2, 3, etc19. I-the tag to be used to launch the network (defaults to "latest") 20.-verbose-verbose mode21. Network.sh-h (print this message) 22.23. Possible Mode and flags24. Network.sh up-ca-c-r-d-s-I-verbose25. Network.sh up createChannel-ca-c-r-d-s-I-verbose26. Network.sh createChannel-c-r-d-verbose27. Network.sh deployCC-l-v-r-d-verbose28.29. Taking all defaults:30. Network.sh up31.32. Examples:33. Network.sh up createChannel-ca-c mychannel-s couchdb-I 2.0.0-beta34. Network.sh createChannel-c channelName35. Network.sh deployCC-l javascript
No human channels will be generated when using this script network.sh up (only two organizations and one sort node will be created)
The docker ps-a command displays several nodes currently created on the computer (3)
Create a channel
Use scripts to create Fabric channels for transactions between Org1 and Org2, different channels have different ledger books;. / neteork.sh createChannel-c channelName
Deploy chain code
. / network.sh deployCC-l javascript
Init will initialize the content of the intelligent contract and call the chain code to write the initialized data to the account book.
Query all the information in the ledger
Environment variable configuration of Org1. Query environment configuration of Org2 needs to be changed.
1.# Environment variables for Org12.3.export CORE_PEER_TLS_ENABLED=true4.# Change Org2MSP5.export CORE_PEER_LOCALMSPID= "Org1MSP" 6.# change org2.example.com & & peer0.org2.example.com7.export CORE_PEER_TLS_ROOTCERT_FILE=$ {PWD} / organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt8.# change org2.example.com & & Admin@org1.example.com9.export CORE_PEER_MSPCONFIGPATH=$ {PWD} / organizations/ PeerOrganizations/org1.example.com/users/Admin@org1.example.com/msp10.export CORE_PEER_ADDRESS=localhost:7051
Peer chaincode query-C mychannel-n fabcar-c'{"Args": ["queryAllCars"]}'
Change of capital on account
Peer chaincode invoke-o localhost:7050-- ordererTLSHostnameOverride orderer.example.com-- tls true-- cafile ${PWD} / organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem-C mychannel-n fabcar-- peerAddresses localhost:7051-- tlsRootCertFiles ${PWD} / organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt-- peerAddresses localhost:9051-- tlsRootCertFiles ${PWD} / organizations/peerOrganizations/ Org2.example.com/peers/peer0.org2.example.com/tls/ca.crt-c'{"function": "changeCarOwner" "Args": ["CAR9", "Dave"]}'
-- peerAddresses localhost:7051 represents the address of Org1
-- tlsRootCertFiles ${PWD} / organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt indicates the private key address of Org1
-- peerAddresses localhost:9051 represents the address of Org2
-- tlsRootCertFiles ${PWD} / organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt indicates the private key address of Org2
"the command is too long. Use the sdk in fabcar to edit the code changes."
Shut down the network
/ network.sh down this command stops and deletes nodes, chain code containers, organization keys, chain code mirrors, channels, and dock volumes in the Docker registry.
Start the network using a certification authority
The Hyperledger structure uses the public key infrastructure (PKI). Before creating peer nodes and sorting nodes, you must create all the encryption materials needed to deploy and operate the network: nodes, network administrators, and users who submit transactions need public certificates and private keys to authenticate.
By default, the Crptogen tool is used to create certificates and keys, as follows
/ Usr/fabric-samples/test-network/../bin/cryptogen#### Create Org1 Identities # # # + cryptogen generate-config=./organizations/cryptogen/crypto-config-org1.yaml-output=organizationsorg1.example.com+ res=0+ set + Xerox # # # Create Org2 Identities # + cryptogen generate-config=./ Organizations/cryptogen/crypto-config-org2.yaml-- output=organizationsorg2.example.com+ res=0+ set + Xerox customers # Create Orderer Org Identities # # + cryptogen generate-- config=./organizations/cryptogen/crypto-config-orderer.yaml-- output=organizations+ res=0+ set + x is all the content of the article "how HyperLedgr deploys and initializes the network" 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.