I built up a network via the test-network.sh in the fabric-samples. I use the command
docker cp a4c:/var/hyperledger/production/ledgersData/chains/chains/mychannel/blockfile_000000 .
to copy the block in peer to my host Linux system. The a4c
is the container id of peer0.org1.com
.
I want to convert it to a .json
file.
But there are some problems.
My hyperledger fabric version is 2.3.0
.
My configtxgen version is
configtxgen:
Version: 2.3.0
Commit SHA: ec81f3e74
Go version: go1.14.12
OS/Arch: linux/amd64
My configtxlator version is
configtxlator:
Version: 2.3.0
Commit SHA: ec81f3e74
Go version: go1.14.12
OS/Arch: linux/amd64
When I use the command
configtxgen -inspectBlock blockfile_000000 >> blockfile.json
It returns
2023-02-21 16:38:22.631 CST [common.tools.configtxgen] main -> INFO 001 Loading configuration
2023-02-21 16:38:22.631 CST [common.tools.configtxgen] doInspectBlock -> INFO 002 Inspecting block
2023-02-21 16:38:22.631 CST [common.tools.configtxgen] doInspectBlock -> INFO 003 Parsing genesis block
2023-02-21 16:38:22.631 CST [common.tools.configtxgen] main -> FATA 004 Error on inspectBlock: error unmarshaling to block: error unmarshaling Block: proto: can't skip unknown wire type 7
When I use the command
configtxlator proto_decode --type common.Block --input blockfile_000000 --output blockfile.json
It returns
configtxlator: error: Error decoding: error unmarshaling: proto: can't skip unknown wire type 7
However, I can decode the genesis.Block
and mychannel.Block
in line with my expectation.
I am not sure what the specific problem is here, but I would suggest using versions of Fabric binaries that exactly match the version of Fabric that you are using. As per the Fabric install instructions, you can download binaries for a specific version, something like this:
curl --location https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/install-fabric.sh | bash -s -- --fabric-version 2.2.10 binary