Explorer does not work with Hyperledger Fabric v3.0.0 and FabricGateway.ts file should be corrected/updated
What happened?
There is a problem about using Hyperledger Fabric v3.0.0 with Explorer. It does not show chaincodes and transactions. It looks like https://github.com/hyperledger-labs/blockchain-explorer/blob/main/app/platform/fabric/gateway/FabricGateway.ts file should be updated to be compatible with HLFv3.0.0. When I check the logs on the explorer container with docker logs CONTAINER command, it shows the error:
[2024-11-21T12:02:03.592] [ERROR] Sync - <<<<<<<<<<<<<<<<<<<<<<<<<< Synchronizer Error >>>>>>>>>>>>>>>>>>>>>
[2024-11-21T12:02:03.592] [ERROR] Sync - Error: error in simulation: failed to execute transaction d00a5575f86467db94ce1ba5e0dec11f0e837fd23b41c0ccc526128ee7c0a93e: could not launch chaincode lscc.syscc: error building chaincode: error building image: failed to get chaincode package for external build: could not get legacy chaincode package 'lscc.syscc': open /var/hyperledger/production/chaincodes/lscc.syscc: no such file or directory
The start point of the error is, I think, async queryInstantiatedChaincodes(channelName) function. There is a problem with the lifecycle of chaincode.
What did you expect to happen?
How can we reproduce it (as minimally and precisely as possible)?
async queryInstantiatedChaincodes(channelName) function in FabricGateway.ts file should be updated.
Anything else we need to know?
No response
OS version
# On Linux:
$ cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.5 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.5 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy
$ uname -a
Linux umit 5.15.0-124-generic #134-Ubuntu SMP Fri Sep 27 20:20:17 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here
I too get similar error. Was running fine until recently. But now I am getting this error in explorer pod:
[2024-12-12T02:40:07.235] [INFO] FabricGateway - queryInstantiatedChaincodes primary-channel
[2024-12-12T02:40:07.243] [ERROR] Sync - <<<<<<<<<<<<<<<<<<<<<<<<<< Synchronizer Error >>>>>>>>>>>>>>>>>>>>>
[2024-12-12T02:40:07.243] [ERROR] Sync - Error: error in simulation: failed to execute transaction 892bd945724067f24c99d19cb47985a3d471106a3825807c6aae3877f7edba14: could not launch chaincode lscc.syscc: error building chaincode: error building image: failed to get chaincode package for external build: could not get legacy chaincode package 'lscc.syscc': open /var/hyperledger/production/chaincodes/lscc.syscc: no such file or directory
at SingleQueryHandler.evaluate (/opt/explorer/node_modules/fabric-network/lib/impl/query/singlequeryhandler.js:60:57)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Transaction.evaluate (/opt/explorer/node_modules/fabric-network/lib/transaction.js:319:25) {
isEndorsed: false,
payload: { type: 'Buffer', data: [] },
status: 500
}
[2024-12-12T02:40:07.243] [INFO] Sync - <<<<<<<<<<<<<<<<<<<<<<<<<< Closing client processor >>>>>>>>>>>>>>>>>>>>>
I had to downgrade the peer and orderers from v2.5.10 to v.2.5.9 for the explorer to work. Once peers and orderers were downgraded I just restarted the explorer and it worked.
Explorer should probably use the new fabric-gateway to communicate with v3.0.0 networks, I think.
EDIT: Apparently, it works if you use chaincode as a service: https://github.com/hyperledger-labs/blockchain-explorer/issues/508#issuecomment-2453028005