Skip to content

Instantly share code, notes, and snippets.

Error :

Command :

 from 3rd Org
command peer channel fetch 0 -c channelheader -o orderer.example.com:7050 --tls --cafile $ORDERER_CA

Solution :

 forgot to include the signature of second Orgnization
peer channel update -f org3_update_in_envelope.pb -c $CHANNEL_NAME -o orderer.example.com:7050 --tls --cafile $ORDERER_CA
@rahulEth
rahulEth / fabric admin permission.asciidoc
Last active April 20, 2020 07:49
Hyperledger Fabric

Problem :

Why only ADMIN users in hyperledger fabric have the permission to install instantiate query in chaincode?

Solution :

 The main intention of hyperledger is to provide confidential transactions.
Chaincode contains sensitive information such as business logic.
The main purpose of hyperledger would not be satisfied if any user could install or instantiate a query in chaincode.
Hence, for now, only the Admin has the permission to install and/or instantiate queries.

Error :

 2020-02-14 10:25:26.069 UTC [endorser] callChaincode -> INFO 6cc3 [channelheader][f4380706] Entry chaincode: name:"mychannel"
2020-02-14 10:25:27.750 UTC [chaincode] HandleTransaction -> ERRO 6cc4 [f4380706] Failed to handle GET_STATE. error: no revision tag detected
github.com/hyperledger/fabric/core/ledger/util/couchdb.getRevisionHeader

Solution:

if you attempt to GetState() on an empty string above error reflects in peer logs. apply proper checks inside your chaincode to check whether string is empty or not.
@rahulEth
rahulEth / hlf-chaincode-devmode.md
Last active February 14, 2020 08:59
Guidelines for writing Hyperledger Fabric Chaincodes and Testing Using dev mode and Testing

Writing Hyperledger Fabric Chaincode and Testing using dev-mode

Chaincode initializes and manages the ledger state through transactions submitted by applications. A chaincode typically handles business logic agreed to by members of the network, so it similar to a “smart contract”. A chaincode can be invoked to update or query the ledger in a proposal transaction. Given the appropriate permission, a chaincode may invoke another chaincode, either in the same channel or in different channels, to access its state.

Below are a few general guidelines / caveats that can be adhered to (although there are exceptions) while writing chaincodes. These I have particularly written for chaincodes written for Hyperledger fabric v.1.4 network in golang. But, I believe they can be extrapolated to chaincodes written in any language for Hyperledger Fabric.

Use Chaincode DevMode

Error: error endorsing chaincode: rpc error: code = Unknown desc = access denied: channel [mychannel] creator org [QMLMSP]

Error msg :

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 :

if channel already exist and user try to create the same channel again orderer will through given error.
@rahulEth
rahulEth / network guru_default not found.asciidoc
Last active February 14, 2020 09:00
Hyperledger Fabric

Error logs :

Error: endorsement failure during query. response: status:500 message:"failed to execute transaction 6406c634b79a402e19179077f9554b51d6b73b343ec86af175093adc7bc8e5b2: [channel entity] could not launch chaincode entity:5.0: error starting container: error starting container: API error (404): network prod97raft_default not found".

Suggestion :

check your network name is same or mismatching.
 - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_byfn
     networks:
 - byfn

Error Logs :

github.com/hyperledger/fabric/core/ledger/util/couchdb.(*CouchDatabase).BatchRetrieveDocumentMetadata /opt/gopath/src/github.com/hyperledger/fabric/core/ledger/util/couchdb/couchdb.go:1484 github.com/hyperledger/fabric/core/ledger/kvledger/txmgmt/statedb/statecouchdb.(*subNsMetadataRetriever).execute /opt/gopath/src/github.com/hyperledger/fabric/core/ledger/kvledger/txmgmt/statedb/statecouchdb/metadata_retrieval.go:92 github.com/hyperledger/fabric/core/ledger/kvledger/txmgmt/statedb/statecouchdb.executeBatches /opt/gopath/src/github.com/hyperledger/fabric/core/ledger/kvledger/txmgmt/statedb/statecouchdb/batch_util.go:26 github.com/hyperledger/fabric/core/ledger/kvledger/txmgmt/statedb/statecouchdb.retrieveNsMetadata

Error Logs :

Possible Cause :

 What happens is that the transaction is simulated on a peer that didn't get the latest block of the blockchain and thus the version of the key that was used in the simulation was 2799, while the latest version of that key in the blockchain was 2800 (because of a previous transaction that its corresponding block didn't get into the ledger of the peer on time).
Notice that the ledger invalidates the transaction and considers it as an invalid because of MVCC (multi-version concurrency control) conflicts.

Solution :

Lower

Error:2019-12-11 05:59:24.583 UTC [common.deliver] deliverBlocks → WARN 062 [channel: mychannel] Rejecting deliver request for 172.18.0.23:48168 because of consenter error

Possible Cause :

if random leader election campaign going on due to *leader orderer crash* or
re-initiate election due to split vote case or some other scenario and
you are trying to invoke the transaction.you will get such error.

Solution :

make sure there is always leader orderer present.