Build a Fabric network (error troubleshooting version, the package is successful)

0. Refer to this blogger https://www.cnblogs.com/zongmin/p/11635686.html

1. Install machine-related dependencies

Install git, cURL, Docker, docker-compose, Golang according to the blog installation. The golang version I use is version 1.19.

2. Pull Fabric source code

Create a folder named blockchain and pull the code into it.

cd blockchain
git clone https://github.com/hyperledger/fabric.git
cd ./fabric
git branch -a  
git checkout v1.4.3

3. Pull fabric-samples

1. First pull fabric-samples

git clone https://github.com/hyperledger/fabric-samples.git
cd ./fabric-samples
git branch -a
git checkout v1.4.3  

2. Download Fabrci-samples related dependencies and merge

Go to the following two websites to find the corresponding dependencies

https://github.com/hyperledger/fabric-ca/releases/tag/v1.4.3
insert image description here
https://github.com/hyperledger/fabric/releases/tag/v1.4.3
insert image description here
After downloading these two files, put them on the server to decompress.
hyperledger-fabric-ca-linux-amd64-1.4.3.tar.gz will get a bin after decompression.

After hyperledger-fabric-linux-amd64-1.4.3.tar.gz is decompressed, a bin and a config file will be obtained.

Merge the two bins, that is, copy the files in the first bin to the second bin.

Move the merged bin and config to the fabric-samples folder, and give execution permission to the file under bin

sudo chmod -R 777 ./bin

In the fabric/scripts/bootstrap.sh file, the last part has the following command, delete the red box in it, that is, only keep the $Docker step. Then execute the following statement:
insert image description here

./bootstrap.sh 1.4.3 1.4.3 0.4.15

4. Conduct a network test

cd ./fabric-samples/first-network/
./byfn.sh up

报错:got unexpected status: FORBIDDEN – implicit policy evaluation failed - 0 sub-policies were satisfied, but this policy requires 1 of the ‘Writers’ sub-policies to be satisfied: permission denied
insert image description here
解决办法:参照了https://www.cnblogs.com/coderzjz/p/13812451.html

docker-compose -f docker-compose-cli.yaml down --volumes --remove-orphans
docker rm -f $(docker ps -a | grep "hyperledger/*" | awk "{print \$1}")
docker volume prune

Execute ./byfn.sh up again and
report an error: got unexpected status: BAD_REQUEST – error applying config update to existing channel 'mychannel': error authorizing update: error validating ReadSet: proposed update requires that key [Group] /Channel/Application be at version 0, but it is currently at version 1 Solution: This is to restart. It is recommended to execute ./byfn.sh down first and then ./byfn.sh up after the
startup ./byfn.sh -m restart -c mychannel
fails

Execute ./byfn.sh up again and
report an error: Error: error getting endorser client for channel: endorser client failed to connect to peer0.org1.example.com:7051: failed to create new connection: connection error: desc = “transport: error while dialing: dial tcp: look up peer0.org1.example.com: no such host” solution: first comment out the options and then execute
insert image description here
the sudo vim /etc/resolv.conf
following
insert image description here
command

sudo apt install resolvconf
sudo service resolvconf restart
./byfn.sh down
./byfn.sh up

Finally successfully built the Fabric network
insert image description here

Guess you like

Origin blog.csdn.net/qq_40920203/article/details/127797752