Hyperledger Fabric: Peer Node Rollback - hyperledger-fabric

I am following Hyperledger V 1.4 documsation to roll back the channel mychannel to block number 150 using this following command:
peer node rollback -c mychannel -b 150
If I run this inside CLI container it's showing:
Validating the rollback parameters: ledgerID [mychannel], block number
[0]
Error: ledgerID [mychannel] does not exist.
If i run inside peer0 it is giving an error
Error: as another peer node command is executing, wait for that
command to complete its execution or terminate it before retrying:
lock is already acquired on file
/var/hyperledger/production/ledgersData/fileLock
I have tried different possible ways by stop and pausing the nodes but failed, can anyone please guide the right way to perform this task.
Thanks in Advance

peer node rollback -c mychannel -b 150
Note: The above-said command should be executed from the peer node, not from the CLI
Error: as another peer node command is executing, wait for that command to complete its execution or terminate it before retrying: lock is already acquired on file /var/hyperledger/production/ledgersData/fileLock
Please make sure that peer is offline when you are performing tasks such as
peer node reset
peer node rollback
Please note that rollback doest mean it delete the blocks permanently, after the rollback operation performed peer will receive blocks from the orderer or other peers

I have found the solution as follow:
First network was up and running, I have added following command in docker compose file for required peer lets say peer0.org1.example.com,
command: peer node rollback -c mychannel -b 1 && peer node start
After saving the changes run following command
docker-compose -f docker-compose-cli.yaml up -d peer0.org1.example.com
Now remove rollback part from above command, I can see logs show that it has been rollback successfully.
docker logs peer0.org1.example.com

Related

Error: endorsement failure during invoke. response: status:500 message:

I followed Hyperledger fabric official tutorial to deploy my first blockchain project. However, I met the problem that I have installed my chaincode named "basic" on channel "mychannel"
peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem" -C mychannel -n basic --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":"InitLedger","Args":[]}'
and the feedback is
Error: endorsement failure during invoke. response: status:500 message:"make sure the `chaincode basic has been successfully defined on channel mychannel and try again: chaincode definition for 'basic' exists, but chaincode is not installed"
but the last step I used the coomand
peer lifecycle chaincode querycommitted --channelID mychannel --name basic --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem"
and the feedback is
Committed chaincode definition for chaincode 'basic' on channel 'mychannel':
Version: 1.0, Sequence: 1, Endorsement Plugin: escc, Validation Plugin: vscc, Approvals: [Org1MSP: true, Org2MSP: true]
I think that means I was successful committed "basic" to the channel.
But I cannot invoking the chaincode by following tutorial's steps.
What should I do to fix the problem?
I use ubuntu 20.04. on Windows OS.
I use Mobaxterm to open WSL-Ubuntu-20.04.
Tutorial is enter link description here I met this problem is the first step at “Invoking the chaincode”
the step
If the contracts were commited, you should have 2 extra docker containers on your container list. Do a docker ps command to see if contract containers exist for 7051 and 9051. If the containers do not exist for the contracts, then you do not have a working contract.
Try stopping and starting your network by running the following in the docker folder - grasping at straws here
docker-compose -f docker-compose-couch.yaml -f docker-compose-ca.yaml -f docker-compose-test-net.yaml stop
docker-compose -f docker-compose-couch.yaml -f docker-compose-ca.yaml -f docker-compose-test-net.yaml start
If there is at least one contract container available, try a docker logs command to see if any useful output is available e.g.
docker logs [container Id value here]
Step through the contract loading procedure again, but remember to increase the sequence number and version number. You could set up some environment variables as follows
export CC_PACKAGE_VERSION=1
export CC_PACKAGE_SEQUENCE=1
and then use them on the command line as follows
--version $CC_PACKAGE_VERSION --sequence $CC_PACKAGE_SEQUENCE
By doing it that way, you can install the same contract as many times as it takes to get it working, or for amendments that might come later on.
Sometimes you will have to retrace your installation steps because it is so easy to get things wrong when working by hand. Have a look at the deployCC.sh script as well. But I would recommend that you persevere in getting things working by hand first and then use automation later on.
The output that you provided seems to indicate that everything should be correct, so I can't see what the problem is without seeing the full history from start to finish.
Check the packageId and use localhost instead of peer0.example.com

Error while invoking javascript chaincode

