0

Fabric 1.4.3 version. Blockchain network with 1 Oderer (solo) + 1 Org, running on Docker.

Trying to instantiate chaincode, due to PANIC error on PEER0, and peer crashes.

Impossible to instantiate chaincode, because PEER0 crashes doing the process.

At CLI docker prompt, I did this command sequence:

1) $> peer channel create -o $ORDERERNAME -c $CHANNELNAME -f $CONFIGTXFOLDER/devchannel.tx --tls --cafile=$ORDERER_TLSCACERT

Result in Cli: UTC [cli.common] readBlock -> INFO 04e Received block: 0

2) $> peer channel join -o $ORDERERNAME -b $CONFIGTXFOLDER/devgenesis.block --tls --cafile=$ORDERER_TLSCACERT

Result in Cli: UTC [channelCmd] executeJoin -> INFO 03e Successfully submitted proposal to join channel

3) $> peer chaincode install -n $CHCODENAME -p $CHCODEPATH -v $CHCODEVERSION -l node --tls --cafile $ADMIN_PEER_TLSCACERT

Result in Cli: UTC [chaincodeCmd] install -> INFO 04a Installed remotely response:<status:200 payload:"OK" >

4) $> peer chaincode instantiate -C $CHANNELNAME -n $CHCODENAME -v $CHCODEVERSION -o $ORDERERNAME -c '{"Args":["init","a","100","b","200"]}' -P "AND ('GuaraniMSP.admin')" --tls --cafile $ORDERER_TLSCACERT --tlsRootCertFiles $CORE_PEER_TLS_ROOTCERT_FILE

Result before crash in PEER0:

UTC [gossip.state] commitBlock -> ERRO 87e Got error while committing(unexpected Previous block hash. Expected PreviousHash = [c87a4b77e4c790f78b0c2e3c97d97de9907a09daf5dc2f039c7e3b3e1440f5d1], PreviousHash referred in the latest block= [953e31164a84d6d1b9b446130d1e7d5af8ede818284e8fa7c315b2125b519e38]
github.com/hyperledger/fabric/common/ledger/blkstorage/fsblkstorage.(*blockfileMgr).addBlock

[...]

UTC [gossip.state] deliverPayloads -> PANI 87f Cannot commit block to the ledger due to unexpected Previous block hash. Expected PreviousHash = [c87a4b77e4c790f78b0c2e3c97d97de9907a09daf5dc2f039c7e3b3e1440f5d1], PreviousHash referred in the latest block= [953e31164a84d6d1b9b446130d1e7d5af8ede818284e8fa7c315b2125b519e38]
github.com/hyperledger/fabric/common/ledger/blkstorage/fsblkstorage.(*blockfileMgr).addBlock

[...]

/opt/go/src/runtime/asm_amd64.s:1333
panic: Cannot commit block to the ledger due to unexpected Previous block hash. Expected PreviousHash = [c87a4b77e4c790f78b0c2e3c97d97de9907a09daf5dc2f039c7e3b3e1440f5d1], PreviousHash referred in the latest block= [953e31164a84d6d1b9b446130d1e7d5af8ede818284e8fa7c315b2125b519e38]
github.com/hyperledger/fabric/common/ledger/blkstorage/fsblkstorage.(*blockfileMgr).addBlock

[...]

I opened an issue at Hyperledger Fabric JIRA about this situation, and I received the information that I need to clear out the environment to ensure there are no artifacts from prior trials. Issue FABB-147 at Hyperledger Fabric (My logs are there).

I saw a problem documented close to my, but with differences, at peers get crash after anchor peer update

Now I have to certify that my Hyperledger Fabric environment is clear. But how?

Is there any documented procedure or checklist to verify if there are no artifacts from prior trials in Hyperledger Fabric?

If I suppress the ORDERER_GENERAL_GENESISFILE and ORDERER_GENERAL_GENESISPROFILE settings for orderer.yaml and docker-compose.yaml, will the orderer element start normally, and then the network will understand that it should use the genesis.block informed when creating the new channel?

Thanks in advance for your help.

2
  • How are you running all of the nodes? Docker? Binaries?
    – Gari Singh
    Mar 28, 2020 at 11:36
  • Hyperledger Fabric 1.4.3 running on Docker, over Ubuntu OS in my private computer. The blockchain network has 1 Orderer with 1 Anchor Peer (+ CouchDB), with specific configuration. I'm not using BYFN from fabric-samples. Mar 29, 2020 at 16:49

3 Answers 3

0
  1. Run this command docker system prune
  2. Start Your network again

hope this help u as it helped me

0

While not an answer to cleaning your environment, here's a possible solution to your underlying problem.

The peer channel create command will generate a $CHANNELNAME.block file in its current working directory. This is the block you need to use when running peer channel join, not a genesis block.

$> peer channel create  ... -c $CHANNELNAME 
$> peer channel join ... -b $CONFIGTXFOLDER/devgenesis.block

Will ruin your day by causing your peers to crash most of the time, and rarely work after recreating the ledger from a new genesis block. Try this instead:

$> peer channel create  ... -c $CHANNELNAME 
$> peer channel join ... -b $CHANNELNAME.block
0
0

I was using the genesis block from the system fabric network, loaded on the Ordener (from orderer.yaml or docker-compose.yaml), to join the channel, and that was wrong.

The source of my error was that I was using the system genesis block instead of using the genesis block generated in the peer channel create command.

I understood that the peer channel create command uses a transaction block model (.tx) as input, and as an output it generates a genesis block (.block) that must be used as input in the peer channel join command.

The correct sequence is:

Step 1) $> peer channel create -o $ORDERERNAME -c $CHANNELNAME -f $CONFIGTXFOLDER/devchanneltrack.tx --outputBlock $CHANNELFOLDER/devchannelgen.block --tls --cafile=$ORDERER_TLSCACERT

Step 2) $> peer channel join -o $ORDERERNAME -b $CHANNELFOLDER/devchannelgen.block --tls --cafile=$ORDERER_TLSCACERT

I made corrections to the scripts, and now I can join the channel. Then I did the installation and instantiation of new chaincodes on the channel, and they worked perfectly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.