Error: endorsement failure during invoke. response: status:500 message:"make sure the chaincode basic2 has been successfully defined on channel mychannel and try again: chaincode definition for 'basic2' exists, but chaincode is not installed"
It gives me this error whenever I try to invoke chaincode but when I try to install chaincode again it shows that chain code is successfully installed. what should be the meaning of this error?
It also does not create a docker container.
So i try to instantiated with command
COMMAND: peer chaincode instantiate -o orderer.example.com:7050 -C mychannel -l node -n basic2 -v 1 -c '{"Args":["init"]}' -P 'OR ("Org1MSP.member")'
But then i got new error:
Error: error getting broadcast client: orderer client failed to connect to orderer.example.com:7050: failed to create new connection: context deadline exceeded
I check the logs of Orderer then it shows :
Can anyone tell me what is problem and how should i resolve it?
Try enabling the tls using the '--tls' flag. Also, you can refer to this similar question here
Make sure you're following the steps properly. Also, if you're sure about the steps, sometimes it works if you retry without making any changes, just repeat the step where you're facing the error without making any changes, it should work on the 3rd try atmost if everything goes well.

Error when deploying chaincode in test network

I've just started working on fabric an am having some trouble using the command:
./network.sh deployCC
after setting up my channels. This is the terminal readout:
'''
deploying chaincode on channel 'mychannel'
Vendoring Go dependencies ...
~/desktop/HF/fabric-samples/chaincode/fabcar/go ~/desktop/HF/fabric-samples/test-network
scripts/deployCC.sh: line 24: go: command not found
~/desktop/HF/fabric-samples/test-network
Finished vendoring Go dependencies
Using organization 1
++ peer lifecycle chaincode package fabcar.tar.gz --path ../chaincode/fabcar/go/ --lang golang --label fabcar_1
++ res=1
++ set +x
Error: failed to normalize chaincode path: failed to determine module root: exec: "go": executable file not found in $PATH
!!!!!!!!!!!!!!! Chaincode packaging on peer0.org1 has failed !!!!!!!!!!!!!!!!
ERROR !!! Deploying chaincode failed
'''
It seems that I must have messed something up in the prereqs. Any suggestions?
You are missing 'go' prerequisite. See in the test network documentation, the prerequisites section. You will need to install golang.
The Golang chaincodes can only be packaged through the CLI container. All the other language chain codes can be packaged through peer containers as well.

Error: endorsement failure during invoke. response: status:500 message:"error in simulation:

I'm using hyperledger fabric 2.0. I have two orgs. ORGA and ORGB. I'm using "test-network" of fabric-samples repository as my network.
I have edited javascript version of fabcar chaincode by changing the variable names in the init functions and other functions of fabcar.js chaincode.
I have installed my edited chaincode on the peers of two orgs. I have also successfully approved chaincode on 2 orgs. Successfully committed chaincode definition to the channel. But when I'm trying to invoke chaincode using command with function initLedger I'm getting error:
Command:
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 deed --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 --isInit -c '{"function":"initLedger","Args":[]}'
I'm getting an error shown below:
Error: endorsement failure during invoke. response: status:500
message:"error in simulation: failed to execute transaction
5b14718ab2408cd29dafc9daf33e193534c7a1262afebd0ca5eae3b0116aeca0:
could not launch chaincode
deed_1:48b197c4e734f589019d61ba1615ad9fc2b0007f478ab92a8b34714bc3c404e0:
chaincode registration failed: container exited with 1"
help me.
Regards,
Satish
Fabric provides monitordocker.sh along with its commercial-paper sample in the Fabric sample (https://hyperledger-fabric.readthedocs.io/en/latest/deploy_chaincode.html#setup-logspout-optional)
Run the below line in a separate PUTTY window to keep monitoring the logs across all containers in docker. Note that "fabric_test" is the name of the network that needs to be monitored.
./monitordocker.sh fabric_test
Now run the fabric command that results in error and you should see details on the log in the other PUTTY window.
The error is telling you that the container hosting the chaincode has exited after the chaincode process terminated with an exit code of 1. If you've configured the peer to stream the chaincode container logs (vm.docker.attachStdout=true / CORE_VM_DOCKER_ATTACHSTDOUT=true), you can look at the peer logs to see any errors produced by the chaincode.
Check your chaincode, their is some typo in your code.
check --> repair --> run following script -->
./startFabric.sh javascript
The name of the invoked chaincode does not match the name of the committed one.
Check it.

Error - chaincode exists

I'm getting this error when trying to start running my chaincode:
Command: composer network start -c adminCardLessor -n block-aviation-network -V 0.0.1 -A admin -C ./credentials/lessor/admin-pub.pem -f delete_me.card
Error: Error trying to start business network. Error: No valid responses from any peers.
Response from attempted peer comms was an error: Error: 2 UNKNOWN: chaincode error (status: 500, message: chaincode exists block-aviation-network)
I successfully installed my chaincode on each of my peers but can seem to start it due to the above error...
Does anyone have any experience with this error or how to resolve it?
Because the chaincode already exists on the network, you can only upgrade it, because I am assuming the network is not starting because you made some changes. Look toward questions such as How to upgrade a chaincode after modification? and then try starting the network. This should solve your problem.

Resources